From 5b3596040414a333339c8f94e998f673ec37262f Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Tue, 29 Oct 2024 14:50:44 +0100 Subject: [PATCH] dd --- roles/mgrote_zfs_sanoid/tasks/destination.yml | 87 ------------------- roles/mgrote_zfs_sanoid/tasks/main.yml | 19 ---- roles/mgrote_zfs_sanoid/tasks/snaps.yml | 6 +- roles/mgrote_zfs_sanoid/tasks/source.yml | 20 ----- 4 files changed, 3 insertions(+), 129 deletions(-) delete mode 100644 roles/mgrote_zfs_sanoid/tasks/destination.yml delete mode 100644 roles/mgrote_zfs_sanoid/tasks/source.yml diff --git a/roles/mgrote_zfs_sanoid/tasks/destination.yml b/roles/mgrote_zfs_sanoid/tasks/destination.yml deleted file mode 100644 index 2b90d998..00000000 --- a/roles/mgrote_zfs_sanoid/tasks/destination.yml +++ /dev/null @@ -1,87 +0,0 @@ ---- -- name: template ssh private key - become: true - ansible.builtin.file: - state: absent - path: "/etc/sanoid/.ssh/id_sanoid" - owner: "{{ sanoid_user }}" - group: "{{ sanoid_user_group }}" - mode: "0400" - no_log: true - when: - - sanoid_syncoid_destination_host - -- name: Ensure user is added to sudoers - become: true - community.general.sudoers: - name: "users-sudo-{{ sanoid_user }}" - state: absent - user: "{{ sanoid_user }}" - commands: ALL - nopassword: true - when: - - sanoid_syncoid_destination_host - -- name: template syncoid.service - become: true - ansible.builtin.file: - state: absent - path: /etc/systemd/system/syncoid.service - owner: root - group: root - mode: "0644" - notify: - - systemctl daemon-reload - when: - - sanoid_syncoid_destination_host - -- name: template syncoid.sh - become: true - ansible.builtin.file: - state: absent - path: /usr/bin/syncoid.sh - owner: root - group: root - mode: "0755" - when: - - sanoid_syncoid_destination_host - -- name: template syncoid_mail.service - become: true - ansible.builtin.file: - state: absent - path: /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.file: - state: absent - path: "/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: false - masked: true - state: stopped - notify: - - systemctl daemon-reload - when: - - sanoid_syncoid_destination_host - -# remove package by hand diff --git a/roles/mgrote_zfs_sanoid/tasks/main.yml b/roles/mgrote_zfs_sanoid/tasks/main.yml index d787c10c..4b664e80 100644 --- a/roles/mgrote_zfs_sanoid/tasks/main.yml +++ b/roles/mgrote_zfs_sanoid/tasks/main.yml @@ -14,15 +14,6 @@ - sanoid state: present -- name: Overwrite syncoid script from package # todo - become: true - ansible.builtin.file: - dest: /usr/bin/syncoid - mode: '0755' - owner: root - group: root - state: absent - - name: create sanoid directories become: true ansible.builtin.file: @@ -63,13 +54,3 @@ loop: - sanoid.service - sanoid-prune.service - -- name: include source-host tasks # todo - ansible.builtin.include_tasks: source.yml - when: - - sanoid_syncoid_source_host is defined and sanoid_syncoid_source_host is true - -- name: include destination-host tasks # todo - ansible.builtin.include_tasks: destination.yml - when: - - sanoid_syncoid_destination_host is defined and sanoid_syncoid_destination_host is true diff --git a/roles/mgrote_zfs_sanoid/tasks/snaps.yml b/roles/mgrote_zfs_sanoid/tasks/snaps.yml index 5a6b6aac..e1fd4c12 100644 --- a/roles/mgrote_zfs_sanoid/tasks/snaps.yml +++ b/roles/mgrote_zfs_sanoid/tasks/snaps.yml @@ -1,5 +1,5 @@ --- -- name: Generate Sanoid Configuration +- name: Template sanoid configuration become: true ansible.builtin.template: src: sanoid.conf.j2 @@ -8,7 +8,7 @@ group: "{{ sanoid_user_group }}" mode: "0400" -- name: template sanoid_mail.service +- name: Template sanoid_mail.service become: true ansible.builtin.template: src: "sanoid_mail.service.j2" @@ -30,7 +30,7 @@ notify: - systemctl daemon-reload -- name: set timer +- name: add timer overrides become: true ansible.builtin.blockinfile: create: true diff --git a/roles/mgrote_zfs_sanoid/tasks/source.yml b/roles/mgrote_zfs_sanoid/tasks/source.yml deleted file mode 100644 index 0544a5fd..00000000 --- a/roles/mgrote_zfs_sanoid/tasks/source.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -#- name: template ssh public key -# become: true -# ansible.posix.authorized_key: # TODO händisch loschen -# user: "{{ sanoid_user }}" - #key: "{{ sanoid_syncoid_ssh_pubkey }}" -# state: absent -# when: -# - sanoid_syncoid_source_host - -- name: Ensure user is added to sudoers - become: true - community.general.sudoers: - name: "users-sudo-{{ sanoid_user }}" - state: absent - user: "{{ sanoid_user }}" - commands: ALL - nopassword: true - when: - - sanoid_syncoid_source_host