diff --git a/evolixisation.yml b/evolixisation.yml index 7547867..03af200 100644 --- a/evolixisation.yml +++ b/evolixisation.yml @@ -1,3 +1,4 @@ +# yamllint disable rule:line-length # Playbook command # First use (become_method: su, and var_files uncommented) : # ansible-playbook evolixisation.yml --ask-vault-pass -CDki hosts -l HOSTNAME -u root @@ -40,5 +41,4 @@ tasks_from: exec.yml # environment: -# yamllint disable-line rule:line-length # PKG_PATH: "http://ftp.openbsd.org/pub/OpenBSD/{{ ansible_distribution_version }}/packages/{{ ansible_architecture }}/" diff --git a/roles/base/tasks/evobackup.yml b/roles/base/tasks/evobackup.yml index 6d4e3d2..c72a56b 100644 --- a/roles/base/tasks/evobackup.yml +++ b/roles/base/tasks/evobackup.yml @@ -10,6 +10,15 @@ tags: - evobackup +- name: Fetch daily.local content + command: 'grep "sh /usr/share/scripts/zzz_evobackup" /etc/daily.local' + check_mode: false + register: daily_local_content + failed_when: false + changed_when: false + tags: + - evobackup + - name: Add evobackup cron (disabled) lineinfile: path: /etc/daily.local @@ -17,6 +26,9 @@ owner: root mode: "0644" create: true + when: + - not (daily_local_content.stdout + | regex_search('sh /usr/share/scripts/zzz_evobackup')) tags: - evobackup diff --git a/roles/base/tasks/sudo.yml b/roles/base/tasks/sudo.yml index 26913bc..b3fce09 100644 --- a/roles/base/tasks/sudo.yml +++ b/roles/base/tasks/sudo.yml @@ -13,7 +13,7 @@ lineinfile: dest: /etc/sudoers insertafter: '# and set environment variables.' - line: '%wheel ALL=(ALL) SETENV: ALL' + line: '%wheel ALL=(ALL) SETENV: ALL' validate: 'visudo -cf %s' backup: false tags: diff --git a/roles/etc-git/tasks/main.yml b/roles/etc-git/tasks/main.yml index cb01472..72b2ff3 100644 --- a/roles/etc-git/tasks/main.yml +++ b/roles/etc-git/tasks/main.yml @@ -79,25 +79,35 @@ - name: cron job for /etc/.git status is installed lineinfile: path: /etc/daily.local - line: "{{ item }}" + line: + '/usr/local/bin/git --git-dir=/etc/.git --work-tree=/etc status --short' owner: root mode: "0644" create: true when: etc_git_monitor_status tags: - etc-git - with_items: - - 'next_part "Checking /etc git status:"' - - '/usr/local/bin/git --git-dir=/etc/.git --work-tree=/etc status --short' + +- name: cron job for /etc/.git status is installed - next_part + lineinfile: + path: /etc/daily.local + line: 'next_part "Checking /etc git status:"' + insertbefore: + '/usr/local/bin/git --git-dir=/etc/.git --work-tree=/etc status --short' + when: etc_git_monitor_status + tags: + - etc-git - name: cron job for /etc/.git status is removed lineinfile: path: /etc/daily.local - line: - '/usr/local/bin/git --git-dir=/etc/.git --work-tree=/etc status --short' + line: "{{ item }}" owner: root mode: "0644" state: absent + with_items: + - 'next_part "Checking /etc git status:"' + - '/usr/local/bin/git --git-dir=/etc/.git --work-tree=/etc status --short' when: not etc_git_monitor_status tags: - etc-git diff --git a/roles/nagios-nrpe/tasks/main.yml b/roles/nagios-nrpe/tasks/main.yml index 2b4abd0..72215d3 100644 --- a/roles/nagios-nrpe/tasks/main.yml +++ b/roles/nagios-nrpe/tasks/main.yml @@ -32,23 +32,34 @@ - name: Nagios plugins are installed copy: - src: plugins_bsd/ - dest: /usr/local/libexec/nagios/plugins/ + src: plugins_bsd/{{ item.name }} + dest: /usr/local/libexec/nagios/plugins/{{ item.name }} owner: root group: wheel mode: "0755" + force: "{{ item.force }}" + with_items: + - {name: 'check_carp_if', force: true} + - {name: 'check_connections_state.sh', force: false} + - {name: 'check_ipsecctl.sh', force: false} + - {name: 'check_openbgpd', force: true} + - {name: 'check_openvpn', force: false} + - {name: 'check_openvpn.pl', force: true} + - {name: 'check_ospfd_simple', force: true} + - {name: 'check_packetfilter', force: true} notify: restart nrpe - name: Nagios plugins are installed - template template: - src: plugins_bsd/{{ item }}.j2 - dest: /usr/local/libexec/nagios/plugins/{{ item }} + src: plugins_bsd/{{ item.name }}.j2 + dest: /usr/local/libexec/nagios/plugins/{{ item.name }} owner: root group: wheel mode: "0755" + force: "{{ item.force }}" with_items: - - 'check_pf_states' - - 'check_free_mem.sh' + - {name: 'check_pf_states', force: false} + - {name: 'check_free_mem.sh', force: true} notify: restart nrpe - name: Starting and enabling nrpe