diff options
author | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:23:43 -0500 |
---|---|---|
committer | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:52:13 -0500 |
commit | 0261e875679f1bf63c8d689da7fc7e014597885d (patch) | |
tree | 3f19cd74a0c1070944f75437f30b098d6ef2ffcb /roles/nagios_client/tasks | |
download | selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.tar.gz selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.zip |
initial commit
Diffstat (limited to 'roles/nagios_client/tasks')
-rw-r--r-- | roles/nagios_client/tasks/main.yml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/roles/nagios_client/tasks/main.yml b/roles/nagios_client/tasks/main.yml new file mode 100644 index 0000000..44424ab --- /dev/null +++ b/roles/nagios_client/tasks/main.yml @@ -0,0 +1,54 @@ +- name: install packages + dnf: + name: '{{ nagios_packages }}' + state: present + +- name: add nagios ssh key + authorized_key: + user: nagios + key: '{{ nagios_ssh_pubkey }}' + state: present + +- name: set selinux context for nagios .ssh directory + sefcontext: + target: '{{ nagios_home }}/\.ssh(/.*)?' + setype: ssh_home_t + state: present + register: nagios_ssh_sefcontext + tags: selinux + +- name: apply selinux context to nagios .ssh directory + command: 'restorecon -R {{ nagios_home }}/.ssh' + when: nagios_ssh_sefcontext.changed + tags: selinux + +- name: set nagios shell + user: + name: nagios + shell: /bin/bash + +- name: set PATH for nagios user + copy: + content: export PATH=/sbin:/bin:/usr/sbin:/usr/bin:{{ nagios_plugin_dir }} + dest: '{{ nagios_home }}/.bashrc' + owner: nagios + group: nagios + mode: 0644 + +- name: copy custom nagios plugins + copy: + src: '{{ item.src }}' + dest: '{{ nagios_plugin_dir }}/{{ item.path }}' + mode: 0555 + loop: "{{ lookup('filetree', nagios_plugin_dir[1:], wantlist=True) }}" + loop_control: + label: '{{ item.path }}' + when: item.state == 'file' + tags: nagios_plugins + +- name: generate sudo rules + template: + src: etc/sudoers.d/nagios.j2 + dest: /etc/sudoers.d/nagios + mode: 0400 + tags: nagios_plugins |