2020-08-25 17:57:22 +02:00
|
|
|
---
|
2022-06-23 16:17:42 +02:00
|
|
|
- name: "Deploy dynamic motd script for CARP master or backup"
|
2020-08-25 17:57:22 +02:00
|
|
|
copy:
|
|
|
|
src: motd-carp-state.sh
|
|
|
|
dest: /usr/share/scripts/motd-carp-state.sh
|
2022-06-23 18:35:39 +02:00
|
|
|
force: true
|
2020-08-25 17:57:22 +02:00
|
|
|
owner: root
|
|
|
|
group: wheel
|
|
|
|
mode: '0755'
|
2022-06-23 18:35:39 +02:00
|
|
|
tags:
|
|
|
|
- post-install
|
|
|
|
- motd
|
|
|
|
- motd-utils
|
2020-08-25 17:57:22 +02:00
|
|
|
|
2022-06-23 16:17:42 +02:00
|
|
|
- name: "Fetch root crontab content"
|
2020-10-23 10:15:57 +02:00
|
|
|
command: >
|
2020-10-26 16:39:43 +01:00
|
|
|
grep "/bin/sh /usr/share/scripts/motd-carp-state.sh" /var/cron/tabs/root
|
2020-10-14 17:19:27 +02:00
|
|
|
check_mode: false
|
|
|
|
register: root_crontab_content
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
2022-06-23 18:35:39 +02:00
|
|
|
tags:
|
|
|
|
- post-install
|
|
|
|
- motd
|
2020-10-14 17:19:27 +02:00
|
|
|
|
2022-06-23 16:17:42 +02:00
|
|
|
- name: "Cron job for dynamic motd script is installed"
|
2020-08-25 17:57:22 +02:00
|
|
|
cron:
|
|
|
|
name: dynamic motd for CARP
|
|
|
|
job: "/bin/sh /usr/share/scripts/motd-carp-state.sh"
|
|
|
|
disabled: true
|
2020-10-14 17:19:27 +02:00
|
|
|
when:
|
2020-10-23 10:15:57 +02:00
|
|
|
- not (root_crontab_content.stdout
|
|
|
|
| regex_search('/bin/sh /usr/share/scripts/motd-carp-state.sh'))
|
2022-06-23 18:35:39 +02:00
|
|
|
tags:
|
|
|
|
- post-install
|
|
|
|
- motd
|