|
98 | 98 | state: file |
99 | 99 | register: result_icinga2_conf |
100 | 100 |
|
101 | | - - name: validate icinga2.conf results |
| 101 | + - name: validate icinga2.conf results for RedHat based Distributions |
102 | 102 | assert: |
103 | 103 | that: |
104 | 104 | - "result_icinga2_conf.state == 'file'" |
105 | 105 | - "result_icinga2_conf.mode == '0640'" |
106 | 106 | - "result_icinga2_conf.owner == 'icinga'" |
107 | 107 | - "result_icinga2_conf.group == 'icinga'" |
| 108 | + when: ansible_os_family == 'RedHat' |
| 109 | + |
| 110 | + - name: validate icinga2.conf results for Debian based Distributions |
| 111 | + assert: |
| 112 | + that: |
| 113 | + - "result_icinga2_conf.state == 'file'" |
| 114 | + - "result_icinga2_conf.mode == '0640'" |
| 115 | + - "result_icinga2_conf.owner == 'nagios'" |
| 116 | + - "result_icinga2_conf.group == 'nagios'" |
| 117 | + when: ansible_os_family == 'Debian' |
108 | 118 |
|
109 | 119 | - name: verify that constants.conf exists |
110 | 120 | file: |
111 | 121 | path: /etc/icinga2/constants.conf |
112 | 122 | state: file |
113 | 123 | register: result_constants_conf |
114 | 124 |
|
115 | | - - name: validate constants.conf results |
| 125 | + - name: validate constants.conf results for RedHat based Distributions |
116 | 126 | assert: |
117 | 127 | that: |
118 | 128 | - "result_constants_conf.state == 'file'" |
119 | 129 | - "result_constants_conf.mode == '0640'" |
120 | 130 | - "result_constants_conf.owner == 'icinga'" |
121 | 131 | - "result_constants_conf.group == 'icinga'" |
| 132 | + when: ansible_os_family == 'RedHat' |
| 133 | + |
| 134 | + - name: validate constants.conf results for Debian based Distributions |
| 135 | + assert: |
| 136 | + that: |
| 137 | + - "result_constants_conf.state == 'file'" |
| 138 | + - "result_constants_conf.mode == '0640'" |
| 139 | + - "result_constants_conf.owner == 'nagios'" |
| 140 | + - "result_constants_conf.group == 'nagios'" |
| 141 | + when: ansible_os_family == 'Debian' |
122 | 142 |
|
123 | 143 | - name: verify that zones.conf exists |
124 | 144 | file: |
125 | 145 | path: /etc/icinga2/zones.conf |
126 | 146 | state: file |
127 | 147 | register: result_zones_conf |
128 | 148 |
|
129 | | - - name: validate zones.conf results |
| 149 | + - name: validate zones.conf results for RedHat based Distributions |
130 | 150 | assert: |
131 | 151 | that: |
132 | 152 | - "result_zones_conf.state == 'file'" |
133 | 153 | - "result_zones_conf.mode == '0640'" |
134 | 154 | - "result_zones_conf.owner == 'icinga'" |
135 | 155 | - "result_zones_conf.group == 'icinga'" |
| 156 | + when: ansible_os_family == 'RedHat' |
| 157 | + |
| 158 | + - name: validate zones.conf results for Debian based Distributions |
| 159 | + assert: |
| 160 | + that: |
| 161 | + - "result_zones_conf.state == 'file'" |
| 162 | + - "result_zones_conf.mode == '0640'" |
| 163 | + - "result_zones_conf.owner == 'nagios'" |
| 164 | + - "result_zones_conf.group == 'nagios'" |
| 165 | + when: ansible_os_family == 'Debian' |
136 | 166 |
|
137 | 167 | - name: verify that api.conf exists |
138 | 168 | file: |
139 | 169 | path: /etc/icinga2/features-available/api.conf |
140 | 170 | state: file |
141 | 171 | register: result_api_conf |
142 | 172 |
|
143 | | - - name: validate api.conf results |
| 173 | + - name: validate api.conf results for RedHat based Distributions |
144 | 174 | assert: |
145 | 175 | that: |
146 | 176 | - "result_api_conf.state == 'file'" |
147 | 177 | - "result_api_conf.mode == '0640'" |
148 | 178 | - "result_api_conf.owner == 'icinga'" |
149 | 179 | - "result_api_conf.group == 'icinga'" |
150 | | - |
151 | | - - name: verify that icinga2 package is installed |
152 | | - yum: |
153 | | - name: icinga2 |
154 | | - state: present |
155 | 180 | when: ansible_os_family == 'RedHat' |
156 | 181 |
|
157 | | - - name: verify that icinga2 package is installed for Debian based systems |
158 | | - apt: |
| 182 | + - name: validate api.conf results for Debian based Distributions |
| 183 | + assert: |
| 184 | + that: |
| 185 | + - "result_api_conf.state == 'file'" |
| 186 | + - "result_api_conf.mode == '0640'" |
| 187 | + - "result_api_conf.owner == 'nagios'" |
| 188 | + - "result_api_conf.group == 'nagios'" |
| 189 | + when: ansible_os_family == 'Debian' |
| 190 | + |
| 191 | + # - name: verify that icinga2 package is installed |
| 192 | + # yum: |
| 193 | + # name: icinga2 |
| 194 | + # state: present |
| 195 | + # when: ansible_os_family == 'RedHat' |
| 196 | + |
| 197 | + # - name: verify that icinga2 package is installed for Debian based systems |
| 198 | + # apt: |
| 199 | + # name: icinga2 |
| 200 | + # state: present |
| 201 | + # when: ansible_os_family == 'Debian' |
| 202 | + |
| 203 | + - name: verify that icinga2 package is installed |
| 204 | + ansible.builtin.package: |
159 | 205 | name: icinga2 |
160 | 206 | state: present |
161 | | - when: ansible_os_family == 'Debian' |
|
0 commit comments