--- - name: Ensure directory for virtualenv is {{ synapse_state }} ansible.builtin.file: path: "{{ synapse_venv_path }}" owner: >-2 {{ synapse_user_info.uid | default(synapse_user) }} group: >-2 {{ synapse_user_info.group | default(synapse_user) }} mode: "{{ synapse_venv_path_mode | default('0755') }}" state: >- {{ (synapse_state == 'present') | ternary('directory', 'absent') }} - name: Ensure virtual environment is {{ synapse_state }} ansible.builtin.pip: name: "{{ synapse_venv_pip_dependencies }}" virtualenv: "{{ synapse_venv_path }}" virtualenv_python: "{{ synapse_venv_python_binary }}" extra_args: "{{ synapse_venv_extra_args | default(omit, true) }}" state: "{{ synapse_state }}" - name: Ensure synapse pip package is {{ synapse_state }} ansible.builtin.pip: name: "{{ synapse_venv_package }}" version: "{{ synapse_version }}" state: "{{ synapse_state }}" virtualenv: "{{ synapse_venv_path }}" notify: - synapse-restart - name: Ensure systemd unit is {{ synapse_state }} ansible.builtin.template: src: "synapse.service.j2" dest: "{{ synapse_systemd_service_file }}" notify: - systemd-daemon-reload - meta: flush_handlers - name: Ensure systemd service is {{ synapse_state }} ansible.builtin.systemd: name: "{{ synapse_systemd_service_name }}" state: "{{ synapse_systemd_service_state }}" - name: Ensure systemd service is {{ synapse_systemd_service_enabled | ternary('enabled', 'disabled') }} ansible.builtin.systemd: name: "{{ synapse_systemd_service_name }}" enabled: "{{ synapse_systemd_service_enabled }}"