Bugfix: sanoid (#258)

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#258
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
This commit is contained in:
Michael Grote 2021-11-30 13:44:54 +01:00
parent 2a5d9a8dea
commit 90ff3cab79

View file

@ -1,96 +1,95 @@
--- ---
- name: include user tasks - name: include user tasks
include_tasks: user.yml include_tasks: user.yml
- name: Install Required Packages - name: Install Required Packages
become: true become: true
ansible.builtin.package: ansible.builtin.package:
name: name:
- ca-certificates - ca-certificates
- apt-transport-https - apt-transport-https
- software-properties-common - software-properties-common
- curl - curl
- wget - wget
- logrotate - logrotate
- libcapture-tiny-perl - libcapture-tiny-perl
- libconfig-inifiles-perl - libconfig-inifiles-perl
- moreutils - moreutils
state: present state: present
- name: Create Sanoid Directory - name: Create Sanoid Directory
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
owner: "{{ sanoid_user }}" owner: "{{ sanoid_user }}"
group: "{{ sanoid_user_group }}" group: "{{ sanoid_user_group }}"
recurse: true recurse: true
with_items: with_items:
- /usr/local/bin - /etc/sanoid
- /etc/sanoid
- name: Install Sanoid Binary
- name: Install Sanoid Binary become: true
become: true ansible.builtin.get_url:
ansible.builtin.get_url: url: "{{ sanoid_dl_url }}"
url: "{{ sanoid_dl_url }}" dest: /usr/local/bin/sanoid
dest: /usr/local/bin/sanoid owner: "{{ sanoid_user }}"
owner: "{{ sanoid_user }}" group: "{{ sanoid_user_group }}"
group: "{{ sanoid_user_group }}" mode: 0755
mode: 0755
- name: Install Sanoid Defaults Configuration
- name: Install Sanoid Defaults Configuration become: true
become: true ansible.builtin.get_url:
ansible.builtin.get_url: url: "{{ sanoid_dl_conf_url }}"
url: "{{ sanoid_dl_conf_url }}" dest: /etc/sanoid/sanoid.defaults.conf
dest: /etc/sanoid/sanoid.defaults.conf owner: "{{ sanoid_user }}"
owner: "{{ sanoid_user }}" group: "{{ sanoid_user_group }}"
group: "{{ sanoid_user_group }}" mode: 0644
mode: 0644
- name: Generate Sanoid Configuration
- name: Generate Sanoid Configuration become: true
become: true ansible.builtin.template:
ansible.builtin.template: src: sanoid.conf.j2
src: sanoid.conf.j2 dest: /etc/sanoid/sanoid.conf
dest: /etc/sanoid/sanoid.conf owner: "{{ sanoid_user }}"
owner: "{{ sanoid_user }}" group: "{{ sanoid_user_group }}"
group: "{{ sanoid_user_group }}" mode: 0644
mode: 0644
- name: Create Sanoid Log
- name: Create Sanoid Log become: true
become: true ansible.builtin.file:
ansible.builtin.file: path: "{{ sanoid_log_file }}"
path: "{{ sanoid_log_file }}" state: touch
state: touch owner: "{{ sanoid_user }}"
owner: "{{ sanoid_user }}" group: "{{ sanoid_user_group }}"
group: "{{ sanoid_user_group }}" mode: 0644
mode: 0644 access_time: preserve
access_time: preserve modification_time: preserve
modification_time: preserve
- name: copy logrotate config
- name: copy logrotate config become: yes
become: yes ansible.builtin.template:
ansible.builtin.template: src: logrotate_sanoid
src: logrotate_sanoid dest: /etc/logrotate.d/sanoid
dest: /etc/logrotate.d/sanoid owner: "{{ sanoid_user }}"
owner: "{{ sanoid_user }}" group: "{{ sanoid_user_group }}"
group: "{{ sanoid_user_group }}" mode: 0644
mode: 0644
- name: Generate Sanoid Cron Scripts
- name: Generate Sanoid Cron Scripts become: true
become: true ansible.builtin.template:
ansible.builtin.template: src: sanoid-cron.sh
src: sanoid-cron.sh dest: /usr/local/bin/sanoid-cron.sh
dest: /usr/local/bin/sanoid-cron.sh owner: "{{ sanoid_user }}"
owner: "{{ sanoid_user }}" group: "{{ sanoid_user_group }}"
group: "{{ sanoid_user_group }}" mode: 0755
mode: 0755
- name: Configure Sanoid Cron Job
- name: Configure Sanoid Cron Job become: true
become: true ansible.builtin.cron:
ansible.builtin.cron: name: sanoid-cron
name: sanoid-cron job: /usr/local/bin/sanoid-cron.sh
job: /usr/local/bin/sanoid-cron.sh minute: "{{ sanoid_cron_minutes }}"
minute: "{{ sanoid_cron_minutes }}" hour: "{{ sanoid_cron_hours }}"
hour: "{{ sanoid_cron_hours }}" user: "{{ sanoid_user }}"
user: "{{ sanoid_user }}" state: present
state: present