2023-10-25 22:26:17 +02:00
|
|
|
---
|
|
|
|
- name: template ssh private key
|
|
|
|
become: true
|
2024-07-23 18:55:37 +02:00
|
|
|
ansible.builtin.template:
|
|
|
|
src: private_key.j2
|
2023-10-25 22:26:17 +02:00
|
|
|
dest: "/etc/sanoid/.ssh/id_sanoid"
|
|
|
|
owner: "{{ sanoid_user }}"
|
|
|
|
group: "{{ sanoid_user_group }}"
|
|
|
|
mode: "0400"
|
2024-11-10 15:50:30 +01:00
|
|
|
no_log: "{{ no_debug | default('true') }}"
|
2023-10-25 22:26:17 +02:00
|
|
|
when:
|
|
|
|
- sanoid_syncoid_destination_host
|
|
|
|
|
2024-10-23 20:16:30 +02:00
|
|
|
- name: Ensure user is added to sudoers
|
2023-10-25 22:26:17 +02:00
|
|
|
become: true
|
2024-10-23 20:16:30 +02:00
|
|
|
community.general.sudoers:
|
|
|
|
name: "users-sudo-{{ sanoid_user }}"
|
2023-10-25 22:26:17 +02:00
|
|
|
state: present
|
2024-10-23 20:16:30 +02:00
|
|
|
user: "{{ sanoid_user }}"
|
|
|
|
commands: ALL
|
|
|
|
nopassword: true
|
2023-10-25 22:26:17 +02:00
|
|
|
when:
|
|
|
|
- sanoid_syncoid_destination_host
|
|
|
|
|
|
|
|
- name: template syncoid.service
|
|
|
|
become: true
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "syncoid.service.j2"
|
|
|
|
dest: /etc/systemd/system/syncoid.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
notify:
|
|
|
|
- systemctl daemon-reload
|
|
|
|
when:
|
|
|
|
- sanoid_syncoid_destination_host
|
|
|
|
|
2024-06-17 22:31:05 +02:00
|
|
|
- name: template syncoid.sh
|
|
|
|
become: true
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "syncoid.sh.j2"
|
|
|
|
dest: /usr/bin/syncoid.sh
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0755"
|
|
|
|
when:
|
|
|
|
- sanoid_syncoid_destination_host
|
|
|
|
|
2023-10-25 22:26:17 +02:00
|
|
|
- name: template syncoid_mail.service
|
|
|
|
become: true
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "syncoid_mail.service.j2"
|
|
|
|
dest: /etc/systemd/system/syncoid_mail.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
notify:
|
|
|
|
- systemctl daemon-reload
|
|
|
|
when:
|
|
|
|
- sanoid_syncoid_destination_host
|
|
|
|
|
|
|
|
- name: template syncoid.timer
|
|
|
|
become: true
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "syncoid.timer.j2"
|
|
|
|
dest: "/etc/systemd/system/syncoid.timer"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
notify:
|
|
|
|
- systemctl daemon-reload
|
|
|
|
when:
|
|
|
|
- sanoid_syncoid_destination_host
|
|
|
|
|
|
|
|
- name: enable syncoid.timer
|
|
|
|
become: true
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: "syncoid.timer"
|
|
|
|
enabled: true
|
|
|
|
masked: false
|
|
|
|
state: started
|
|
|
|
notify:
|
|
|
|
- systemctl daemon-reload
|
|
|
|
when:
|
|
|
|
- sanoid_syncoid_destination_host
|