--- - name: Prepare base folder file: path: "{{ authelia_base_dir }}" state: directory owner: "{{ authelia_user }}" group: "{{ authelia_user }}" mode: 0750 become: True become_user: root - block: - name: Prepare folder structure file: path: "{{ item }}" state: directory mode: 0750 loop: - "{{ authelia_config_dir }}" - "{{ authelia_data_dir }}" - name: Download and extract authelia tarball unarchive: src: "https://github.com/authelia/authelia/releases/download/v{{ authelia_version }}/authelia-v{{ authelia_version }}-linux-amd64.tar.gz" dest: "{{ authelia_base_dir }}" remote_src: yes exclude: - authelia.service - config.template.yml notify: __authelia_restart when: authelia_version is version(authelia_current_version, ">") or authelia_current_version is version('0.0.0', "=") - name: Create binary symlink file: src: "{{ authelia_base_dir }}/authelia-linux-amd64" dest: "{{ authelia_base_dir }}/authelia" state: link notify: __authelia_restart become: True become_user: "{{ authelia_user }}" - block: - name: Copy Authelia config file template: src: "conf/authelia.yml.j2" dest: "{{ authelia_config_dir }}/authelia.yml" owner: "{{ authelia_user }}" group: "{{ authelia_user }}" mode: 0600 notify: __authelia_restart - name: Copy local users database template: src: "conf/users_database.yml.j2" dest: "{{ authelia_config_dir }}/users_database.yml" owner: "{{ authelia_user }}" group: "{{ authelia_user }}" mode: 0600 notify: __authelia_restart when: authelia_auth_local_users | length > 0 - name: Copy systemd unit file template: src: "etc/systemd/system/authelia.service.j2" dest: "/etc/systemd/system/authelia.service" mode: 0640 notify: __authelia_restart - name: Ensure Authelia service is up and running service: name: authelia daemon_reload: yes enabled: yes state: started - name: Set current version to custom fact template: src: etc/ansible/facts.d/authelia.fact.j2 dest: /etc/ansible/facts.d/authelia.fact mode: 0644 owner: root group: root when: authelia_version is version(authelia_current_version, ">") or authelia_current_version is version('0.0.0', "=") become: True become_user: root