Michael Grote
7a24089031
Reviewed-on: #584 Co-authored-by: Michael Grote <michael.grote@posteo.de> Co-committed-by: Michael Grote <michael.grote@posteo.de>
77 lines
1.7 KiB
YAML
77 lines
1.7 KiB
YAML
---
|
|
- name: template ssh private key
|
|
become: true
|
|
ansible.builtin.copy:
|
|
content: "{{ sanoid_syncoid_ssh_privkey }}"
|
|
dest: "/etc/sanoid/.ssh/id_sanoid"
|
|
owner: "{{ sanoid_user }}"
|
|
group: "{{ sanoid_user_group }}"
|
|
mode: "0400"
|
|
no_log: true
|
|
when:
|
|
- sanoid_syncoid_destination_host
|
|
|
|
- name: add user to sudoers
|
|
become: true
|
|
ansible.builtin.blockinfile:
|
|
path: /etc/sudoers
|
|
state: present
|
|
block: |
|
|
{{ sanoid_user }} ALL=(ALL) NOPASSWD:ALL
|
|
validate: '/usr/sbin/visudo -cf %s'
|
|
backup: true
|
|
marker_begin: sanoid-sudoers BEGIN
|
|
marker_end: sanoid-sudoers END
|
|
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
|
|
|
|
- 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
|