2023-03-06 23:13:54 +00:00
|
|
|
---
|
|
|
|
# tasks file for borgmatic
|
|
|
|
|
|
|
|
- name: Déployer la clef privée
|
|
|
|
ansible.builtin.copy:
|
|
|
|
content: "{{ borgmatic_keys.private }}"
|
|
|
|
dest: /etc/borgmatic/id_ed25519
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=,o=
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Déployer la clef publique
|
|
|
|
ansible.builtin.copy:
|
|
|
|
content: "{{ borgmatic_keys.public }}"
|
|
|
|
dest: /etc/borgmatic/id_ed25519.pub
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
become: true
|
|
|
|
|
2023-05-26 15:20:21 +00:00
|
|
|
- name: Déployer la configuration de SSH
|
|
|
|
ansible.builtin.blockinfile:
|
|
|
|
path: /root/.ssh/config
|
|
|
|
create: true
|
|
|
|
marker: "# {mark} ANSIBLE MANAGED BLOCK for role_borgmatic"
|
|
|
|
block: |
|
|
|
|
{% for repository in borgmatic_repositories %}
|
2023-07-28 07:03:59 +00:00
|
|
|
Host {{ repository.path | ansible.builtin.urlsplit('hostname') }}
|
2023-12-19 15:36:21 +00:00
|
|
|
Compression yes
|
|
|
|
Protocol 2
|
|
|
|
PreferredAuthentications=publickey
|
|
|
|
StrictHostKeyChecking no
|
|
|
|
UserKnownHostsFile /dev/null
|
2023-05-26 15:20:21 +00:00
|
|
|
IdentityFile /etc/borgmatic/id_ed25519
|
|
|
|
IdentitiesOnly yes
|
|
|
|
{% endfor %}
|
|
|
|
become: true
|
|
|
|
|
2023-03-06 23:13:54 +00:00
|
|
|
- name: Déployer la configuration
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: config.yaml.j2
|
|
|
|
dest: /etc/borgmatic/config.yaml
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=,o=
|
2023-12-18 16:12:52 +00:00
|
|
|
validate: borgmatic config validate --config %s
|
2023-03-06 23:13:54 +00:00
|
|
|
become: true
|
|
|
|
notify: Créer le dépôt
|
|
|
|
|
|
|
|
- name: Déployer le service
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: borgmatic.service.j2
|
|
|
|
dest: /etc/systemd/system/borgmatic.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
become: true
|
|
|
|
notify: Activer et démarrer le service
|
|
|
|
|
|
|
|
- name: Déployer le service et la planification
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: borgmatic.timer.j2
|
|
|
|
dest: /etc/systemd/system/borgmatic.timer
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
become: true
|
|
|
|
notify: Activer la planification
|