Allow icinga2 api to master from all, remove root api user
This commit is contained in:
parent
fe0d4be242
commit
e6d3a6e6d7
3 changed files with 20 additions and 15 deletions
|
@ -98,19 +98,12 @@
|
|||
group: root
|
||||
mode: 0700
|
||||
|
||||
- name: Create nagstamon ApiUser
|
||||
- name: Create api-users.conf file
|
||||
become: true
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/icinga2/conf.d/api-users.conf
|
||||
block: |
|
||||
object ApiUser "nagstamon" {
|
||||
password = "{{ nagstamon_pwd }}"
|
||||
permissions = [
|
||||
"objects/query/Host",
|
||||
"objects/query/Service",
|
||||
"actions/reschedule-check",
|
||||
"actions/acknowledge-problem",
|
||||
"actions/schedule-downtime",
|
||||
]
|
||||
}
|
||||
ansible.builtin.template:
|
||||
src: conf.d/api-users.conf.j2
|
||||
dest: /etc/icinga2/conf.d/api-users.conf
|
||||
owner: nagios
|
||||
group: nagios
|
||||
mode: 0644
|
||||
notify: Reload icinga2 service
|
||||
|
|
12
roles/icinga2_master/templates/conf.d/api-users.conf.j2
Normal file
12
roles/icinga2_master/templates/conf.d/api-users.conf.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
object ApiUser "nagstamon" {
|
||||
password = "{{ nagstamon_pwd }}"
|
||||
permissions = [
|
||||
"objects/query/Host",
|
||||
"objects/query/Service",
|
||||
"actions/reschedule-check",
|
||||
"actions/acknowledge-problem",
|
||||
"actions/schedule-downtime",
|
||||
]
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
ip saddr {{ hostvars[icinga2_agent].ipv4_addr }} tcp dport 5665 accept comment "Allow Icinga2 from Agent"
|
||||
tcp dport 5665 accept comment "Allow Icinga2 API"
|
||||
|
|
Loading…
Add table
Reference in a new issue