Add crontabs only when cron package is installed (many roles)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bc5e19c002
commit
24edbd680a
|
@ -1,5 +1,11 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
- name: Check if cron is installed
|
||||||
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
register: is_cron_installed
|
||||||
|
|
||||||
- name: "log rotation script"
|
- name: "log rotation script"
|
||||||
template:
|
template:
|
||||||
src: rotate_elasticsearch_logs.j2
|
src: rotate_elasticsearch_logs.j2
|
||||||
|
@ -7,3 +13,4 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0750"
|
mode: "0750"
|
||||||
|
when: is_cron_installed.rc == 0
|
||||||
|
|
|
@ -82,12 +82,20 @@
|
||||||
tags:
|
tags:
|
||||||
- etc-git
|
- etc-git
|
||||||
|
|
||||||
|
- name: Check if cron is installed
|
||||||
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
check_mode: no
|
||||||
|
register: is_cron_installed
|
||||||
|
|
||||||
- name: Optimize script is installed in monthly crontab
|
- name: Optimize script is installed in monthly crontab
|
||||||
copy:
|
copy:
|
||||||
src: optimize-etc-git
|
src: optimize-etc-git
|
||||||
dest: /etc/cron.monthly/optimize-etc-git
|
dest: /etc/cron.monthly/optimize-etc-git
|
||||||
mode: "0750"
|
mode: "0750"
|
||||||
force: no
|
force: no
|
||||||
|
when: is_cron_installed.rc == 0
|
||||||
tags:
|
tags:
|
||||||
- etc-git
|
- etc-git
|
||||||
|
|
||||||
|
@ -96,7 +104,7 @@
|
||||||
src: etc-git-status.j2
|
src: etc-git-status.j2
|
||||||
dest: /etc/cron.d/etc-git-status
|
dest: /etc/cron.d/etc-git-status
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
when: etc_git_monitor_status
|
when: is_cron_installed.rc == 0 and etc_git_monitor_status
|
||||||
tags:
|
tags:
|
||||||
- etc-git
|
- etc-git
|
||||||
|
|
||||||
|
@ -104,6 +112,6 @@
|
||||||
file:
|
file:
|
||||||
dest: /etc/cron.d/etc-git-status
|
dest: /etc/cron.d/etc-git-status
|
||||||
state: absent
|
state: absent
|
||||||
when: not etc_git_monitor_status
|
when: is_cron_installed.rc == 0 and not etc_git_monitor_status
|
||||||
tags:
|
tags:
|
||||||
- etc-git
|
- etc-git
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
- name: Check if cron is installed
|
||||||
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
check_mode: no
|
||||||
|
register: is_cron_installed
|
||||||
|
|
||||||
- name: evocheck crontab is updated
|
- name: evocheck crontab is updated
|
||||||
template:
|
template:
|
||||||
src: crontab.j2
|
src: crontab.j2
|
||||||
|
@ -8,3 +15,4 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
force: yes
|
force: yes
|
||||||
|
when: is_cron_installed.rc == 0
|
||||||
|
|
|
@ -84,13 +84,20 @@
|
||||||
|
|
||||||
#- name: Customizing /etc/fstab
|
#- name: Customizing /etc/fstab
|
||||||
|
|
||||||
|
- name: Check if cron is installed
|
||||||
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
check_mode: no
|
||||||
|
register: is_cron_installed
|
||||||
|
|
||||||
- name: Set verbose logging for cron deamon
|
- name: Set verbose logging for cron deamon
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/default/cron
|
dest: /etc/default/cron
|
||||||
line: "EXTRA_OPTS='-L 15'"
|
line: "EXTRA_OPTS='-L 15'"
|
||||||
create: yes
|
create: yes
|
||||||
state: present
|
state: present
|
||||||
when: evolinux_system_cron_verboselog
|
when: is_cron_installed.rc == 0 and evolinux_system_cron_verboselog
|
||||||
|
|
||||||
- name: Modify default umask for cron deamon
|
- name: Modify default umask for cron deamon
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -98,7 +105,7 @@
|
||||||
line: "umask 022"
|
line: "umask 022"
|
||||||
create: yes
|
create: yes
|
||||||
state: present
|
state: present
|
||||||
when: evolinux_system_cron_umask
|
when: is_cron_installed.rc == 0 and evolinux_system_cron_umask
|
||||||
|
|
||||||
- name: Randomize periodic crontabs
|
- name: Randomize periodic crontabs
|
||||||
replace:
|
replace:
|
||||||
|
@ -110,7 +117,7 @@
|
||||||
- { regexp: '^25\s*6((\s*\*){3})', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
- { regexp: '^25\s*6((\s*\*){3})', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
||||||
- { regexp: '^47\s*6((\s*\*){2}\s*7)', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
- { regexp: '^47\s*6((\s*\*){2}\s*7)', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
||||||
- { regexp: '^52\s*6(\s*1(\s*\*){2})', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
- { regexp: '^52\s*6(\s*1(\s*\*){2})', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
||||||
when: evolinux_system_cron_random
|
when: is_cron_installed.rc == 0 and evolinux_system_cron_random
|
||||||
|
|
||||||
- include_role:
|
- include_role:
|
||||||
name: ntpd
|
name: ntpd
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
---
|
---
|
||||||
|
- name: Check if cron is installed
|
||||||
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
register: is_cron_installed
|
||||||
|
|
||||||
- name: "log rotation script"
|
- name: "log rotation script"
|
||||||
template:
|
template:
|
||||||
src: rotate_logstash_logs.j2
|
src: rotate_logstash_logs.j2
|
||||||
|
@ -7,3 +12,4 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0750"
|
mode: "0750"
|
||||||
|
when: is_cron_installed.rc == 0
|
||||||
|
|
|
@ -100,6 +100,12 @@
|
||||||
tags:
|
tags:
|
||||||
- postfix
|
- postfix
|
||||||
|
|
||||||
|
- name: Check if cron is installed
|
||||||
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
register: is_cron_installed
|
||||||
|
|
||||||
- name: enable spam.sh cron
|
- name: enable spam.sh cron
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/cron.d/spam
|
dest: /etc/cron.d/spam
|
||||||
|
@ -107,6 +113,7 @@
|
||||||
create: yes
|
create: yes
|
||||||
state: present
|
state: present
|
||||||
mode: "0640"
|
mode: "0640"
|
||||||
|
when: is_cron_installed.rc == 0
|
||||||
tags:
|
tags:
|
||||||
- postfix
|
- postfix
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,12 @@
|
||||||
tags:
|
tags:
|
||||||
- spamassassin
|
- spamassassin
|
||||||
|
|
||||||
|
- name: Check if cron is installed
|
||||||
|
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
register: is_cron_installed
|
||||||
|
|
||||||
- name: enable sa-update.sh cron
|
- name: enable sa-update.sh cron
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/cron.d/sa-update
|
dest: /etc/cron.d/sa-update
|
||||||
|
@ -63,6 +69,7 @@
|
||||||
create: yes
|
create: yes
|
||||||
state: present
|
state: present
|
||||||
mode: "0640"
|
mode: "0640"
|
||||||
|
when: is_cron_installed.rc == 0
|
||||||
tags:
|
tags:
|
||||||
- spamassassin
|
- spamassassin
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue