This commit is contained in:
Michael Grote 2024-10-29 14:50:44 +01:00
parent 7761806257
commit 5b35960404
4 changed files with 3 additions and 129 deletions

View file

@ -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

View file

@ -14,15 +14,6 @@
- sanoid - sanoid
state: present 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 - name: create sanoid directories
become: true become: true
ansible.builtin.file: ansible.builtin.file:
@ -63,13 +54,3 @@
loop: loop:
- sanoid.service - sanoid.service
- sanoid-prune.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

View file

@ -1,5 +1,5 @@
--- ---
- name: Generate Sanoid Configuration - name: Template sanoid configuration
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: sanoid.conf.j2 src: sanoid.conf.j2
@ -8,7 +8,7 @@
group: "{{ sanoid_user_group }}" group: "{{ sanoid_user_group }}"
mode: "0400" mode: "0400"
- name: template sanoid_mail.service - name: Template sanoid_mail.service
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: "sanoid_mail.service.j2" src: "sanoid_mail.service.j2"
@ -30,7 +30,7 @@
notify: notify:
- systemctl daemon-reload - systemctl daemon-reload
- name: set timer - name: add timer overrides
become: true become: true
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
create: true create: true

View file

@ -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