update of tags for each tasks and ease the update of scripts

This commit is contained in:
Jérémy Dubois 2022-06-23 18:35:39 +02:00
parent 7a47d95776
commit 674a4aa836
17 changed files with 82 additions and 15 deletions

View file

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- nagios-nrpe: add a wraper to check_dhcpd to define the number of dhcpd processes that must be running depending on the CARP state - nagios-nrpe: add a wraper to check_dhcpd to define the number of dhcpd processes that must be running depending on the CARP state
- evocheck: renamed install.yml to main.yml and add evocheck cron at the beginning of the daily.local file - evocheck: renamed install.yml to main.yml and add evocheck cron at the beginning of the daily.local file
- pf : reorder some rules, more details on some comments - pf : reorder some rules, more details on some comments
- update of tags for each tasks and ease the update of scripts
### Fixed ### Fixed

View file

@ -28,6 +28,17 @@ Subsequent use (become_method: sudo) :
ansible-playbook evolixisation.yml --ask-vault-pass -CDKi hosts --skip-tags pf -l HOSTNAME ansible-playbook evolixisation.yml --ask-vault-pass -CDKi hosts --skip-tags pf -l HOSTNAME
``` ```
## How to update scripts
Several tags in the format `*utils` are configured to update the different scripts :
* utils : update scripts from base role, utils.yml task
* motd-utils : update script from post-install role, motd.yml task
* evomaintenance-utils : update scripts from base role, evomaintenance.yml task
* evocheck-utils : update scripts from evocheck role, main.yml task
* nagios-nrpe-utils : update scripts and checks from nagios-nrpe role, main.yml task
* etc-git-utils : update scripts from etc-git role, utils.yml task
## Contributions ## Contributions
See the [contribution guidelines](CONTRIBUTING.md) See the [contribution guidelines](CONTRIBUTING.md)

View file

@ -9,6 +9,7 @@
- "{{ evobsd_ssh_group }}" - "{{ evobsd_ssh_group }}"
- "{{ evobsd_sudo_group }}" - "{{ evobsd_sudo_group }}"
tags: tags:
- accounts
- admin - admin
- name: "Create user accounts" - name: "Create user accounts"
@ -18,6 +19,7 @@
with_dict: "{{ evolix_users }}" with_dict: "{{ evolix_users }}"
when: evolix_users != {} when: evolix_users != {}
tags: tags:
- accounts
- admin - admin
- name: "Verify AllowGroups directive" - name: "Verify AllowGroups directive"
@ -27,6 +29,7 @@
check_mode: false check_mode: false
register: grep_allowgroups_ssh register: grep_allowgroups_ssh
tags: tags:
- accounts
- admin - admin
- name: "Verify AllowUsers directive" - name: "Verify AllowUsers directive"
@ -36,6 +39,7 @@
check_mode: false check_mode: false
register: grep_allowusers_ssh register: grep_allowusers_ssh
tags: tags:
- accounts
- admin - admin
- name: "Check that AllowUsers and AllowGroup do not override each other" - name: "Check that AllowUsers and AllowGroup do not override each other"
@ -43,6 +47,7 @@
that: "not (grep_allowusers_ssh.rc == 0 and grep_allowgroups_ssh.rc == 0)" that: "not (grep_allowusers_ssh.rc == 0 and grep_allowgroups_ssh.rc == 0)"
msg: "We can't deal with AllowUsers and AllowGroups at the same time" msg: "We can't deal with AllowUsers and AllowGroups at the same time"
tags: tags:
- accounts
- admin - admin
- name: "If AllowGroups is present then use it" - name: "If AllowGroups is present then use it"
@ -50,6 +55,7 @@
ssh_allowgroups: ssh_allowgroups:
"{{ (grep_allowgroups_ssh.rc == 0) or (grep_allowusers_ssh.rc != 0) }}" "{{ (grep_allowgroups_ssh.rc == 0) or (grep_allowusers_ssh.rc != 0) }}"
tags: tags:
- accounts
- admin - admin
- name: "Add AllowGroups sshd directive with '{{ evobsd_ssh_group }}'" - name: "Add AllowGroups sshd directive with '{{ evobsd_ssh_group }}'"
@ -63,6 +69,7 @@
- ssh_allowgroups - ssh_allowgroups
- grep_allowgroups_ssh.rc == 1 - grep_allowgroups_ssh.rc == 1
tags: tags:
- accounts
- admin - admin
- name: "Append '{{ evobsd_ssh_group }}' to AllowGroups sshd directive" - name: "Append '{{ evobsd_ssh_group }}' to AllowGroups sshd directive"
@ -76,6 +83,7 @@
- ssh_allowgroups - ssh_allowgroups
- grep_allowgroups_ssh.rc == 0 - grep_allowgroups_ssh.rc == 0
tags: tags:
- accounts
- admin - admin
- name: "Security directives for EvoBSD" - name: "Security directives for EvoBSD"
@ -93,6 +101,7 @@
when: when:
- evolix_trusted_ips != [] - evolix_trusted_ips != []
tags: tags:
- accounts
- admin - admin
- name: "Disable root login" - name: "Disable root login"
@ -102,4 +111,5 @@
replace: "PermitRootLogin no" replace: "PermitRootLogin no"
notify: reload sshd notify: reload sshd
tags: tags:
- accounts
- admin - admin

View file

@ -6,6 +6,7 @@
name: "{{ user.name }}" name: "{{ user.name }}"
gid: "{{ user.uid }}" gid: "{{ user.uid }}"
tags: tags:
- accounts
- admin - admin
- name: "User '{{ user.name }}' is present" - name: "User '{{ user.name }}' is present"
@ -19,6 +20,7 @@
shell: /bin/ksh shell: /bin/ksh
append: true append: true
tags: tags:
- accounts
- admin - admin
- name: "Home directory for '{{ user.name }}' is only accesible by owner" - name: "Home directory for '{{ user.name }}' is only accesible by owner"
@ -29,6 +31,7 @@
group: "{{ user.name }}" group: "{{ user.name }}"
state: directory state: directory
tags: tags:
- accounts
- admin - admin
- name: "SSH public keys for '{{ user.name }}' are present" - name: "SSH public keys for '{{ user.name }}' are present"
@ -41,6 +44,7 @@
loop_var: ssk_key loop_var: ssk_key
when: user.ssh_keys is defined when: user.ssh_keys is defined
tags: tags:
- accounts
- admin - admin
- name: "Add {{ user.name }} to {{ evobsd_internal_group }}, {{ evobsd_ssh_group }}, {{ evobsd_sudo_group }} group" - name: "Add {{ user.name }} to {{ evobsd_internal_group }}, {{ evobsd_ssh_group }}, {{ evobsd_sudo_group }} group"
@ -55,4 +59,5 @@
loop_control: loop_control:
loop_var: groups_item loop_var: groups_item
tags: tags:
- accounts
- admin - admin

View file

@ -16,7 +16,6 @@
tags: tags:
- admin - admin
- dotfiles - dotfiles
- vim
- name: "Customize .kshrc environment file" - name: "Customize .kshrc environment file"
copy: copy:
@ -56,7 +55,6 @@
tags: tags:
- admin - admin
- dotfiles - dotfiles
- vim
- name: "Customize .kshrc environment file for new users" - name: "Customize .kshrc environment file for new users"
copy: copy:

View file

@ -21,7 +21,7 @@
- {src: 'evomaintenance.tpl', dest: '/usr/share/scripts/', mode: '0600'} - {src: 'evomaintenance.tpl', dest: '/usr/share/scripts/', mode: '0600'}
tags: tags:
- evomaintenance - evomaintenance
- script-evomaintenance - evomaintenance-utils
- name: "Configure evomaintenance" - name: "Configure evomaintenance"
template: template:

View file

@ -6,7 +6,7 @@
failed_when: false failed_when: false
changed_when: false changed_when: false
tags: tags:
- misc - alerting
- name: "Configure rc.local" - name: "Configure rc.local"
lineinfile: lineinfile:
@ -20,7 +20,7 @@
- not (rclocal_content.stdout - not (rclocal_content.stdout
| regex_search('date \| mail -s (\"|\')boot/reboot of \$\(hostname -s\)')) | regex_search('date \| mail -s (\"|\')boot/reboot of \$\(hostname -s\)'))
tags: tags:
- misc - alerting
- name: "Delete rc.local entry of boot/reboot not precising hostname" - name: "Delete rc.local entry of boot/reboot not precising hostname"
lineinfile: lineinfile:
@ -29,7 +29,7 @@
"^.* mail -s (?!.*of.*).+$" "^.* mail -s (?!.*of.*).+$"
state: absent state: absent
tags: tags:
- misc - alerting
- name: "Set root mail alias" - name: "Set root mail alias"
replace: replace:

View file

@ -14,6 +14,6 @@
- name: "Configure repositories" - name: "Configure repositories"
include: repositories.yml include: repositories.yml
when: etc_git_config_repositories | bool
tags: tags:
- etc-git - etc-git
when: etc_git_config_repositories | bool

View file

@ -9,6 +9,7 @@
force: true force: true
tags: tags:
- etc-git - etc-git
- etc-git-utils
- name: "ansible-commit script is installed" - name: "ansible-commit script is installed"
copy: copy:
@ -18,6 +19,7 @@
force: true force: true
tags: tags:
- etc-git - etc-git
- etc-git-utils
- name: "etc-git-optimize script is installed" - name: "etc-git-optimize script is installed"
copy: copy:
@ -27,6 +29,7 @@
force: true force: true
tags: tags:
- etc-git - etc-git
- etc-git-utils
- name: "etc-git-status script is installed" - name: "etc-git-status script is installed"
copy: copy:
@ -36,6 +39,7 @@
force: true force: true
tags: tags:
- etc-git - etc-git
- etc-git-utils
- name: "Legacy monthly cron job for /etc/.git optimization is absent" - name: "Legacy monthly cron job for /etc/.git optimization is absent"
lineinfile: lineinfile:

View file

@ -5,11 +5,7 @@
changed_when: false changed_when: false
failed_when: false failed_when: false
check_mode: false check_mode: false
tags:
- evocheck-exec
- debug: - debug:
var: evocheck_run.stdout_lines var: evocheck_run.stdout_lines
when: evocheck_run.stdout | length != 0 when: evocheck_run.stdout | length != 0
tags:
- evocheck-exec

View file

@ -18,6 +18,7 @@
force: true force: true
tags: tags:
- evocheck - evocheck
- evocheck-utils
- name: "Copy evocheck.cf" - name: "Copy evocheck.cf"
copy: copy:

View file

@ -6,7 +6,7 @@
state: present state: present
reload: true reload: true
tags: tags:
- net - forwarding
- name: "Enable IPv6 forwarding" - name: "Enable IPv6 forwarding"
sysctl: sysctl:
@ -15,4 +15,4 @@
state: present state: present
reload: true reload: true
tags: tags:
- net - forwarding

View file

@ -26,7 +26,7 @@
- "logsentry.ignore" - "logsentry.ignore"
tags: tags:
- logsentry - logsentry
- config - logsentry-config
- name: "Copy logsentry.violations.ignore configuration" - name: "Copy logsentry.violations.ignore configuration"
copy: copy:
@ -37,7 +37,7 @@
- "logsentry.violations.ignore" - "logsentry.violations.ignore"
tags: tags:
- logsentry - logsentry
- config - logsentry-config
- name: "Hourly cron job for logsentry.sh is installed" - name: "Hourly cron job for logsentry.sh is installed"
cron: cron:

View file

@ -4,6 +4,8 @@
name: name:
- nrpe-- - nrpe--
state: present state: present
tags:
- nagios-nrpe
- name: "Install monitoring packages" - name: "Install monitoring packages"
openbsd_pkg: openbsd_pkg:
@ -11,6 +13,8 @@
- monitoring-plugins - monitoring-plugins
- check_bioctl - check_bioctl
state: present state: present
tags:
- nagios-nrpe
- name: "Create nrpe.d dir" - name: "Create nrpe.d dir"
file: file:
@ -19,11 +23,15 @@
owner: root owner: root
group: wheel group: wheel
mode: "0755" mode: "0755"
tags:
- nagios-nrpe
- name: "Include nrpe.d dir in nrpe.cfg" - name: "Include nrpe.d dir in nrpe.cfg"
lineinfile: lineinfile:
dest: /etc/nrpe.cfg dest: /etc/nrpe.cfg
line: 'include_dir=/etc/nrpe.d' line: 'include_dir=/etc/nrpe.d'
tags:
- nagios-nrpe
- name: "Custom configuration is present" - name: "Custom configuration is present"
template: template:
@ -31,6 +39,8 @@
dest: /etc/nrpe.d/evolix.cfg dest: /etc/nrpe.d/evolix.cfg
mode: "0644" mode: "0644"
notify: restart nrpe notify: restart nrpe
tags:
- nagios-nrpe
- name: "Create nrpe plugins dir" - name: "Create nrpe plugins dir"
file: file:
@ -39,6 +49,8 @@
owner: root owner: root
group: wheel group: wheel
mode: "0755" mode: "0755"
tags:
- nagios-nrpe
- name: "Nagios plugins are installed" - name: "Nagios plugins are installed"
copy: copy:
@ -63,6 +75,9 @@
- {name: 'check_dhcp_pool', force: false} - {name: 'check_dhcp_pool', force: false}
- {name: 'check_dhcpd.sh', force: false} - {name: 'check_dhcpd.sh', force: false}
notify: restart nrpe notify: restart nrpe
tags:
- nagios-nrpe
- nagios-nrpe-utils
- name: "Nagios plugins are installed - template" - name: "Nagios plugins are installed - template"
template: template:
@ -75,9 +90,14 @@
with_items: with_items:
- {name: 'check_free_mem.sh', force: true} - {name: 'check_free_mem.sh', force: true}
notify: restart nrpe notify: restart nrpe
tags:
- nagios-nrpe
- nagios-nrpe-utils
- name: "Starting and enabling nrpe" - name: "Starting and enabling nrpe"
service: service:
name: nrpe name: nrpe
enabled: true enabled: true
state: started state: started
tags:
- nagios-nrpe

View file

@ -6,6 +6,9 @@
owner: root owner: root
group: wheel group: wheel
mode: "0750" mode: "0750"
tags:
- post-install
- generateldif
- name: "Run generateldif" - name: "Run generateldif"
command: '{{ general_scripts_dir }}/generateldif.sh' command: '{{ general_scripts_dir }}/generateldif.sh'
@ -14,10 +17,14 @@
failed_when: false failed_when: false
check_mode: false check_mode: false
tags: tags:
- post-install
- generateldif
- generateldif-exec - generateldif-exec
- debug: - debug:
var: generateldif_run.stdout_lines var: generateldif_run.stdout_lines
verbosity: 1 verbosity: 1
tags: tags:
- post-install
- generateldif
- generateldif-exec - generateldif-exec

View file

@ -3,9 +3,14 @@
copy: copy:
src: motd-carp-state.sh src: motd-carp-state.sh
dest: /usr/share/scripts/motd-carp-state.sh dest: /usr/share/scripts/motd-carp-state.sh
force: true
owner: root owner: root
group: wheel group: wheel
mode: '0755' mode: '0755'
tags:
- post-install
- motd
- motd-utils
- name: "Fetch root crontab content" - name: "Fetch root crontab content"
command: > command: >
@ -14,6 +19,9 @@
register: root_crontab_content register: root_crontab_content
failed_when: false failed_when: false
changed_when: false changed_when: false
tags:
- post-install
- motd
- name: "Cron job for dynamic motd script is installed" - name: "Cron job for dynamic motd script is installed"
cron: cron:
@ -23,3 +31,6 @@
when: when:
- not (root_crontab_content.stdout - not (root_crontab_content.stdout
| regex_search('/bin/sh /usr/share/scripts/motd-carp-state.sh')) | regex_search('/bin/sh /usr/share/scripts/motd-carp-state.sh'))
tags:
- post-install
- motd

View file

@ -3,3 +3,6 @@
command: /usr/sbin/syspatch command: /usr/sbin/syspatch
ignore_errors: true ignore_errors: true
when: ansible_distribution_version is version_compare("6.1",'>=') when: ansible_distribution_version is version_compare("6.1",'>=')
tags:
- post-install
- updates