add full path

This commit is contained in:
Frank Dornheim 2023-02-25 20:17:21 +01:00
parent 981d4f9072
commit 6d86c53e8a
3 changed files with 19 additions and 19 deletions

View File

@ -12,7 +12,7 @@
fail_msg: Need EPEL repo to install via distro package. fail_msg: Need EPEL repo to install via distro package.
- name: Install borgmatic and borg via distribution package manager - name: Install borgmatic and borg via distribution package manager
package: ansible.builtin.package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
loop: "{{ borg_distro_packages }}" loop: "{{ borg_distro_packages }}"

View File

@ -1,11 +1,11 @@
--- ---
- name: Install build dependencies - name: Install build dependencies
package: ansible.builtin.package:
name: "{{ borg_pip_packages }}" name: "{{ borg_pip_packages }}"
state: present state: present
- name: Create virtualenv for borg # noqa package-latest - name: Create virtualenv for borg # noqa package-latest
pip: ansible.builtin.pip:
name: name:
- pip - pip
- setuptools - setuptools
@ -14,13 +14,13 @@
virtualenv_command: "{{ python_bin }} -m venv" virtualenv_command: "{{ python_bin }} -m venv"
- name: Install dependent Python Packages - name: Install dependent Python Packages
pip: ansible.builtin.pip:
name: "{{ borg_dependent_python_packages }}" name: "{{ borg_dependent_python_packages }}"
virtualenv: /opt/borgmatic virtualenv: /opt/borgmatic
when: borg_dependent_python_packages is defined when: borg_dependent_python_packages is defined
- name: Install main Python Packages - name: Install main Python Packages
pip: ansible.builtin.pip:
name: "{{ item.name }}" name: "{{ item.name }}"
version: "{{ item.version | default(omit, true) }}" version: "{{ item.version | default(omit, true) }}"
virtualenv: /opt/borgmatic virtualenv: /opt/borgmatic
@ -28,7 +28,7 @@
loop: "{{ borg_python_packages }}" loop: "{{ borg_python_packages }}"
- name: Create borgmatic command in /usr/local/bin - name: Create borgmatic command in /usr/local/bin
copy: ansible.builtin.copy:
content: | content: |
#!/bin/bash #!/bin/bash
. /opt/borgmatic/bin/activate . /opt/borgmatic/bin/activate

View File

@ -1,6 +1,6 @@
--- ---
- name: Ensure legacy hooks aren't used - name: Ensure legacy hooks aren't used
assert: ansible.builtin.assert:
that: that:
- borgmatic_failure_command is undefined - borgmatic_failure_command is undefined
- borgmatic_before_backup_command is undefined - borgmatic_before_backup_command is undefined
@ -17,7 +17,7 @@
- "{{ ansible_lsb.id }}.yml" - "{{ ansible_lsb.id }}.yml"
- name: Install general dependencies (cron and openssh) - name: Install general dependencies (cron and openssh)
package: ansible.builtin.package:
name: "{{ borg_dep_packages }}" name: "{{ borg_dep_packages }}"
state: present state: present
@ -26,7 +26,7 @@
file: install_{{ borg_install_method }}.yml file: install_{{ borg_install_method }}.yml
- name: Ensure root has SSH key. - name: Ensure root has SSH key.
user: ansible.builtin.user:
name: "root" name: "root"
generate_ssh_key: yes generate_ssh_key: yes
ssh_key_file: "{{ ssh_key_file }}" ssh_key_file: "{{ ssh_key_file }}"
@ -34,18 +34,18 @@
register: root_user register: root_user
- name: Print key created for root user (use for remote repo) - name: Print key created for root user (use for remote repo)
debug: ansible.builtin.debug:
var: root_user['ssh_public_key'] var: root_user['ssh_public_key']
- name: Ensure /etc/borgmatic exists - name: Ensure /etc/borgmatic exists
file: ansible.builtin.file:
path: /etc/borgmatic path: /etc/borgmatic
state: directory state: directory
mode: 0700 mode: 0700
owner: root owner: root
- name: Add Borgmatic configuration - name: Add Borgmatic configuration
template: ansible.builtin.template:
src: config.yaml.j2 src: config.yaml.j2
dest: "/etc/borgmatic/{{ borgmatic_config_name }}" dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
mode: 0600 mode: 0600
@ -53,7 +53,7 @@
- name: Add cron-job for borgmatic (large repo, create and check separate) - name: Add cron-job for borgmatic (large repo, create and check separate)
block: block:
- name: Add cron job for regular create and prune - name: Add cron job for regular create and prune
cron: ansible.builtin.cron:
name: "{{ borgmatic_cron_name }}" name: "{{ borgmatic_cron_name }}"
hour: "{{ borgmatic_cron_hour }}" hour: "{{ borgmatic_cron_hour }}"
minute: "{{ borgmatic_cron_minute }}" minute: "{{ borgmatic_cron_minute }}"
@ -61,7 +61,7 @@
cron_file: "{{ borgmatic_cron_name }}" cron_file: "{{ borgmatic_cron_name }}"
job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} -C -p" job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} -C -p"
- name: Add cron job for infrequent checks - name: Add cron job for infrequent checks
cron: ansible.builtin.cron:
name: "{{ borgmatic_cron_name }}-check" name: "{{ borgmatic_cron_name }}-check"
day: "{{ borgmatic_cron_checks_day }}" day: "{{ borgmatic_cron_checks_day }}"
hour: "{{ borgmatic_cron_checks_hour }}" hour: "{{ borgmatic_cron_checks_hour }}"
@ -74,7 +74,7 @@
- name: Add cron-job for borgmatic (normal-sized repo) - name: Add cron-job for borgmatic (normal-sized repo)
block: block:
- name: Add cron job for create, check and prune - name: Add cron job for create, check and prune
cron: ansible.builtin.cron:
name: "{{ borgmatic_cron_name }}" name: "{{ borgmatic_cron_name }}"
hour: "{{ borgmatic_cron_hour }}" hour: "{{ borgmatic_cron_hour }}"
minute: "{{ borgmatic_cron_minute }}" minute: "{{ borgmatic_cron_minute }}"
@ -82,13 +82,13 @@
cron_file: "{{ borgmatic_cron_name }}" cron_file: "{{ borgmatic_cron_name }}"
job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}" job: "borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }}"
- name: Ensure separate check cron job is absent - name: Ensure separate check cron job is absent
cron: ansible.builtin.cron:
name: "{{ borgmatic_cron_name }}-check" name: "{{ borgmatic_cron_name }}-check"
state: absent state: absent
when: not borgmatic_large_repo when: not borgmatic_large_repo
- name: Set PATH for borgmatic cron job. - name: Set PATH for borgmatic cron job.
cron: ansible.builtin.cron:
user: "root" user: "root"
cron_file: "{{ borgmatic_cron_name }}" cron_file: "{{ borgmatic_cron_name }}"
name: PATH name: PATH