--- # TODO: install in block - name: Install requirements ansible.builtin.package: name: git - name: Clone source code ansible.builtin.git: repo: https://github.com/jech/galene dest: /opt/galene version: "{{ galene_version }}" - name: Compile ansible.builtin.command: chdir: /opt/galene cmd: go build -ldflags='-s -w' creates: /opt/galene/galene environment: CGO_ENABLED: "0" PATH: /usr/local/go/bin - name: Install ansible.builtin.copy: remote_src: true src: /opt/galene/galene dest: /usr/local/bin/galene owner: root group: root mode: "0755" # TODO End of install in block - name: Create user ansible.builtin.user: name: "{{ galene_user }}" system: true password: '!' home: "{{ galene_base_directory }}" create_home: false - name: Create directories ansible.builtin.file: path: "{{ item }}" state: directory owner: "{{ galene_user }}" group: "{{ galene_group }}" mode: "0755" loop: - "{{ galene_base_directory }}" - "{{ galene_data_directory }}" - "{{ galene_groups_directory }}" - "{{ galene_recording_directory }}" - "{{ galene_static_directory }}" - name: Copy static directory ansible.builtin.copy: src: /opt/galene/static/ dest: "{{ galene_static_directory }}/" remote_src: true mode: "0755" owner: "{{ galene_user }}" group: "{{ galene_group }}" when: galene_static_directory != "/opt/galene/static" - name: Configure groups ansible.builtin.copy: content: "{{ item.value | to_json }}" dest: "{{ galene_groups_directory }}/{{ item.key }}.json" owner: "{{ galene_user }}" group: "{{ galene_group }}" mode: "0600" loop: "{{ galene_groups | dict2items }}" loop_control: label: "{{ item.key }}" notify: Restart galene - name: Create global configuration ansible.builtin.copy: content: "{{ galene_config | to_json }}" dest: "{{ galene_data_directory }}/config.json" owner: "{{ galene_user }}" group: "{{ galene_group }}" mode: "0600" notify: Restart galene - name: Configure TLS certificates when: galene_domain is defined ansible.builtin.copy: remote_src: true src: "{{ item.src }}" dest: "{{ item.dest }}" owner: "{{ galene_user }}" group: "{{ galene_group }}" loop: - src: "/etc/letsencrypt/live/{{ galene_domain }}/fullchain.pem" dest: "{{ galene_data_directory }}/cert.pem" mode: "0644" - src: "/etc/letsencrypt/live/{{ galene_domain }}/privkey.pem" dest: "{{ galene_data_directory }}/key.pem" mode: "0600" - name: Create service ansible.builtin.template: src: galene.service.j2 dest: /etc/systemd/system/galene.service mode: "0644" owner: root group: root notify: - Reload systemd - Restart galene - name: Start service ansible.builtin.service: name: galene state: started enabled: true