Update module names
This commit is contained in:
parent
de417427f0
commit
b283222c79
4 changed files with 32 additions and 34 deletions
|
@ -7,9 +7,9 @@ restic_user_home: /root
|
||||||
|
|
||||||
restic_repository_name: restic
|
restic_repository_name: restic
|
||||||
restic_default_folders:
|
restic_default_folders:
|
||||||
- { path: '/etc' }
|
- { path: "/etc" }
|
||||||
- { path: '/var/log' }
|
- { path: "/var/log" }
|
||||||
- { path: '/root', exclude: '--exclude .cache' }
|
- { path: "/root", exclude: "--exclude .cache" }
|
||||||
restic_folders: []
|
restic_folders: []
|
||||||
restic_databases: []
|
restic_databases: []
|
||||||
restic_dump_compression_enabled: false
|
restic_dump_compression_enabled: false
|
||||||
|
@ -21,7 +21,7 @@ restic_check: true
|
||||||
restic_ssh_enabled: true
|
restic_ssh_enabled: true
|
||||||
restic_ssh_host: backup
|
restic_ssh_host: backup
|
||||||
restic_ssh_port: 22
|
restic_ssh_port: 22
|
||||||
restic_ssh_private_key_path: '/root/.ssh/backup'
|
restic_ssh_private_key_path: "/root/.ssh/backup"
|
||||||
|
|
||||||
restic_systemd_timer_on_calender: '*-*-* 03:00:00'
|
restic_systemd_timer_on_calender: "*-*-* 03:00:00"
|
||||||
restic_systemd_timer_randomized_delay_sec: 0
|
restic_systemd_timer_randomized_delay_sec: 0
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: systemd reload
|
- name: systemd reload
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Install fuse (to mount repositories)
|
- name: Install fuse (to mount repositories)
|
||||||
apt:
|
apt:
|
||||||
name: fuse
|
name: fuse
|
||||||
|
@ -13,23 +12,23 @@
|
||||||
name: pigz
|
name: pigz
|
||||||
|
|
||||||
- name: Download restic
|
- name: Download restic
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: 'https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_amd64.bz2'
|
url: "https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_amd64.bz2"
|
||||||
dest: '/tmp/restic_{{ restic_version }}_linux_amd64.bz2'
|
dest: "/tmp/restic_{{ restic_version }}_linux_amd64.bz2"
|
||||||
|
|
||||||
- name: Extract restic
|
- name: Extract restic
|
||||||
command: 'bzip2 -d /tmp/restic_{{ restic_version }}_linux_amd64.bz2'
|
command: "bzip2 -d /tmp/restic_{{ restic_version }}_linux_amd64.bz2"
|
||||||
args:
|
args:
|
||||||
creates: '/tmp/restic_{{ restic_version }}_linux_amd64'
|
creates: "/tmp/restic_{{ restic_version }}_linux_amd64"
|
||||||
|
|
||||||
- name: Install restic
|
- name: Install restic
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
remote_src: true
|
remote_src: true
|
||||||
src: '/tmp/restic_{{ restic_version }}_linux_amd64'
|
src: "/tmp/restic_{{ restic_version }}_linux_amd64"
|
||||||
dest: "{{ restic_path }}"
|
dest: "{{ restic_path }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Remove downloaded file
|
- name: Remove downloaded file
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: '/tmp/restic_{{ restic_version }}_linux_amd64'
|
path: "/tmp/restic_{{ restic_version }}_linux_amd64"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
---
|
---
|
||||||
- name: Check if restic is installed
|
- name: Check if restic is installed
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: '{{ restic_path }}'
|
path: "{{ restic_path }}"
|
||||||
register: restic_binary
|
register: restic_binary
|
||||||
|
|
||||||
- include_tasks: install.yml
|
- include_tasks: install.yml
|
||||||
when: not restic_binary.stat.exists or restic_install
|
when: not restic_binary.stat.exists or restic_install
|
||||||
|
|
||||||
- name: Overwrite SSH config for backup server
|
- name: Overwrite SSH config for backup server
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: ssh_config.j2
|
src: ssh_config.j2
|
||||||
dest: '{{ restic_user_home }}/.ssh/config'
|
dest: "{{ restic_user_home }}/.ssh/config"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0600'
|
mode: "0600"
|
||||||
when: restic_ssh_enabled
|
when: restic_ssh_enabled
|
||||||
|
|
||||||
- name: Add SSH private key
|
- name: Add SSH private key
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: ssh_private_key.j2
|
src: ssh_private_key.j2
|
||||||
dest: '{{ restic_ssh_private_key_path }}'
|
dest: "{{ restic_ssh_private_key_path }}"
|
||||||
mode: '0600'
|
mode: "0600"
|
||||||
when: restic_ssh_private_key is defined and restic_ssh_enabled
|
when: restic_ssh_private_key is defined and restic_ssh_enabled
|
||||||
|
|
||||||
- name: Add restic_env in home folder
|
- name: Add restic_env in home folder
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: restic_env.j2
|
src: restic_env.j2
|
||||||
dest: '{{ restic_user_home }}/.restic_env'
|
dest: "{{ restic_user_home }}/.restic_env"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0600'
|
mode: "0600"
|
||||||
|
|
||||||
- name: Add systemd service for restic
|
- name: Add systemd service for restic
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: restic-backup.service.j2
|
src: restic-backup.service.j2
|
||||||
dest: /etc/systemd/system/restic-backup.service
|
dest: /etc/systemd/system/restic-backup.service
|
||||||
mode: '0644'
|
mode: "0644"
|
||||||
vars:
|
vars:
|
||||||
restic_folders_combined: '{{ restic_default_folders + restic_folders }}'
|
restic_folders_combined: "{{ restic_default_folders + restic_folders }}"
|
||||||
notify: systemd reload
|
notify: systemd reload
|
||||||
|
|
||||||
- name: Add systemd timer for restic
|
- name: Add systemd timer for restic
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: restic-backup.timer.j2
|
src: restic-backup.timer.j2
|
||||||
dest: /etc/systemd/system/restic-backup.timer
|
dest: /etc/systemd/system/restic-backup.timer
|
||||||
mode: '0644'
|
mode: "0644"
|
||||||
notify: systemd reload
|
notify: systemd reload
|
||||||
|
|
||||||
- name: Enable and start restic timer
|
- name: Enable and start restic timer
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: restic-backup.timer
|
name: restic-backup.timer
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
|
|
Loading…
Reference in a new issue