--- - name: Install Borg and Borgmatic via pip block: - name: Ensure the crb repository is enabled for RedHat (needed for xxhash) community.general.dnf_config_manager: name: crb state: enabled when: - ansible_os_family == 'RedHat' - ansible_distribution != 'Fedora' - ansible_distribution != 'Rocky' or ansible_distribution_major_version == "9" - name: Ensure that devel repository in enabled for Rocky 8 (need xxxhash-devel) community.general.dnf_config_manager: name: devel state: enabled when: ansible_distribution == 'Rocky' and ansible_distribution_major_version == "8" - name: Install build dependencies ansible.builtin.package: name: "{{ borg_pip_packages }}" state: present - name: Create virtualenv for borg # noqa package-latest ansible.builtin.pip: name: - pip - setuptools state: latest virtualenv: "{{ borg_venv_path }}" virtualenv_command: "{{ python_bin }} -m venv" - name: Install dependent Python packages ansible.builtin.pip: name: "{{ borg_dependent_python_packages }}" virtualenv: "{{ borg_venv_path }}" when: borg_dependent_python_packages is defined - name: Install main Python packages ansible.builtin.pip: name: "{{ item.name }}" version: "{{ item.version | default(omit, true) }}" virtualenv: "{{ borg_venv_path }}" when: borg_python_packages is defined loop: "{{ borg_python_packages }}" - name: Create links to Borgmatic and Borg binaries block: - name: Create borgmatic command in /usr/local/bin ansible.builtin.copy: content: | #!/bin/bash . "{{ borg_venv_path }}"/bin/activate borgmatic "$@" dest: /usr/local/bin/borgmatic mode: "0755" - name: Create borg command in /usr/local/bin ansible.builtin.copy: content: | #!/bin/bash . "{{ borg_venv_path }}"/bin/activate borg "$@" dest: /usr/local/bin/borg mode: "0755" - name: Set absolute path to /usr/bin ansible.builtin.set_fact: borg_abs_path: "/usr/local/bin" ...