change to script user: zfs_health (#253)
Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: mg/ansible#253 Co-authored-by: mg <michael.grote@posteo.de> Co-committed-by: mg <michael.grote@posteo.de>
This commit is contained in:
parent
d2c425f014
commit
869131dabe
3 changed files with 32 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
---
|
---
|
||||||
|
### when should the script be run
|
||||||
zfs_extra_cron_minutes_zfs_health: "0,15,30,45"
|
zfs_extra_cron_minutes_zfs_health: "0,15,30,45"
|
||||||
zfs_extra_cron_hours_zfs_health: "*"
|
zfs_extra_cron_hours_zfs_health: "*"
|
||||||
|
### under which user the script is run
|
||||||
|
zfs_health_user_group: "root"
|
||||||
|
zfs_health_user: "zfs-health"
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
---
|
---
|
||||||
- name: copy "zfs-health.sh"
|
- name: include user tasks
|
||||||
|
include_tasks: user.yml
|
||||||
|
|
||||||
|
- name: template script
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: zfs-health.sh
|
src: zfs-health.sh
|
||||||
dest: /usr/local/bin/zfs-health.sh
|
dest: /usr/local/bin/zfs-health.sh
|
||||||
mode: "+x"
|
mode: 0744
|
||||||
|
owner: "{{ zfs_health_user }}"
|
||||||
|
group: "{{ zfs_health_user_group }}"
|
||||||
|
|
||||||
- name: add cronjob "zfs-health.sh"
|
- name: ensure cronjob exists
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: zfs-health
|
name: zfs_health
|
||||||
state: present
|
state: present
|
||||||
job: "/usr/local/bin/zfs-health.sh"
|
job: "/usr/local/bin/zfs-health.sh"
|
||||||
minute: "{{ zfs_extra_cron_minutes_zfs_health }}"
|
minute: "{{ zfs_extra_cron_minutes_zfs_health }}"
|
||||||
hour: "{{ zfs_extra_cron_hours_zfs_health }}"
|
hour: "{{ zfs_extra_cron_hours_zfs_health }}"
|
||||||
|
user: "{{ zfs_health_user }}"
|
||||||
|
|
18
roles/mgrote.zfs_health/tasks/user.yml
Normal file
18
roles/mgrote.zfs_health/tasks/user.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: ensure group exists
|
||||||
|
become: true
|
||||||
|
ansible.builtin.group:
|
||||||
|
name: "{{ zfs_health_user_group }}"
|
||||||
|
state: present
|
||||||
|
when:
|
||||||
|
- zfs_health_user_group is defined
|
||||||
|
|
||||||
|
- name: ensure user exists
|
||||||
|
become: true
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: "{{ zfs_health_user }}"
|
||||||
|
group: "{{ zfs_health_user_group }}"
|
||||||
|
shell: /usr/sbin/nologin
|
||||||
|
when:
|
||||||
|
- zfs_health_user_group is defined
|
||||||
|
- zfs_health_user is defined
|
Loading…
Reference in a new issue