Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mkayontour committed Aug 20, 2021
2 parents 873ef9c + 7f22e03 commit 58ee8e1
Show file tree
Hide file tree
Showing 24 changed files with 46 additions and 28 deletions.
4 changes: 3 additions & 1 deletion plugins/action/icinga2_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def run(self, tmp=None, task_vars=None):
obj = self._execute_module(module_name='icinga2_'+object_type.lower(), module_args=args, task_vars=task_vars, tmp=tmp)

if 'failed' in obj:
raise AnsibleError('%s' % obj['msg'])
raise AnsibleError('Call to module failed: %s' % obj['msg'])
elif 'skipped' in obj and obj['skipped']:
raise AnsibleError('Call to module was skipped: %s' % obj['msg'])

#
# file path handling for assemble
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/icinga2_apilistener.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/icinga2_apiuser.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand All @@ -26,4 +27,3 @@ def main():

if __name__ == '__main__':
main()

4 changes: 2 additions & 2 deletions plugins/modules/icinga2_checkcommand.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down Expand Up @@ -33,4 +34,3 @@ def main():

if __name__ == '__main__':
main()

1 change: 1 addition & 0 deletions plugins/modules/icinga2_checkercomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/icinga2_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand All @@ -26,4 +27,3 @@ def main():

if __name__ == '__main__':
main()

4 changes: 2 additions & 2 deletions plugins/modules/icinga2_filelogger.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand All @@ -25,4 +26,3 @@ def main():

if __name__ == '__main__':
main()

4 changes: 2 additions & 2 deletions plugins/modules/icinga2_graphitewriter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand All @@ -30,4 +31,3 @@ def main():

if __name__ == '__main__':
main()

4 changes: 2 additions & 2 deletions plugins/modules/icinga2_host.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down Expand Up @@ -56,4 +57,3 @@ def main():

if __name__ == '__main__':
main()

1 change: 1 addition & 0 deletions plugins/modules/icinga2_hostgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/icinga2_icingaapplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/icinga2_idomysqlconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/icinga2_idopgsqlconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/icinga2_influxdbwriter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down Expand Up @@ -39,4 +40,3 @@ def main():

if __name__ == '__main__':
main()

4 changes: 2 additions & 2 deletions plugins/modules/icinga2_notificationcomponent.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand All @@ -24,4 +25,3 @@ def main():

if __name__ == '__main__':
main()

4 changes: 2 additions & 2 deletions plugins/modules/icinga2_service.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down Expand Up @@ -68,4 +69,3 @@ def main():

if __name__ == '__main__':
main()

1 change: 1 addition & 0 deletions plugins/modules/icinga2_servicegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/icinga2_sysloglogger.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand All @@ -25,4 +26,3 @@ def main():

if __name__ == '__main__':
main()

1 change: 1 addition & 0 deletions plugins/modules/icinga2_timeperiod.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/icinga2_zone.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/python


from ansible.module_utils.basic import AnsibleModule

def main():
module = AnsibleModule(
supports_check_mode=True,
argument_spec = dict(
state = dict(default='present', choices=['present', 'absent']),
name = dict(required=True),
Expand All @@ -21,10 +22,9 @@ def main():
order = args.pop('order')
state = args.pop('state')
file = args.pop('file')
del args['_global']
del args['_global']

module.exit_json(changed=False, args=args, name=name, order=str(order), state=state, file=file)

if __name__ == '__main__':
main()

1 change: 1 addition & 0 deletions roles/icinga2/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
shell: >
find {{ icinga2_fragments_path }} -type d -empty
register: _empty_result
check_mode: false
changed_when: _empty_result.stdout_lines |length > 0

- name: remove empty config dirs
Expand Down
5 changes: 3 additions & 2 deletions roles/icinga2/tasks/features/idomysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
shell: >
{{ mysqlcmd }}
-Ns -e "select version from icinga_dbversion"
ignore_errors: True
changed_when: False
failed_when: false
changed_when: false
check_mode: false
register: db_schema

- name: MySQL import IDO schema
Expand Down
5 changes: 3 additions & 2 deletions roles/icinga2/tasks/features/idopgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
shell: >
{{ psqlcmd }}
-w -c "select version from icinga_dbversion"
ignore_errors: True
changed_when: False
failed_when: false
changed_when: false
check_mode: false
register: db_schema

- name: PostgreSQL import IDO schema
Expand Down
5 changes: 5 additions & 0 deletions roles/icinga2/tasks/install_on_RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
yum:
name: icinga2
state: present
- name: Yum - install package icinga2-selinux
yum:
name: icinga2-selinux
state: present
when: ansible_selinux is defined and ansible_selinux.status == "enabled"

0 comments on commit 58ee8e1

Please sign in to comment.