diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
commit | 38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch) | |
tree | 356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/telekom_mms | |
parent | Adding upstream version 7.7.0+dfsg. (diff) | |
download | ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip |
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/telekom_mms')
164 files changed, 21147 insertions, 0 deletions
diff --git a/ansible_collections/telekom_mms/icinga_director/.gitattributes b/ansible_collections/telekom_mms/icinga_director/.gitattributes new file mode 100644 index 000000000..616f010c2 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/.gitattributes @@ -0,0 +1,6 @@ +*.sh text eol=lf +*.py text eol=lf +*.md text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.txt text eol=lf diff --git a/ansible_collections/telekom_mms/icinga_director/.gitignore b/ansible_collections/telekom_mms/icinga_director/.gitignore new file mode 100644 index 000000000..1aa4f07da --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/.gitignore @@ -0,0 +1,6 @@ +*.tar.gz +test/results +tests/output +.tox +*.pyc +__pycache__/ diff --git a/ansible_collections/telekom_mms/icinga_director/CHANGELOG.md b/ansible_collections/telekom_mms/icinga_director/CHANGELOG.md new file mode 100644 index 000000000..705d6da8f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/CHANGELOG.md @@ -0,0 +1,435 @@ +# Changelog + +## [1.18.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.18.0) (2021-06-14) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.17.0...1.18.0) + +**Merged pull requests:** + +- add period to notification task [\#121](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/121) ([michaelamattes](https://github.com/michaelamattes)) +- add info about documentation [\#120](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/120) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.17.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.17.0) (2021-05-09) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.16.0...1.17.0) + +**Merged pull requests:** + +- add timeperiod\_template and corresponding info module [\#118](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/118) ([rndmh3ro](https://github.com/rndmh3ro)) +- add ansible-2.11 to CI [\#117](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/117) ([rndmh3ro](https://github.com/rndmh3ro)) +- Improve Release Action [\#116](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/116) ([schurzi](https://github.com/schurzi)) + +## [1.16.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.16.0) (2021-03-05) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.15.0...1.16.0) + +**Implemented enhancements:** + +- add Usergroups modules [\#114](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/114) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Closed issues:** + +- Add support to specify user Groups in icinga Notifications [\#111](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/111) +- icinga\_notification | time period [\#109](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/109) + +**Merged pull requests:** + +- Update installation instructions in README.md [\#115](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/115) ([rndmh3ro](https://github.com/rndmh3ro)) +- update notification modules - add option user\_groups [\#112](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/112) ([sgruber94](https://github.com/sgruber94)) + +## [1.15.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.15.0) (2021-02-12) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.14.0...1.15.0) + +**Implemented enhancements:** + +- Add support to change the check\_source / command\_endpoint parameter [\#107](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/107) +- add new options to notification and notification template [\#110](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/110) ([rndmh3ro](https://github.com/rndmh3ro)) +- Add support to change the check\_source / command\_endpoint parameter [\#108](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/108) ([xFuture603](https://github.com/xFuture603)) + +**Fixed bugs:** + +- fix naming for timeperiod test task [\#102](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/102) ([BenjaminBoehm](https://github.com/BenjaminBoehm)) + +**Closed issues:** + +- Support Event Commands [\#100](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/100) + +**Merged pull requests:** + +- add more test executions to trigger all paths [\#106](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/106) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.14.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.14.0) (2021-02-02) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.13.0...1.14.0) + +**Implemented enhancements:** + +- Add event commands to modules that support this feature [\#101](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/101) ([xFuture603](https://github.com/xFuture603)) + +**Merged pull requests:** + +- make it possible to run the script from the root dir and hacking dir [\#105](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/105) ([rndmh3ro](https://github.com/rndmh3ro)) +- Fix zone [\#104](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/104) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.13.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.13.0) (2021-02-01) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.12.0...1.13.0) + +**Implemented enhancements:** + +- add info modules for Director objects [\#98](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/98) ([schurzi](https://github.com/schurzi)) + +**Closed issues:** + +- Append properties [\#96](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/96) +- Provide modules to get information from Icinga Director [\#89](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/89) +- Parameters for check execution at Service Apply level are ignored [\#65](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/65) + +**Merged pull requests:** + +- update readme with new stuff [\#103](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/103) ([rndmh3ro](https://github.com/rndmh3ro)) +- use version for github action, short sha is no longer supported [\#99](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/99) ([schurzi](https://github.com/schurzi)) +- remove unneeded return values for host [\#97](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/97) ([schurzi](https://github.com/schurzi)) + +## [1.12.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.12.0) (2021-01-14) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.11.0...1.12.0) + +**Implemented enhancements:** + +- Add check\_interval parameter to host\_template [\#95](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/95) ([mmslkr](https://github.com/mmslkr)) +- spelling fixes, add notes-section, remove useless sections [\#94](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/94) ([rndmh3ro](https://github.com/rndmh3ro)) +- Add execution params [\#67](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/67) ([AnBenn](https://github.com/AnBenn)) + +## [1.11.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.11.0) (2021-01-12) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.10.1...1.11.0) + +**Fixed bugs:** + +- add back url parameter [\#92](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/92) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Merged pull requests:** + +- remove period from short description [\#93](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/93) ([rndmh3ro](https://github.com/rndmh3ro)) +- remove unneeded return values [\#88](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/88) ([schurzi](https://github.com/schurzi)) + +## [1.10.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.10.1) (2021-01-11) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.10.0...1.10.1) + +**Implemented enhancements:** + +- Update tests [\#86](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/86) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.10.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.10.0) (2021-01-11) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.9.1...1.10.0) + +**Implemented enhancements:** + +- change class to make compatible for python2 [\#84](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/84) ([rndmh3ro](https://github.com/rndmh3ro)) +- add version\_added to modules and module options [\#82](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/82) ([rndmh3ro](https://github.com/rndmh3ro)) +- add docstrings to the functions of the icinga class [\#81](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/81) ([rndmh3ro](https://github.com/rndmh3ro)) +- add name alias for object\_name [\#80](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/80) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Fixed bugs:** + +- Fix url spec [\#85](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/85) ([rndmh3ro](https://github.com/rndmh3ro)) +- fix spelling in module docs [\#83](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/83) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.9.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.9.1) (2021-01-06) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.9.0...1.9.1) + +**Implemented enhancements:** + +- use doc\_fragments for modules documentation [\#78](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/78) ([rndmh3ro](https://github.com/rndmh3ro)) +- added wished files and directories to build\_ignore list [\#77](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/77) ([xFuture603](https://github.com/xFuture603)) + +**Closed issues:** + +- Update module docs with FQCN [\#61](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/61) +- Add meta directory with runtime.yml to collection [\#60](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/60) +- Remove unwanted files from release-tarball [\#58](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/58) + +**Merged pull requests:** + +- fix copyright notice in all files [\#79](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/79) ([rndmh3ro](https://github.com/rndmh3ro)) +- use fqcn in all examples, fix example and test generation [\#76](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/76) ([rndmh3ro](https://github.com/rndmh3ro)) +- Create CONTRIBUTING.md [\#74](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/74) ([rndmh3ro](https://github.com/rndmh3ro)) +- Create runtime.yml [\#72](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/72) ([rndmh3ro](https://github.com/rndmh3ro)) +- Create LICENSE [\#71](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/71) ([rndmh3ro](https://github.com/rndmh3ro)) +- run tests on a schedule [\#70](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/70) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.9.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.9.0) (2020-12-14) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.8.1...1.9.0) + +**Implemented enhancements:** + +- add vars option to icinga\_notification [\#68](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/68) ([rndmh3ro](https://github.com/rndmh3ro)) +- improve support for API parameters [\#66](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/66) ([schurzi](https://github.com/schurzi)) +- Notification templates [\#64](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/64) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Fixed bugs:** + +- fixed "command is missing" while trying to create a command [\#69](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/69) ([xFuture603](https://github.com/xFuture603)) + +**Closed issues:** + +- icinga\_commands with "imports" not working [\#63](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/63) +- Add ability to create notification\_template [\#62](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/62) +- Can't use fields available in API - e.g. host\_template - has\_agent [\#59](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/59) + +## [1.8.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.8.1) (2020-11-05) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.8.0...1.8.1) + +**Implemented enhancements:** + +- Unsupported parameter "Notes" for icinga\_host [\#50](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/50) +- added vsc code snippets [\#57](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/57) ([xFuture603](https://github.com/xFuture603)) + +## [1.8.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.8.0) (2020-10-28) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.7.1...1.8.0) + +**Implemented enhancements:** + +- Add support for notes and notes\_url to all relevant objects [\#56](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/56) ([mmslkr](https://github.com/mmslkr)) + +## [1.7.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.7.1) (2020-10-26) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.7.0...1.7.1) + +**Fixed bugs:** + +- Icinga Object "Service" rerun - failed to recreate if object\_name contains spaces [\#52](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/52) +- allow using whitespaces in object names [\#55](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/55) ([schurzi](https://github.com/schurzi)) + +**Merged pull requests:** + +- improve coverage of new service module [\#51](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/51) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.7.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.7.0) (2020-10-23) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.6.0...1.7.0) + +**Implemented enhancements:** + +- update examples and tests so they can actually be deployed [\#54](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/54) ([rndmh3ro](https://github.com/rndmh3ro)) +- add check\_command arg to service\_apply module [\#53](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/53) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Closed issues:** + +- Add object "Service" for a Host [\#42](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/42) + +## [1.6.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.6.0) (2020-10-22) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.5.0...1.6.0) + +**Implemented enhancements:** + +- add new service module [\#32](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/32) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.5.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.5.0) (2020-10-02) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.4.3...1.5.0) + +**Implemented enhancements:** + +- Add Support for Zones and Endpoints [\#48](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/48) ([arbu](https://github.com/arbu)) +- Create codeql-analysis.yml [\#47](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/47) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Merged pull requests:** + +- add example and test for command without args [\#46](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/46) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.4.3](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.4.3) (2020-10-01) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.4.2...1.4.3) + +**Fixed bugs:** + +- Hosts in state absent don't require import parameter [\#44](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/44) +- when deleting objects, only the object\_name is required [\#45](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/45) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.4.2](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.4.2) (2020-09-25) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.4.1...1.4.2) + +**Implemented enhancements:** + +- add timeout parameter to icinga\_command.yml [\#43](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/43) ([AnBenn](https://github.com/AnBenn)) + +## [1.4.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.4.1) (2020-09-02) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.4.0...1.4.1) + +**Implemented enhancements:** + +- make local testing without ansible-test work [\#41](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/41) ([rndmh3ro](https://github.com/rndmh3ro)) +- Add more Integrationtests [\#39](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/39) ([rndmh3ro](https://github.com/rndmh3ro)) +- Testing update [\#38](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/38) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Fixed bugs:** + +- No IPv6-Address Variable for Hosts [\#36](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/36) + +**Merged pull requests:** + +- add badge to readme [\#40](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/40) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.4.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.4.0) (2020-08-04) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.3.2...1.4.0) + +**Implemented enhancements:** + +- add support for address6 on host object [\#37](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/37) ([schurzi](https://github.com/schurzi)) + +## [1.3.2](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.3.2) (2020-07-15) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.3.1...1.3.2) + +**Implemented enhancements:** + +- make local testing without ansible-test easier [\#33](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/33) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Fixed bugs:** + +- added code in icinga\_command.yml to make it work like the other tasks in our role [\#35](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/35) ([xFuture603](https://github.com/xFuture603)) + +**Merged pull requests:** + +- update examples and bash script for new testing paths [\#31](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/31) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.3.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.3.1) (2020-07-07) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.3.0...1.3.1) + +**Merged pull requests:** + +- replace hyphen in role name with underscore [\#29](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/29) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.3.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.3.0) (2020-07-07) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.2.2...1.3.0) + +**Implemented enhancements:** + +- Ansible icinga role [\#28](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/28) ([michaelamattes](https://github.com/michaelamattes)) + +## [1.2.2](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.2.2) (2020-06-26) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.2.1...1.2.2) + +**Implemented enhancements:** + +- Use ansible-test to run integration tests [\#27](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/27) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Fixed bugs:** + +- zone: defaults to master but i do not want to configure zone at all. [\#25](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/25) + +**Merged pull requests:** + +- do not set zone to master in host and hosttemplate [\#26](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/26) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.2.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.2.1) (2020-06-25) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.2.0...1.2.1) + +**Implemented enhancements:** + +- Integration testing [\#24](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/24) ([rndmh3ro](https://github.com/rndmh3ro)) +- Add proper linting [\#22](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/22) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.2.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.2.0) (2020-06-24) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.1.4...1.2.0) + +**Implemented enhancements:** + +- add gitattributes because of windows line endings [\#21](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/21) ([rndmh3ro](https://github.com/rndmh3ro)) +- add icinga\_host\_template [\#20](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/20) ([michaelamattes](https://github.com/michaelamattes)) +- add troubleshooting section [\#19](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/19) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Fixed bugs:** + +- do not require import and check\_command in host\_template [\#23](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/23) ([rndmh3ro](https://github.com/rndmh3ro)) + +**Closed issues:** + +- Error creating servicegroups [\#13](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/13) + +## [1.1.4](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.1.4) (2020-06-12) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.1.3...1.1.4) + +**Implemented enhancements:** + +- further improve error messages for different errors [\#18](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/18) ([rndmh3ro](https://github.com/rndmh3ro)) +- added required ansible version to readme.md [\#17](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/17) ([xFuture603](https://github.com/xFuture603)) + +## [1.1.3](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.1.3) (2020-06-09) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.1.2...1.1.3) + +**Implemented enhancements:** + +- try to improve error messages [\#16](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/16) ([rndmh3ro](https://github.com/rndmh3ro)) +- add steps to update galaxy.yml in publish action [\#15](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/15) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.1.2](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.1.2) (2020-06-09) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.1.1...1.1.2) + +**Implemented enhancements:** + +- add action to publish to galaxy [\#14](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/14) ([rndmh3ro](https://github.com/rndmh3ro)) +- github-action to automatically create release-drafts [\#12](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/12) ([rndmh3ro](https://github.com/rndmh3ro)) +- remove unused intermediate assignments [\#11](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/11) ([schurzi](https://github.com/schurzi)) + +**Fixed bugs:** + +- assign\_filter variable in icinga\_notification module should be a string [\#9](https://github.com/telekom-mms/ansible-collection-icinga-director/issues/9) + +## [1.1.1](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.1.1) (2020-06-04) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.1.0...1.1.1) + +**Implemented enhancements:** + +- fix issue \#9 - define assign\_filter as string [\#10](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/10) ([FLiPp3r90](https://github.com/FLiPp3r90)) + +## [1.1.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.1.0) (2020-05-25) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/1.0.0...1.1.0) + +**Implemented enhancements:** + +- Add icinga command template [\#8](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/8) ([mmslkr](https://github.com/mmslkr)) + +**Fixed bugs:** + +- fix name of imports [\#7](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/7) ([rndmh3ro](https://github.com/rndmh3ro)) + +## [1.0.0](https://github.com/telekom-mms/ansible-collection-icinga-director/tree/1.0.0) (2020-05-15) + +[Full Changelog](https://github.com/telekom-mms/ansible-collection-icinga-director/compare/2492296965515a9ac885c6a4874acba8a7475895...1.0.0) + +**Merged pull requests:** + +- update urls, lowercase name [\#6](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/6) ([rndmh3ro](https://github.com/rndmh3ro)) +- replace - with \_ [\#5](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/5) ([rndmh3ro](https://github.com/rndmh3ro)) +- alter readme to accommodate for collection [\#4](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/4) ([rndmh3ro](https://github.com/rndmh3ro)) +- Linting fixes [\#3](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/3) ([rndmh3ro](https://github.com/rndmh3ro)) +- Create main.yml [\#2](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/2) ([rndmh3ro](https://github.com/rndmh3ro)) +- Create ansible-lint.yml [\#1](https://github.com/telekom-mms/ansible-collection-icinga-director/pull/1) ([rndmh3ro](https://github.com/rndmh3ro)) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/ansible_collections/telekom_mms/icinga_director/CHANGELOG.rst b/ansible_collections/telekom_mms/icinga_director/CHANGELOG.rst new file mode 100644 index 000000000..338e4ad1a --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/CHANGELOG.rst @@ -0,0 +1,259 @@ +========================================= +telekom_mms.icinga_director Release Notes +========================================= + +.. contents:: Topics + + +v1.35.0 +======= + +Minor Changes +------------- + +- Extended docs and examples for multiple assign_filter conditions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/227) + +v1.34.2 +======= + +v1.34.1 +======= + +Bugfixes +-------- + +- add more http-options for inventory module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/221) + +v1.33.3 +======= + +Minor Changes +------------- + +- add command_endpoint var for service templates (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/222) + +v1.33.2 +======= + +v1.33.1 +======= + +Bugfixes +-------- + +- add icinga_deploy_* to action_group and test it (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/214) + +v1.33.0 +======= + +Minor Changes +------------- + +- Add Icinga Deploy handler and module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/205) + +New Modules +----------- + +- telekom_mms.icinga_director.icinga_deploy - Trigger deployment in Icinga2 +- telekom_mms.icinga_director.icinga_deploy_info - Get deployment information through the director API + +v1.32.3 +======= + +v1.32.2 +======= + +v1.32.1 +======= + +v1.32.0 +======= + +Minor Changes +------------- + +- Add zone to user and notification template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/198) + +v1.31.5 +======= + +v1.31.4 +======= + +v1.31.3 +======= + +v1.31.2 +======= + +v1.31.1 +======= + +v1.31.0 +======= + +Minor Changes +------------- + +- Add flapping support to service template module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/180) +- Add icon support to service template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/179) + +v1.30.2 +======= + +v1.30.1 +======= + +Bugfixes +-------- + +- Add exception handling to diff and exist functions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/176) + +v1.30.0 +======= + +Minor Changes +------------- + +- Add action_group to enable module default groups (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/175) + +v1.29.1 +======= + +v1.29.0 +======= + +Minor Changes +------------- + +- Add icinga_serviceset module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/163) +- Test more ansible versions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/162) + +New Modules +----------- + +- telekom_mms.icinga_director.icinga_serviceset - Manage servicesets in Icinga2 + +v1.28.1 +======= + +Minor Changes +------------- + +- Test more ansible versions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/162) + +v1.28.0 +======= + +Minor Changes +------------- + +- Added missing fields to 'icinga_host' and 'icinga_host_template' (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/158) + +Bugfixes +-------- + +- role: add check_command to icinga_service_apply (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/161) + +v1.27.2 +======= + +v1.27.1 +======= + +v1.27.0 +======= + +Minor Changes +------------- + +- Add possibility to use Compose and keyed groups in inventory-module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/155) + +v1.26.0 +======= + +Minor Changes +------------- + +- add option to append arguments to all modules (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/153) + +v1.25.1 +======= + +v1.25.0 +======= + +Minor Changes +------------- + +- Add Icinga scheduled downtime module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/146) + +Bugfixes +-------- + +- added a fix for the new scheduled_downtime module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/150) + +v1.23.1 +======= + +Minor Changes +------------- + +- add resolve option to inventory-plugin (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/147) + +v1.23.0 +======= + +v1.22.1 +======= + +v1.22.0 +======= + +Minor Changes +------------- + +- Add support for retry_interval and max_check_attempts to host template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/140) + +v1.21.2 +======= + +v1.21.1 +======= + +Bugfixes +-------- + +- Changed place in the creation order of service object in ansible_icinga role (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/135) + +v1.21.0 +======= + +Minor Changes +------------- + +- Add event_command parameter to icinga_service_apply module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/132) +- Add event_command parameter to service apply playbook to enable usage (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/133) + +v1.20.1 +======= + +v1.20.0 +======= + +Minor Changes +------------- + +- Add some more documentation on command template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/128) +- add "vars" variable to icinga_notification in the role (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/129) + +v1.19.0 +======= + +Minor Changes +------------- + +- add notification_template to role (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/125) + +v1.18.1 +======= diff --git a/ansible_collections/telekom_mms/icinga_director/CODEOWNERS b/ansible_collections/telekom_mms/icinga_director/CODEOWNERS new file mode 100644 index 000000000..b4f4c8e46 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/CODEOWNERS @@ -0,0 +1 @@ +* @telekom-mms/ansible-maintainers diff --git a/ansible_collections/telekom_mms/icinga_director/CODE_OF_CONDUCT.md b/ansible_collections/telekom_mms/icinga_director/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..0164155b8 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Community Code of Conduct + +Please see the official [Ansible Community Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html). diff --git a/ansible_collections/telekom_mms/icinga_director/CONTRIBUTING.md b/ansible_collections/telekom_mms/icinga_director/CONTRIBUTING.md new file mode 100644 index 000000000..0e6005b10 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/CONTRIBUTING.md @@ -0,0 +1,54 @@ +## Local Development and testing + +We accept all kinds of contributions, whether they are bug fixes, pull requests or documentation updates! + +If you want to develop new content for this collection or improve what is already here, the easiest way to work on the collection is to clone it into one of the configured [`COLLECTIONS_PATH`](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths), and work on it there. + +For example, if you are working in the `~/dev` directory: + +``` +cd ~/dev +git clone https://github.com/telekom_mms/ansible-collection-icinga-director collections/ansible_collections/telekom_mms/icinga_director +export ANSIBLE_COLLECTIONS_PATH=$(pwd)/collections:$ANSIBLE_COLLECTIONS_PATH +``` + +You can find more information in the [developer guide for collections](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#contributing-to-collections), and in the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html). + + +### Linting with tox + +After making code changes, please run the linters and fix all errors: + +``` +> tox -elinters +``` + +### Updating the tests and examples and runtime + +If you add new features or arguments to the existing modules, please add them to the examples in the module itself. +The integration tests and examples in our documentation are then generated from the module-examples. + +To trigger this generation, you need to run the script `hacking/update_examples_and_tests.sh` from the root of the repository. For this you need to have yq in version v3.2.1 installed (see https://mikefarah.gitbook.io/yq/v/v3.x/). + +Download example: +``` +> sudo wget https://github.com/mikefarah/yq/releases/download/3.4.1/yq_linux_amd64 -O /usr/bin/yq ; sudo chmod 755 /usr/bin/yq +``` + +If you add a new module, be sure to add it to the `action_groups` in the `meta/runtime.yml`-file. + +### Integration tests with docker + +``` +# run icinga in a container and forward port 80 +# username: icingaadmin password: icinga +> docker run --name icinga -d -p 80:80 ghcr.io/telekom-mms/icinga2:master + + +# run ansible-test +> ansible-test integration + +# alternatively run the test playbooks against the container +> ansible-playbook tests/integration/targets/icinga/normalmode.yml +> ansible-playbook tests/integration/targets/icinga/checkmode.yml +``` diff --git a/ansible_collections/telekom_mms/icinga_director/FILES.json b/ansible_collections/telekom_mms/icinga_director/FILES.json new file mode 100644 index 000000000..93627f1e6 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/FILES.json @@ -0,0 +1,1251 @@ +{ + "files": [ + { + "name": ".", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "CHANGELOG.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "99d0821e711ba004b27660d12cfedefdbd22714040ad8758da0de2e7e7a6a18b", + "format": 1 + }, + { + "name": "renovate.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e711d74edde804d88ffcdb2f07cd04fdb50c088ed7e8733bce44f95b56fba8b4", + "format": 1 + }, + { + "name": "LICENSE", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986", + "format": 1 + }, + { + "name": "meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "meta/runtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7987b97d023a17278e43b9e5977acb7a3717efc4997816565f9471c67e48999e", + "format": 1 + }, + { + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "18b4f88a37545cedf51b2d6bde363654cfe832525217d4c38a8a590a692f0088", + "format": 1 + }, + { + "name": "plugins", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/inventory", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/inventory/icinga_director_inventory.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "afce980e40cd5134fb384d20d89db8b6ed94500cf18afe4a25f201c5d1b33403", + "format": 1 + }, + { + "name": "plugins/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/modules/icinga_user_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0bbe9b060799897810c637ffacb1b1a723e46b99db928999f1093503cdbdad2e", + "format": 1 + }, + { + "name": "plugins/modules/icinga_user_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "581b14244d8c3706e6631780b29f46b0fb89f63cd8b1cbdda5c23c0651e9c3cf", + "format": 1 + }, + { + "name": "plugins/modules/icinga_user_template.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "002207d6493402887a2b66a02ef12cbe09fd5402a62f329089d8572fbb669bcd", + "format": 1 + }, + { + "name": "plugins/modules/icinga_zone_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "031dab242c365b3aee630abee6448545a818f38430358d3358aa3db5f58c00b2", + "format": 1 + }, + { + "name": "plugins/modules/icinga_notification_template_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b94210434c4785785f183e94539bad62b7e906abd763cfafc199291324a66a4b", + "format": 1 + }, + { + "name": "plugins/modules/icinga_host_template.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f08ea8599c552ba06ef28fd87223ad3176a5fae73077adc0ff13e1ce5e870d29", + "format": 1 + }, + { + "name": "plugins/modules/icinga_notification_template.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d44a47b755ea484cae1334f8a8904ee38000510e178c1fbc5fa709f0987cd0fd", + "format": 1 + }, + { + "name": "plugins/modules/icinga_service_apply_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b7b1ef59f8f83ae999174fc5023ebfcf4b831b44356a4704b0d5757d31f9413a", + "format": 1 + }, + { + "name": "plugins/modules/icinga_service_template_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "79027979d612de069884ea422b430660c1823ebcbef95872b2ae4b12089f7100", + "format": 1 + }, + { + "name": "plugins/modules/icinga_service_apply.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39fdca31bf58c5a11d1b6670cb39227b5a5b01fa5b289d7949f50e643937722f", + "format": 1 + }, + { + "name": "plugins/modules/icinga_endpoint.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b00feba05e27cbe1e62eaf2d99e9293d8f4fcbeb6342811aade18398ef0b66b5", + "format": 1 + }, + { + "name": "plugins/modules/icinga_endpoint_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d3fd36c406dd69b24afcbc405f384ce9ccbd509d54a5b7e31eb0023357861258", + "format": 1 + }, + { + "name": "plugins/modules/icinga_user_template_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "09015fa2d503a63f75918ebeadf81488d5db96d8003553accd666534e17258ec", + "format": 1 + }, + { + "name": "plugins/modules/icinga_zone.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "68a82be1565b2841b69c20d663ae084c364c517b27531f683024d3f1fb32badd", + "format": 1 + }, + { + "name": "plugins/modules/icinga_user.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "94cca6809793d50a7716466701bcaadd307b1bf36ae2db1839ed679631936e5d", + "format": 1 + }, + { + "name": "plugins/modules/icinga_service_template.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7aaf5a8cbe631079be1e54aaa74048ff39a067b9443af9f3e3e706e7e4958e71", + "format": 1 + }, + { + "name": "plugins/modules/icinga_host.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "932cb54002669c25a603ea998dfa3bc5845e025d5362a0afba8f38733fe5a672", + "format": 1 + }, + { + "name": "plugins/modules/icinga_command_template_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0552ff8bcecd00973bae4ef9f695ba27cdebd2d806e5341fe2b292b87a7792e2", + "format": 1 + }, + { + "name": "plugins/modules/icinga_scheduled_downtime.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f156a76ea47beff013a3de0f879aaf7245274c53c1e01355ec7a7c5fc034782f", + "format": 1 + }, + { + "name": "plugins/modules/icinga_hostgroup.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "25fe567954b8e78857aad9a889ea0da80f24a9005d2316a1e9b2aa2172fa9947", + "format": 1 + }, + { + "name": "plugins/modules/icinga_servicegroup_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3d3f9d954c477286c2b789f604da25d116cf850e9e1e14b0ea04b4d755037cac", + "format": 1 + }, + { + "name": "plugins/modules/icinga_hostgroup_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8e385fdf84e961d6cae5496c59bdc710b8cc8516eaa921d36991b826185423b2", + "format": 1 + }, + { + "name": "plugins/modules/icinga_host_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e7c4e5676e867e448abc760dd5480bd064852aff48ebf3b9c644a4032747c2b4", + "format": 1 + }, + { + "name": "plugins/modules/icinga_notification_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0acf822f2bfbf15b9a197750457f71117973b92d31a301ddb51d3adc49d5cabe", + "format": 1 + }, + { + "name": "plugins/modules/icinga_serviceset.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9cffad89eeb2cc4da1ef1749836025725df751db35fefbcd420e00528f440f71", + "format": 1 + }, + { + "name": "plugins/modules/icinga_command_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f3325e7be18fa95480235d7905bc83756c1d958bcfb3e39de047c6aaf37c0d12", + "format": 1 + }, + { + "name": "plugins/modules/icinga_timeperiod.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "08ff91ecd1d9f0e160bd9b7997cdbc2ebbeb287b77969c8477c30d29d54701b1", + "format": 1 + }, + { + "name": "plugins/modules/icinga_timeperiod_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f87bfe7a7e6f88867ad916658c4d92d63867179f3e793ff4d800ffc753ac66d5", + "format": 1 + }, + { + "name": "plugins/modules/icinga_timeperiod_template_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7ecd6655ff95b53700806d00d09ef2b8d606ad3edcd8c9c5f40b526d6746fbd4", + "format": 1 + }, + { + "name": "plugins/modules/icinga_notification.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2a18c8f247b9350f212481a9df6382ffbc040ed12a0215af5c033ff678239508", + "format": 1 + }, + { + "name": "plugins/modules/icinga_service_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef2c457bf40f38f8973a23ed3946e27387a441d0aeb0e0dba3e9a3099bec1782", + "format": 1 + }, + { + "name": "plugins/modules/icinga_deploy.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6a10712f3ff9598c8ec99609c9ed58c9b6e3afa3b54a9d79149d4cb8451cb2a5", + "format": 1 + }, + { + "name": "plugins/modules/icinga_host_template_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6a916778512b0d6f27f525e2da8280e065a6e06f32fca4325e5164a3f4ff31b6", + "format": 1 + }, + { + "name": "plugins/modules/icinga_command_template.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bc15ac65064e261663ed9fb329fd4b8bcee60c9a02d1b3f7b0e53ec38060e9b1", + "format": 1 + }, + { + "name": "plugins/modules/icinga_service.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "15fa5bed2a8d7c308fb7f95892ad540a764fc57352e2c48f6f57269cadf41333", + "format": 1 + }, + { + "name": "plugins/modules/icinga_user_group_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6e5f229cafab5a3d8024752f58e3192082d956aea409f4f4b9dba0f1b2a6371e", + "format": 1 + }, + { + "name": "plugins/modules/icinga_command.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4850dd60b1c6557995e0f0a30a2e8e05bfaa3873febfb410e663429585a72707", + "format": 1 + }, + { + "name": "plugins/modules/icinga_timeperiod_template.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "aef9cb6ea2ee9f4a8540da6ef4b0185e9fc8d904e7ec63b4a451a9b78e66d092", + "format": 1 + }, + { + "name": "plugins/modules/icinga_deploy_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8c15b71eb94e7323670d54a49bbcf74c0f198af9b4418064a86e9465f9b32d49", + "format": 1 + }, + { + "name": "plugins/modules/icinga_servicegroup.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9208341a441e4b47b70dd3ecbbd7749dbe730b327ad582c8e04acc44a258897e", + "format": 1 + }, + { + "name": "plugins/doc_fragments", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/doc_fragments/common_options.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4636a41b3a10c7786474a983e2e95c4098b9134c4ea779322639c4907380714e", + "format": 1 + }, + { + "name": "plugins/module_utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/icinga.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a17012640e0de964ad91678334aafd451c37e18566e4bb852374c764f0e857d8", + "format": 1 + }, + { + "name": ".gitattributes", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b2deb48e94193846f3933845436e4b28bd819b7e54f87f713c4e45925e84d645", + "format": 1 + }, + { + "name": "roles", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "roles/ansible_icinga", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_notification_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7b40258afda97cc0a454a143530b109c6859a5e4e18a525ab091c1b06075cc2f", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_user.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d1a71b5185068e8547ba6b5d8b984a89bf2b9aef5a5570fb01187e3308c6be20", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_endpoint.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e9bff8ec9f24722912d56fe4aef10678726f43171e75787044ede75fd922f8ed", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_command.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c9dfd5df8e7f84087bfbb6ef993f49bb8db875c8b09496f4c1a62550ee430995", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_service_apply.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3d698077d5a521445d4ffb3b99da0b00ca68f4949c74ce52a12c0d46a3dc035a", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c78b9cb1b47b8fed5166803121a998d0f7cd44bc7840f2a5fb9074dfd7bae6e1", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_timeperiod.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d93eaf04ff4345e95f5442b8d65736936a65db5bb3bdbdd8c88dcaf800133b62", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_host.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cc7a01b09dbc8f55da467561db37a50597fe0f898ca4315b9be142436ed2adb1", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_serviceset.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "58759313dc7e005b8305061f763914db20a39d49b355d73d15cd216cd6891edf", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_notification.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b070e387a00a888c727fded1c0e606071a3b17d330e2b804e09facf25b489b69", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_scheduled_downtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "64be740615cf8dd41d6fe6e6822c7c1d88996e2d2ff932d758790909f735f547", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_command_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8557d9101cbc474d273d1a79b36b9267384e815d516c7dc624c259c8ec3c9137", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_service_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3f13bce269bd96b971880d84b12b11ce7ce80ecf9791be1b886e22a92e3e444", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_servicegroup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c2a6537dcf570c01b0174c1d2a3ec0617f6e2c3b88a3712f729179dbe042332f", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_zone.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9f60ea308d382cbe5bff05ad356e83642a56311bcab056ab43d3f44bc05aa151", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_hostgroup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec9efa8c517983730ba94a9fb8b2887d7403b3f9a8a4472df659c393943a1fd5", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_service.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b1c45c43c43b4a9b5191bd82d7f7af12fea23b278f6824a47fbd92430d0e6b9f", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_host_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "df94796dfa810cdeebaedf6d6aff926a5dd561e92d620054edea2caff09bcc77", + "format": 1 + }, + { + "name": "roles/ansible_icinga/tasks/icinga_user_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e08ecac2e205d4ff1a3824b2053f3c916b124f2c6607b53ae8d7a906e2aa0cde", + "format": 1 + }, + { + "name": "roles/ansible_icinga/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "roles/ansible_icinga/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7203a939bb29fcfd6d88a7ecc1a93c75833c8a82ca683a6414356b87906476ff", + "format": 1 + }, + { + "name": "roles/ansible_icinga/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "roles/ansible_icinga/defaults/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b37f3b9d942e8ef665c760298b361ebf9b1ee62d0ca2f1c8c365b12649cdccef", + "format": 1 + }, + { + "name": "roles/ansible_icinga/README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e67a3d46ad1dcab9da55b04eab44fa386a548027ed182d6e21e5d0d4af324791", + "format": 1 + }, + { + "name": "roles/ansible_icinga/handlers", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "roles/ansible_icinga/handlers/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8867063615e078327203d9d9a3dc7d49a4544144c4ad87b1e734ea08f658aebb", + "format": 1 + }, + { + "name": "CODE_OF_CONDUCT.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "14ec928234a7ed52bf8b458d31e4862335111e477e4dbe7fb543686c24115140", + "format": 1 + }, + { + "name": "CODEOWNERS", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "24cd4a61cdbb71f31779fccb0e8cfca894fb02eade70c5c9cee71ae6828d1b58", + "format": 1 + }, + { + "name": "docs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "docs/icinga_serviceset.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f00d2d38ace64bfc24ce034ecea861de33fd8cf054da1184721d8a799b22638b", + "format": 1 + }, + { + "name": "docs/icinga_host_template_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b5820cd58abb5fcca940d318f2fe600d596becf192754b1766a9d454fd18e86e", + "format": 1 + }, + { + "name": "docs/.gitkeep", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "docs/icinga_notification_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8320c94d95451596987f446d4efed37889e03f5b9e6e53b3181791cdf486f639", + "format": 1 + }, + { + "name": "docs/icinga_deploy_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "04c3b91f6ccc48f19bfc1b2287e97cc15158626e0de4018a359a523858a58847", + "format": 1 + }, + { + "name": "docs/icinga_command_template.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "712ceada4873413eaf6f514e7f11204ab84e41fc3fcbf9ba0a848021e180dfdf", + "format": 1 + }, + { + "name": "docs/icinga_service_apply_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "128ae7c70f7c0a6095bb6eff2fd9e85ac180b0575265c40ef621d611d192f085", + "format": 1 + }, + { + "name": "docs/icinga_hostgroup_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "68f3bb8c3bd161b0979580c51f409e58dc53e8d050f6cf2cf92ca94e414fd93e", + "format": 1 + }, + { + "name": "docs/icinga_user_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "65f2cc11ca8e564df632609b154f39411402811b0fbbd1b1a6220aeedca56451", + "format": 1 + }, + { + "name": "docs/icinga_timeperiod_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "379a46278cad4604604d98b839e88b050db962329a22d9bebc18a3a734c2f2be", + "format": 1 + }, + { + "name": "docs/icinga_service_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2b6272b280c7c9d24908096ae72245c53828cee1497b624192d689c7f2cbf0bb", + "format": 1 + }, + { + "name": "docs/icinga_user.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f1a9a588e8abdf884c79e963d167d3bbeea6e7ee9c9aa2e855347590e7ec65b8", + "format": 1 + }, + { + "name": "docs/icinga_endpoint.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "98d4c03cffe0d6ec6996c9fdb02dcd83b11c6fbf5417f1ad3babe465487d845d", + "format": 1 + }, + { + "name": "docs/icinga_zone.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6698e90afcc560405494f8a5cb15446ad300db0cf43a71b96cc9710fda7c99dd", + "format": 1 + }, + { + "name": "docs/icinga_host_template.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3073ef58234d064561bd1c61afd3bf13c155b031ca154813dfe6cf6cea2e8d60", + "format": 1 + }, + { + "name": "docs/icinga_notification_template_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a8c8bf662b23f55fc34fb9354369ac7b551f70efaa21abe4222c77c058817daf", + "format": 1 + }, + { + "name": "docs/icinga_command_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ff12f037d7dc8f6e6e1ee533dac6e89fcefd1b6ec522e6f1bb3a86b1fac549d7", + "format": 1 + }, + { + "name": "docs/icinga_timeperiod_template_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "38ea5dca279e66726bfedb9eb906decfef42b60b578eae0c71999dcff2b9ced0", + "format": 1 + }, + { + "name": "docs/icinga_notification.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3d71f9465eff1f11bae990b23e80481ff472cd8d3ae76df2f737a3d5bcd1c7c6", + "format": 1 + }, + { + "name": "docs/icinga_servicegroup.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c6b7007f9b9c819d9d8ee38887ed5143da04363c92dff84b6562eb29e3e82c22", + "format": 1 + }, + { + "name": "docs/icinga_deploy.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "083671bd5b35e19249529327624c7d515296b72b4a9441907a6a1bc6986df721", + "format": 1 + }, + { + "name": "docs/icinga_host.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c84d729e51fed6bb199f22b5d6113118ab4647a55d1b9f98fccdc62ff1bbb312", + "format": 1 + }, + { + "name": "docs/icinga_service_template_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "26aea36bc17910c713576b95ef1800704a81caec2a2c1f62611085dda8c5a97d", + "format": 1 + }, + { + "name": "docs/icinga_zone_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b46356a8245852122b172a2c9daff95947f9996d4119b09d0a3125b6b59b910d", + "format": 1 + }, + { + "name": "docs/icinga_user_template_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b5abd1e0ef18abe2e48caa887151484b02e35481a57842ee7873987312eba8ac", + "format": 1 + }, + { + "name": "docs/icinga_service.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3b2fdfcc93e1cdf1c5908719c08884b3d48e33bf958686242e9bec9dcea5d852", + "format": 1 + }, + { + "name": "docs/icinga_user_template.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b6479d03bff152baef69dbe2db979077248f0c61addf85af0ff8fcd95c45a1df", + "format": 1 + }, + { + "name": "docs/icinga_notification_template.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4dba0f64ee219cea065ee72054722622f8011b47958ab0ccaedc3cc3cb3721fa", + "format": 1 + }, + { + "name": "docs/icinga_user_group.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "76a7629d4d25a9939f443bdf6d227957b937ea2bc0bce6adabef07c2efff5ce3", + "format": 1 + }, + { + "name": "docs/icinga_endpoint_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b167b9c55be74dcb839737b6fcac7d4d70f4d4607578c20e4e9d7a57a97ee263", + "format": 1 + }, + { + "name": "docs/icinga_command.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5af5899a3f95baf28cafe4a262bd5f9351abf27bb1c7543a653a70a4c89574db", + "format": 1 + }, + { + "name": "docs/icinga_servicegroup_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9a99593e23cb0c744204e4761aae8557dc2e1db7d15d8cfe03dad62a5cd09897", + "format": 1 + }, + { + "name": "docs/icinga_scheduled_downtime.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eb05d0dcddad62d103030a48fcb2b7be270e44008fc0c7d66c3eeeb965a95c4b", + "format": 1 + }, + { + "name": "docs/icinga_timeperiod.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7ef79a953606d7d5745c045cb83db736251d825e377d89c26079b2d919533b80", + "format": 1 + }, + { + "name": "docs/icinga_host_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c953507375cbf5d1bd4b727bfcaabd7719f4f7a4489186d1569474e206d395d3", + "format": 1 + }, + { + "name": "docs/icinga_command_template_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4fd5b810c23e74381890134eaf332b4c07846fdd8b2c676d0b4604360c0ebf3d", + "format": 1 + }, + { + "name": "docs/icinga_director_inventory.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "83eac988b52587241a2e171a655111e58418375e21fd7d82149e1ec4f5014851", + "format": 1 + }, + { + "name": "docs/icinga_hostgroup.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4dbb0f673fb9bdbc4e200d7789e6c9e31ef767c9d2870dfe411e4b1169f8dfd1", + "format": 1 + }, + { + "name": "docs/icinga_service_template.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f787870a906543323acf30f41c10df902aa3a04848ffdaff89557f297f91e19d", + "format": 1 + }, + { + "name": "docs/icinga_user_group_info.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d79cf09e18862e57adf7976bbdfa19c2b8c9e53e89eebc6b8c35a5faab3932ab", + "format": 1 + }, + { + "name": "docs/icinga_service_apply.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e717a877bf9b007a02e6201a93d787a2764b9fbf179d1d2a4b32f7f58d61662c", + "format": 1 + }, + { + "name": "docs/icinga_timeperiod_template.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2023e5f94e875f8a49c9e6305239c7c9aa2058a25a412fed6ddc8ce140ba423e", + "format": 1 + }, + { + "name": "changelogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/.plugin-cache.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "753a07ef0f7ef12a58c41bd87d838c9c38596847321793a663bb05d81773d27e", + "format": 1 + }, + { + "name": "changelogs/config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "abbab66a433f6362c97d2c632af58683642922225a26a1dd7c6a78923d4ab8d8", + "format": 1 + }, + { + "name": "changelogs/changelog.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2517d86911c97e893f0bfe6ec4710bc64af609102160c4fe65bf2855b94228df", + "format": 1 + }, + { + "name": "CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "37b71114a4a2582519b119d06a58096412169169d949fea7160974085fab8ef5", + "format": 1 + }, + { + "name": ".gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0cb2d7d561d8f1feb38146d6c58c6143c7568b624e2ab6cf03ebc6247e35c991", + "format": 1 + }, + { + "name": "CONTRIBUTING.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "95e2b2b6d356582984f8c830150fcfa1b879807776d24c0111426df8191febca", + "format": 1 + }, + { + "name": "examples", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "examples/icinga_notification_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0eccb90e3fb4c734c32090f21848cda93cbca137bce4d7cdeac1b1df0cb48c9d", + "format": 1 + }, + { + "name": "examples/icinga_user.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "77a4a85033a17a2c01e0b815841b9b6f8a2005b79f79a192d8a7ff79eba88f19", + "format": 1 + }, + { + "name": "examples/icinga_deploy.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b9240a2981ad06b06ab70b1e20f8b723db498cecd8b9da9bc238190dcd5f57b5", + "format": 1 + }, + { + "name": "examples/icinga_service_apply_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "14d8ab6677e86c30b351eecab2a7272c78ac4655986213d3eddcf30859e623d1", + "format": 1 + }, + { + "name": "examples/icinga_endpoint.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "887165606d68526c02c6bfdbf0eb4645920e4daf39209ddaf45d52f2478604ec", + "format": 1 + }, + { + "name": "examples/icinga_user_template_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7b6110eeb12c02697fcece0808700950ac19fe43e3a646ce0f89118dabc81168", + "format": 1 + }, + { + "name": "examples/icinga_command.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a6f06fb01b75049349ddfb1e9013f51ec9c4895e7608a14dddf700248bf5d513", + "format": 1 + }, + { + "name": "examples/icinga_notification_template_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2809ba95d1af3826a7c9a452b9d3653b3c043b2481d2b97aed755122fbcc25fc", + "format": 1 + }, + { + "name": "examples/icinga_service_apply.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a00a08b1b456f6e894cc8663d210c6047d52a597814297b160615c93164962d1", + "format": 1 + }, + { + "name": "examples/icinga_service_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "860bc4e5be4715321447a98f302fcc5d0c5b7477261c518fabb7425f906e864b", + "format": 1 + }, + { + "name": "examples/icinga_host_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "055b91b5c0ee2414d2d98615f347dbd069a78435de77cd9c48920231fa676d99", + "format": 1 + }, + { + "name": "examples/icinga_timeperiod.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "13a953f1e4cfe7d03820a103b39b0ccd7c4e0d197589d5eb07bbdc3d25008a08", + "format": 1 + }, + { + "name": "examples/icinga_deploy_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a1b828fbaa900b4f6feb21890e80c3323f7bd7a77bab812c6b54dce83c3e8cf2", + "format": 1 + }, + { + "name": "examples/icinga_host_template_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "346041e0adb668b0804089e625b752ddec705c89d802509ecd91210c7423995c", + "format": 1 + }, + { + "name": "examples/icinga_host.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b1c68f146fb672336cf61ef7d479eb627289e4486c1b125ba872dfe50d75468f", + "format": 1 + }, + { + "name": "examples/icinga_command_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9b74a538c1280f212d6a6472008a257addb0eda43e0fdc6fb1ef90702d5c140e", + "format": 1 + }, + { + "name": "examples/icinga_serviceset.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9412f532cfc7d4240833335438e2f76719fdd077e0565d105682feec0ed57077", + "format": 1 + }, + { + "name": "examples/icinga_notification_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "98eef22da0092ff5377fcecca15e1fc0558c503679bc2a3294a765decaacb96e", + "format": 1 + }, + { + "name": "examples/icinga_timeperiod_template_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "71d222a97afc01aea18d020ac807c0e95b8e4333b6615c46a74da488cde74184", + "format": 1 + }, + { + "name": "examples/icinga_hostgroup_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "45e4689ee18180e4eb7b40d3068f97d027dd3fea15ef7d4047472c389ab29b6b", + "format": 1 + }, + { + "name": "examples/icinga_notification.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1c17cc131bf59ed8a505ca7b13567cb7a5dd98c57ff81a5a04ca49551ec5792d", + "format": 1 + }, + { + "name": "examples/icinga_zone_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8fb9373a0e75af62078dbd18d9bb5707fdc66bdfbf1876d4a2b72a2502053588", + "format": 1 + }, + { + "name": "examples/icinga_scheduled_downtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d61714d09931ee87e2a1cec25ce88701c7fae920bef878426ac3d07df4cd7f16", + "format": 1 + }, + { + "name": "examples/icinga_servicegroup_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c1e772f1bf28eb3201f3c82caa5ddf9ddf2eb4ff895308be373503d47636b8f4", + "format": 1 + }, + { + "name": "examples/icinga_command_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f2e846ba5a592eebb5ea3a2e7a6523086e99f82d9c5a3b513379c23875147405", + "format": 1 + }, + { + "name": "examples/icinga_timeperiod_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "33f7082668ee409157785602e8cda28d3925d152ae2e0bfdb6148c3599d01c2c", + "format": 1 + }, + { + "name": "examples/icinga_service_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2c5f98d8b8071dd49cb4b5cf6008ca3920fd24aea1402a6acd9833b0df7ac639", + "format": 1 + }, + { + "name": "examples/icinga_servicegroup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "57979256402841f081042e1f9b169696b8f34a75ec551feb8676567e99cdc4dd", + "format": 1 + }, + { + "name": "examples/icinga_command_template_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "254be467a7a0cab236214309451b5d4e0d4b3e69174bacbdf9cabdf90ca3a551", + "format": 1 + }, + { + "name": "examples/icinga_timeperiod_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "251b934cfff8049e8f099e27fab9004770bd5e7e70ab9e05735a58f92dcba8a3", + "format": 1 + }, + { + "name": "examples/icinga_user_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5df4b4776b7c326bc40af161670164798c0f1e2364f10f5600b5bedd6c68a79d", + "format": 1 + }, + { + "name": "examples/icinga_user_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "263c67b5908ad7a0859e72b8a87cd32455b2c4066038d2ff1b5805c299b0942c", + "format": 1 + }, + { + "name": "examples/icinga_endpoint_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "89b884f7dc89266675d13800795addb80f63926cbc2f1123146e0004ececd715", + "format": 1 + }, + { + "name": "examples/icinga_zone.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0c274ef58c679451cad3b66fdeefe6a87b3464e6428aa6d7ffb5c2ca246998f8", + "format": 1 + }, + { + "name": "examples/icinga_user_group_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5bf5d5e38e4495259143cd23953d5c4ab3159d3054f99c999290b3fa26d5c1f1", + "format": 1 + }, + { + "name": "examples/icinga_hostgroup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2f97da7567484286d19828e9400893320a57437db22c48e5c6ac9d42060baa05", + "format": 1 + }, + { + "name": "examples/icinga_service.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bc284c3dd237b02b1669611668c419e3d750427531ecfccb43eca797d57b9310", + "format": 1 + }, + { + "name": "examples/icinga_host_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8f6c22b0e4607397b72ce7547c53e00af67a886defe17803114098454921e24", + "format": 1 + }, + { + "name": "examples/icinga_service_template_info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "91eb87e231b61a57f0e04e7fdc1f1948d718213d509fafdc525ae641aace21ce", + "format": 1 + }, + { + "name": "examples/icinga_user_template.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "911e2d4932b2c32781659ee618b20c8601bc877ac64b60576499816f09b0090e", + "format": 1 + } + ], + "format": 1 +}
\ No newline at end of file diff --git a/ansible_collections/telekom_mms/icinga_director/LICENSE b/ansible_collections/telekom_mms/icinga_director/LICENSE new file mode 100644 index 000000000..f288702d2 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/ansible_collections/telekom_mms/icinga_director/MANIFEST.json b/ansible_collections/telekom_mms/icinga_director/MANIFEST.json new file mode 100644 index 000000000..b357e7be0 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/MANIFEST.json @@ -0,0 +1,34 @@ +{ + "collection_info": { + "namespace": "telekom_mms", + "name": "icinga_director", + "version": "1.35.0", + "authors": [ + "Sebastian Gumprich <sebastian.gumprich@telekom.de>", + "Lars Krahl <lars.krahl@telekom.de>" + ], + "readme": "README.md", + "tags": [ + "icinga", + "monitoring" + ], + "description": "This collection contains Ansible modules to change objects in Icinga 2 using the director API.", + "license": [ + "GPL-2.0-or-later" + ], + "license_file": null, + "dependencies": {}, + "repository": "https://github.com/telekom-mms/ansible-collection-icinga-director", + "documentation": "https://github.com/telekom-mms/ansible-collection-icinga-director", + "homepage": "https://github.com/telekom-mms/ansible-collection-icinga-director", + "issues": "https://github.com/telekom-mms/ansible-collection-icinga-director/issues" + }, + "file_manifest_file": { + "name": "FILES.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7c8dbd31542edb1082a047035d4829f4a60ad8cfdce054933c441ee6ea79d724", + "format": 1 + }, + "format": 1 +}
\ No newline at end of file diff --git a/ansible_collections/telekom_mms/icinga_director/README.md b/ansible_collections/telekom_mms/icinga_director/README.md new file mode 100644 index 000000000..199774aee --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/README.md @@ -0,0 +1,211 @@ +# Icinga Director Collection for Ansible + +[![ci-ansible-test](https://github.com/telekom-mms/ansible-collection-icinga-director/workflows/ansible-test/badge.svg)](https://github.com/telekom-mms/ansible-collection-icinga-director/actions?query=workflow%3Aansible-test) +[![codecov](https://codecov.io/gh/telekom-mms/ansible-collection-icinga-director/branch/master/graph/badge.svg)](https://codecov.io/gh/telekom-mms/ansible-collection-icinga-director) + +This Ansible collection contains: + +1. Ansible [modules](plugins/modules/) to change objects in Icinga 2 using the director API. +Additionally all supported modules have an appropriate `*_info`-module to gather facts about the existing objects in the director. + + * `icinga_command_template` + * `icinga_command` + * `icinga_endpoint` + * `icinga_host_template` + * `icinga_host` + * `icinga_hostgroup` + * `icinga_notification` + * `icinga_notification_template` + * `icinga_service` + * `icinga_service_apply` + * `icinga_service_template` + * `icinga_servicegroup` + * `icinga_serviceset` + * `icinga_timeperiod` + * `icinga_timeperiod_template` + * `icinga_user_group` + * `icinga_user_template` + * `icinga_user` + * `icinga_zone` + +2. A module to deploy changes in the director and a corresponding info-module. + +3. A [role](roles/ansible_icinga/) to change objects in Icinga 2 using the the provided modules. + +4. An [inventory plugin](plugins/inventory) to use hosts and groups defined in Icinga as a dynamic inventory. + +Required Ansible version: 2.9.10 + +## Installation + +If you use Ansible >=3.0.0, this collection is included in Ansible. + +If you use an older version, you can install it with Ansible Galaxy: + +``` +ansible-galaxy collection install telekom_mms.icinga_director +``` + +Alternatively put the collection into a `requirements.yml`-file: + +``` +--- +collections: +- telekom_mms.icinga_director +``` + +## Documentation + +Our modules include documentation. + +You can find the complete documentation for the modules in the [docs-folder](docs) or in the [Ansible documentation](<https://docs.ansible.com/ansible/latest/collections/telekom_mms/icinga_director/index.html#plugins-in-telekom-mms-icinga-director>). + +To display it on the command-line you can use the `ansible-doc` command. + +For example, to see the documentation for the module `icinga_host` run the following command on the cli: + +``` +ansible-doc telekom_mms.icinga_director.icinga_host +``` + +To see the documentation for the inventory plugin, run: + +``` +ansible-doc -t inventory telekom_mms.icinga_director.icinga_director_inventory +``` + +## Examples using the modules + +See the `examples` directory for a complete list of examples. + +``` +- hosts: localhost + collections: + - telekom_mms.icinga_director + tasks: + - name: create a host in icinga + telekom_mms.icinga_director.icinga_host: + state: present + url: "https://example.com" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "{{ ansible_hostname }}" + address: "{{ ansible_default_ipv4.address }}" + display_name: "{{ ansible_hostname }}" + groups: + - "foo" + imports: + - "StandardServer" + vars: + dnscheck: "no" +``` + +``` +- name: Query a service apply rule in icinga + telekom_mms.icinga_director.icinga_service_apply_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "SERVICE_dummy" + register: result +``` + +## Examples using the role + +Please see the [README](roles/ansible_icinga/README.md) of the role. + +## Examples using the inventory plugin + +Create a file that ends with `icinga_director_inventory.yaml`, for example `inventory.icinga_director_inventory.yaml`. + +The content should look like this: + +``` +plugin: telekom_mms.icinga_director.icinga_director_inventory +url: "https://example.com" +url_username: foo +url_password: bar +force_basic_auth: False +``` + +Then you can use the dynamic inventory like this: + +``` +ansible-playbook -i inventory.icinga_director_inventory.yaml path/to/your/playbook.yml +``` + +## Example using module defaults groups + +With ansible-core >= 2.12 it is possible to specify defaults parameters for all modules in this collection using [Module defaults groups](https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html#module-defaults-groups). Use it like this: + +``` +- hosts: localhost + + module_defaults: + group/telekom_mms.icinga_director.icinga: + url: "https://example.com" + url_username: foo + url_password: bar + + tasks: + - name: Create host + telekom_mms.icinga_director.icinga_host: + object_name: myhost + address: 172.0.0.1 + + - name: Create command + telekom_mms.icinga_director.icinga_command: + object_name: my-command + command: my-command.sh +``` + +## Examples for defining multiple assign_filter conditions + +The Icinga Director API expects multiple conditions for the `assign_filter` in a different format than what is rendered to the configuration files. + +Example: An assign condition in the config looking like this: + +``` +assign where host.vars.something == "foo" || host.vars.something_else == "bar" +``` + +would have to look like this when using the module: + +``` +assign_filter: 'host.vars.something="foo"|host.vars.something_else="bar"' +``` + +## Contributing + +See [Contributing](CONTRIBUTING.md). + +## Troubleshooting + +If one of the following errors is thrown, your Icinga Director is probably sitting behind a basic authentication prompt. Use `force_basic_auth: true` in your tasks to fix the problem. +If you are using this collections' ansible role, you have to use `icinga_force_basic_auth: true` to fix this problem. + +``` +fatal: [localhost]: FAILED! => {"changed": false, "msg": "bad return code while creating: -1. Error message: Request failed: <urlopen error Tunnel connection failed: 302 Found>"} +``` + +``` +failed: [localhost] => {"ansible_loop_var": "item", "changed": false, "item": "localhost", "msg": "AbstractDigestAuthHandler does not support the following scheme: 'Negotiate'", "status": -1, "url": "https://icinga-director.example.com/director/host?name=foohost"} +``` + + +## Extras + +* Use our code snippets template supported in Visual Studio Code + +Please see the [README](vsc-snippets/README.md) for more information. + +## License + +GPLv3 + +## Author Information + +* Sebastian Gumprich +* Lars Krahl +* Michaela Mattes +* Martin Schurz diff --git a/ansible_collections/telekom_mms/icinga_director/changelogs/.plugin-cache.yaml b/ansible_collections/telekom_mms/icinga_director/changelogs/.plugin-cache.yaml new file mode 100644 index 000000000..3f683a288 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/changelogs/.plugin-cache.yaml @@ -0,0 +1,220 @@ +objects: {} +plugins: + become: {} + cache: {} + callback: {} + cliconf: {} + connection: {} + httpapi: {} + inventory: + icinga_director_inventory: + description: Returns Ansible inventory from Icinga + name: icinga_director_inventory + version_added: null + lookup: {} + module: + icinga_command: + description: Manage commands in Icinga2 + name: icinga_command + namespace: '' + version_added: 1.0.0 + icinga_command_info: + description: Query commands in Icinga2 + name: icinga_command_info + namespace: '' + version_added: 1.13.0 + icinga_command_template: + description: Manage command templates in Icinga2 + name: icinga_command_template + namespace: '' + version_added: 1.1.0 + icinga_command_template_info: + description: Query command templates in Icinga2 + name: icinga_command_template_info + namespace: '' + version_added: 1.13.0 + icinga_deploy: + description: Trigger deployment in Icinga2 + name: icinga_deploy + namespace: '' + version_added: 1.33.0 + icinga_deploy_info: + description: Get deployment information through the director API + name: icinga_deploy_info + namespace: '' + version_added: 1.33.0 + icinga_endpoint: + description: Manage endpoints in Icinga2 + name: icinga_endpoint + namespace: '' + version_added: 1.5.0 + icinga_endpoint_info: + description: Query endpoints in Icinga2 + name: icinga_endpoint_info + namespace: '' + version_added: 1.13.0 + icinga_host: + description: Manage hosts in Icinga2 + name: icinga_host + namespace: '' + version_added: 1.0.0 + icinga_host_info: + description: Query hosts in Icinga2 + name: icinga_host_info + namespace: '' + version_added: 1.13.0 + icinga_host_template: + description: Manage host templates in Icinga2 + name: icinga_host_template + namespace: '' + version_added: 1.2.0 + icinga_host_template_info: + description: Query host templates in Icinga2 + name: icinga_host_template_info + namespace: '' + version_added: 1.13.0 + icinga_hostgroup: + description: Manage hostgroups in Icinga2 + name: icinga_hostgroup + namespace: '' + version_added: 1.0.0 + icinga_hostgroup_info: + description: Query hostgroups in Icinga2 + name: icinga_hostgroup_info + namespace: '' + version_added: 1.13.0 + icinga_notification: + description: Manage notifications in Icinga2 + name: icinga_notification + namespace: '' + version_added: 1.0.0 + icinga_notification_info: + description: Query notifications in Icinga2 + name: icinga_notification_info + namespace: '' + version_added: 1.13.0 + icinga_notification_template: + description: Manage notification templates in Icinga2 + name: icinga_notification_template + namespace: '' + version_added: 1.9.0 + icinga_notification_template_info: + description: Query notification templates in Icinga2 + name: icinga_notification_template_info + namespace: '' + version_added: 1.13.0 + icinga_scheduled_downtime: + description: Manage downtimes in Icinga2 + name: icinga_scheduled_downtime + namespace: '' + version_added: 1.25.0 + icinga_service: + description: Manage services in Icinga2 + name: icinga_service + namespace: '' + version_added: 1.0.0 + icinga_service_apply: + description: Manage service apply rules in Icinga2 + name: icinga_service_apply + namespace: '' + version_added: 1.0.0 + icinga_service_apply_info: + description: Query service apply rules in Icinga2 + name: icinga_service_apply_info + namespace: '' + version_added: 1.13.0 + icinga_service_info: + description: Query services in Icinga2 + name: icinga_service_info + namespace: '' + version_added: 1.13.0 + icinga_service_template: + description: Manage service templates in Icinga2 + name: icinga_service_template + namespace: '' + version_added: 1.0.0 + icinga_service_template_info: + description: Query service templates in Icinga2 + name: icinga_service_template_info + namespace: '' + version_added: 1.13.0 + icinga_servicegroup: + description: Manage servicegroups in Icinga2 + name: icinga_servicegroup + namespace: '' + version_added: 1.0.0 + icinga_servicegroup_info: + description: Query servicegroups in Icinga2 + name: icinga_servicegroup_info + namespace: '' + version_added: 1.13.0 + icinga_serviceset: + description: Manage servicesets in Icinga2 + name: icinga_serviceset + namespace: '' + version_added: 1.29.0 + icinga_timeperiod: + description: Manage timeperiods in Icinga2 + name: icinga_timeperiod + namespace: '' + version_added: 1.0.0 + icinga_timeperiod_info: + description: Query timeperiods in Icinga2 + name: icinga_timeperiod_info + namespace: '' + version_added: 1.13.0 + icinga_timeperiod_template: + description: Manage timeperiod templates in Icinga2 + name: icinga_timeperiod_template + namespace: '' + version_added: 1.17.0 + icinga_timeperiod_template_info: + description: Query timeperiod templates in Icinga2 + name: icinga_timeperiod_template_info + namespace: '' + version_added: 1.17.0 + icinga_user: + description: Manage users in Icinga2 + name: icinga_user + namespace: '' + version_added: 1.0.0 + icinga_user_group: + description: Manage users groups in Icinga2 + name: icinga_user_group + namespace: '' + version_added: 1.16.0 + icinga_user_group_info: + description: Query user groups in Icinga2 + name: icinga_user_group_info + namespace: '' + version_added: 1.16.0 + icinga_user_info: + description: Query users in Icinga2 + name: icinga_user_info + namespace: '' + version_added: 1.13.0 + icinga_user_template: + description: Manage user templates in Icinga2 + name: icinga_user_template + namespace: '' + version_added: 1.0.0 + icinga_user_template_info: + description: Query user templates in Icinga2 + name: icinga_user_template_info + namespace: '' + version_added: 1.13.0 + icinga_zone: + description: Manage zones in Icinga2 + name: icinga_zone + namespace: '' + version_added: 1.5.0 + icinga_zone_info: + description: Query zones in Icinga2 + name: icinga_zone_info + namespace: '' + version_added: 1.13.0 + netconf: {} + shell: {} + strategy: {} + vars: {} +version: 1.35.0 diff --git a/ansible_collections/telekom_mms/icinga_director/changelogs/changelog.yaml b/ansible_collections/telekom_mms/icinga_director/changelogs/changelog.yaml new file mode 100644 index 000000000..ac4912876 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/changelogs/changelog.yaml @@ -0,0 +1,288 @@ +--- +ancestor: +releases: + 1.18.1: + changes: + trivial: + - add changelogs config so antsibull-changelog can work (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/124) + - use antsichaut and release-drafter for changelog and release generation + (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/122) + release_date: '2021-06-28' + 1.19.0: + changes: + minor_changes: + - add notification_template to role (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/125) + trivial: + - add Inventory plugin (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/127) + - add changelogs config so antsibull-changelog can work (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/124) + - ignore changelogs directory created by a 3rd party tool (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/126) + - use antsichaut and release-drafter for changelog and release generation + (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/122) + release_date: '2021-06-28' + 1.20.0: + changes: + minor_changes: + - Add some more documentation on command template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/128) + - add "vars" variable to icinga_notification in the role (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/129) + release_date: '2021-07-16' + 1.20.1: + changes: + trivial: + - Docs and tests update (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/131) + release_date: '2021-08-05' + 1.21.0: + changes: + minor_changes: + - Add event_command parameter to icinga_service_apply module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/132) + - Add event_command parameter to service apply playbook to enable usage (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/133) + trivial: + - Docs and tests update (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/131) + release_date: '2021-08-16' + 1.21.1: + changes: + bugfixes: + - Changed place in the creation order of service object in ansible_icinga + role (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/135) + release_date: '2021-08-30' + 1.21.2: + changes: + trivial: + - 'Draft: updated retry pull request (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/139)' + - added 3 retries for every playbook (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/138) + release_date: '2021-09-13' + 1.22.0: + changes: + minor_changes: + - Add support for retry_interval and max_check_attempts to host template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/140) + trivial: + - 'Draft: updated retry pull request (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/139)' + - added 3 retries for every playbook (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/138) + release_date: '2021-09-15' + 1.22.1: + changes: + trivial: + - added missing parameter to notification task (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/141) + - ansible-test needs python >= 3.8 at the controller (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/142) + release_date: '2021-09-17' + 1.23.0: + release_date: '2021-09-23' + 1.23.1: + changes: + minor_changes: + - add resolve option to inventory-plugin (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/147) + trivial: + - add documentation files and creation-workflow to repo (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/144) + - improve autogenerated documentation (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/145) + release_date: '2021-10-18' + 1.25.0: + changes: + bugfixes: + - added a fix for the new scheduled_downtime module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/150) + minor_changes: + - Add Icinga scheduled downtime module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/146) + release_date: '2021-11-22' + 1.25.1: + changes: + trivial: + - added duration into our scheduled_downtime task (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/151) + - fix call url function (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/154) + release_date: '2021-11-24' + 1.26.0: + changes: + minor_changes: + - add option to append arguments to all modules (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/153) + trivial: + - added duration into our scheduled_downtime task (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/151) + - fix call url function (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/154) + release_date: '2021-12-03' + 1.27.0: + changes: + minor_changes: + - Add possibility to use Compose and keyed groups in inventory-module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/155) + release_date: '2022-01-03' + 1.27.1: + changes: + trivial: + - fixed missing property 'display_name' in module 'icinga_service' (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/157) + release_date: '2022-02-15' + 1.27.2: + changes: + trivial: + - Fix sanity tests (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/159) + release_date: '2022-03-19' + 1.28.0: + changes: + bugfixes: + - 'role: add check_command to icinga_service_apply (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/161)' + minor_changes: + - Added missing fields to 'icinga_host' and 'icinga_host_template' (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/158) + trivial: + - Fix sanity tests (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/159) + release_date: '2022-03-28' + 1.28.1: + changes: + minor_changes: + - Test more ansible versions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/162) + trivial: + - Configure Renovate (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/164) + - 'chore(deps): update actions/checkout action (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/168)' + - 'chore(deps): update actions/setup-python action to v3 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/169)' + - 'chore(deps): update codecov/codecov-action action to v3 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/170)' + - 'chore(deps): update github-actions-x/commit action to v2.9 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/166)' + release_date: '2022-03-30' + 1.29.0: + changes: + minor_changes: + - Add icinga_serviceset module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/163) + - Test more ansible versions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/162) + trivial: + - Configure Renovate (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/164) + - 'chore(deps): update actions/checkout action (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/168)' + - 'chore(deps): update actions/setup-python action to v3 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/169)' + - 'chore(deps): update codecov/codecov-action action to v3 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/170)' + - 'chore(deps): update github-actions-x/commit action to v2.9 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/166)' + modules: + - description: Manage servicesets in Icinga2 + name: icinga_serviceset + namespace: '' + release_date: '2022-04-20' + 1.29.1: + changes: + trivial: + - 'chore(deps): update actions/checkout action to v3.0.2 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/171)' + - 'chore(deps): update actions/setup-python action to v4 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/173)' + - 'chore(deps): update github/codeql-action action to v2 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/172)' + - fix release workflow (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/174) + release_date: '2022-04-21' + 1.30.0: + changes: + minor_changes: + - Add action_group to enable module default groups (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/175) + trivial: + - 'chore(deps): update actions/checkout action to v3.0.2 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/171)' + - 'chore(deps): update actions/setup-python action to v4 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/173)' + - 'chore(deps): update github/codeql-action action to v2 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/172)' + - fix release workflow (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/174) + release_date: '2022-06-16' + 1.30.1: + changes: + bugfixes: + - Add exception handling to diff and exist functions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/176) + trivial: + - update list of ansible and python versions to be tested (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/178) + - update python-version for ansible-lint in tests (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/177) + release_date: '2022-07-01' + 1.30.2: + release_date: '2022-08-02' + 1.31.0: + changes: + minor_changes: + - Add flapping support to service template module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/180) + - Add icon support to service template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/179) + release_date: '2022-08-22' + 1.31.1: + changes: + trivial: + - Update actions/checkout action to v3.1.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/184) + - Update ansible-community/ansible-test-gh-action action to v1.10.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/182) + - Update ansible-community/ansible-test-gh-action action to v1.11.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/185) + - Update ansible-community/ansible-test-gh-action action to v1.11.1 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/186) + - add ansible 2.14 to test-matrix, use new gh-action for tests (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/181) + - add empty default to argument docs (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/188) + - fix problems found by refurb (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/183) + release_date: '2022-08-22' + 1.31.2: + release_date: '2022-11-04' + 1.31.3: + release_date: '2022-11-04' + 1.31.4: + release_date: '2022-11-04' + 1.31.5: + changes: + trivial: + - Update actions/checkout action to v3.2.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/194) + - Update ansible-community/ansible-test-gh-action action to v1.12.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/192) + - Update ansible-test to latest collection template. (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/195) + - add galaxy.yml to yamllinting (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/191) + release_date: '2022-11-15' + 1.32.0: + changes: + minor_changes: + - Add zone to user and notification template (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/198) + trivial: + - Update actions/checkout action to v3.2.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/194) + - Update ansible-community/ansible-test-gh-action action to v1.12.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/192) + - Update ansible-test to latest collection template. (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/195) + - add galaxy.yml to yamllinting (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/191) + release_date: '2023-01-06' + 1.32.1: + changes: + trivial: + - Consider true/false in docs for boolean (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/203) + - immediately return values and update dict-updates (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/199) + release_date: '2023-01-20' + 1.32.2: + changes: + trivial: + - lowercase some more bools (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/204) + release_date: '2023-03-07' + 1.32.3: + changes: + trivial: + - Update actions/checkout action to v3.5.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/206) + - use codespell to improve spelling (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/207) + release_date: '2023-03-09' + 1.33.0: + changes: + minor_changes: + - Add Icinga Deploy handler and module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/205) + trivial: + - Update actions/checkout action to v3.5.0 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/206) + - use codespell to improve spelling (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/207) + modules: + - description: Trigger deployment in Icinga2 + name: icinga_deploy + namespace: '' + - description: Get deployment information through the director API + name: icinga_deploy_info + namespace: '' + release_date: '2023-05-22' + 1.33.1: + changes: + bugfixes: + - add icinga_deploy_* to action_group and test it (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/214) + trivial: + - Update README (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/211) + release_date: '2023-05-22' + 1.33.2: + changes: + trivial: + - move orga (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/216) + - run CI-tests only once peer week (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/215) + release_date: '2023-06-09' + 1.33.3: + changes: + minor_changes: + - add command_endpoint var for service templates (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/222) + release_date: '2023-07-14' + 1.34.1: + changes: + bugfixes: + - add more http-options for inventory module (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/221) + release_date: '2023-07-28' + 1.34.2: + changes: + trivial: + - Update actions/checkout action to v4 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/224) + - Update test matrix (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/223) + - exclude old python versions with ansible devel (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/225) + release_date: '2023-08-07' + 1.35.0: + changes: + minor_changes: + - Extended docs and examples for multiple assign_filter conditions (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/227) + trivial: + - Update test matrix (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/223) + - exclude old python versions with ansible devel (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/225) + - Update actions/checkout action to v4 (https://github.com/telekom-mms/ansible-collection-icinga-director/pull/224) + release_date: '2023-11-13' diff --git a/ansible_collections/telekom_mms/icinga_director/changelogs/config.yaml b/ansible_collections/telekom_mms/icinga_director/changelogs/config.yaml new file mode 100644 index 000000000..162500b03 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/changelogs/config.yaml @@ -0,0 +1,33 @@ +--- +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sanitize_changelog: true +sections: + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues +title: telekom_mms.icinga_director +trivial_section_name: trivial +use_fqcn: true diff --git a/ansible_collections/telekom_mms/icinga_director/docs/.gitkeep b/ansible_collections/telekom_mms/icinga_director/docs/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/.gitkeep diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_command.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command.rst new file mode 100644 index 000000000..d27b45efb --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command.rst @@ -0,0 +1,277 @@ +.. _icinga_command_module: + + +icinga_command -- Manage commands in Icinga2 +============================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a command to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + command (optional, str, None) + The command Icinga should run. Required when state is \ :literal:`present`\ . + + Absolute paths are accepted as provided, relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed. + + Spaces will lead to separation of command path and standalone arguments. + + Please note that this means that we do not support spaces in plugin names and paths right now. + + + methods_execute (optional, str, PluginCheck) + Plugin Check commands are what you need when running checks against your infrastructure. + + Notification commands will be used when it comes to notify your users. + + Event commands allow you to trigger specific actions when problems occur. + + Some people use them for auto-healing mechanisms, like restarting services or rebooting systems at specific thresholds. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + object_name (True, str, None) + Name of the command. + + + imports (optional, list, []) + Importable templates, add as many as you want. Please note that order matters when importing properties from multiple templates - last one wins. + + + timeout (optional, str, None) + Optional command timeout. Allowed values are seconds or durations postfixed with a specific unit (for example 1m or also 3m 30s). + + + zone (optional, str, None) + Icinga cluster zone. Allows to manually override Directors decisions of where to deploy your config to. + + You should consider not doing so unless you gained deep understanding of how an Icinga Cluster stack works. + + + vars (optional, dict, {}) + Custom properties of the command. + + + arguments (optional, dict, None) + Arguments of the command. + + Each argument can take either a string, a json or a dict + + When using a dict as argument value, the following properties are supported. \ :literal:`skip\_key`\ , \ :literal:`repeat\_key`\ , \ :literal:`required`\ , \ :literal:`order`\ , \ :literal:`description`\ ), \ :literal:`set\_if`\ , \ :literal:`value`\ . + + The \ :literal:`value`\ property can be either a string, a json or a dict. When used as a dict, you can define its \ :literal:`type`\ as \ :literal:`Function`\ and set its \ :literal:`body`\ property as an Icinga DSL piece of config. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + arguments: + '--authpassphrase': + value: $snmpv3_priv_key$ + '--authprotocol': + value: $snmpv3_auth_protocol$ + '--critical': + value: $centreon_critical$ + '--filter': + value: $centreon_filter$ + '--hostname': + value: $snmp_address$ + '--maxrepetitions': + value: $centreon_maxrepetitions$ + '--mode': + value: $centreon_mode$ + '--plugin': + value: $centreon_plugin$ + '--privpassphrase': + value: $snmpv3_auth_key$ + '--privprotocol': + value: $snmpv3_priv_protocol$ + '--snmp-community': + value: $snmp_community$ + '--snmp-timeout': + value: $snmp_timeout$ + '--snmp-username': + value: $snmpv3_user$ + '--snmp-version': + value: $snmp_version$ + '--subsetleef': + value: $centreon_subsetleef$ + '--verbose': + set_if: $centreon_verbose$ + '--warning': + value: $centreon_warning$ + '--dummy-arg': + description: "dummy arg using Icinga DSL code" + value: + type: "Function" + body: 'return macro("$dummy_var$")' + command: "/opt/centreon-plugins/centreon_plugins.pl" + command_type: "PluginCheck" + disabled: false + object_name: centreon-plugins + imports: + - centreon-plugins-template + vars: + centreon_maxrepetitions: 20 + centreon_subsetleef: 20 + centreon_verbose: false + snmp_address: $address$ + snmp_timeout: 60 + snmp_version: '2' + snmpv3_auth_key: authkey + snmpv3_priv_key: privkey + snmpv3_user: user + + - name: Update command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: centreon-plugins + timeout: "1m" + append: true + + - name: Create event command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + command: "/opt/scripts/restart_httpd" + object_name: "restart_httpd" + command_type: "PluginEvent" + arguments: + '-s': + value: $service.state$ + '-t': + value: $service.state_type$ + '-a': + set_if: $service.check_attempt$ + value: $restart_service$ + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_info.rst new file mode 100644 index 000000000..0bde71891 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_info.rst @@ -0,0 +1,155 @@ +.. _icinga_command_info_module: + + +icinga_command_info -- Query commands in Icinga2 +================================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of command objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + external (optional, bool, False) + Also include external objects in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a command in icinga + telekom_mms.icinga_director.icinga_command_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "centreon-plugins" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_template.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_template.rst new file mode 100644 index 000000000..acb44acd8 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_template.rst @@ -0,0 +1,257 @@ +.. _icinga_command_template_module: + + +icinga_command_template -- Manage command templates in Icinga2 +============================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a command template to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + command (optional, str, None) + The command Icinga should run. + + Absolute paths are accepted as provided, relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed. + + Spaces will lead to separation of command path and standalone arguments. + + Please note that this means that we do not support spaces in plugin names and paths right now. + + + methods_execute (optional, str, PluginCheck) + Plugin Check commands are what you need when running checks against your infrastructure. + + Notification commands will be used when it comes to notify your users. + + Event commands allow you to trigger specific actions when problems occur. + + Some people use them for auto-healing mechanisms, like restarting services or rebooting systems at specific thresholds. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + object_name (True, str, None) + Name of the command template. + + + imports (optional, list, []) + Importable templates, add as many as you want. Please note that order matters when importing properties from multiple templates - last one wins. + + + timeout (optional, str, None) + Optional command timeout. Allowed values are seconds or durations postfixed with a specific unit (for example 1m or also 3m 30s). + + + zone (optional, str, None) + Icinga cluster zone. Allows to manually override Directors decisions of where to deploy your config to. + + You should consider not doing so unless you gained deep understanding of how an Icinga Cluster stack works. + + + vars (optional, dict, {}) + Custom properties of the command template. + + + arguments (optional, dict, None) + Arguments of the command template. + + Each argument can take either a string, a json or a dict + + When using a dict as argument value, the following properties are supported. \ :literal:`skip\_key`\ , \ :literal:`repeat\_key`\ , \ :literal:`required`\ , \ :literal:`order`\ , \ :literal:`description`\ ), \ :literal:`set\_if`\ , \ :literal:`value`\ . + + The \ :literal:`value`\ property can be either a string, a json or a dict. When used as a dict, you can define its \ :literal:`type`\ as \ :literal:`Function`\ and set its \ :literal:`body`\ property as an Icinga DSL piece of config. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create command template + telekom_mms.icinga_director.icinga_command_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + arguments: + '--authpassphrase': + value: $snmpv3_priv_key$ + '--authprotocol': + value: $snmpv3_auth_protocol$ + '--critical': + value: $centreon_critical$ + '--filter': + value: $centreon_filter$ + '--hostname': + value: $snmp_address$ + '--maxrepetitions': + value: $centreon_maxrepetitions$ + '--mode': + value: $centreon_mode$ + '--plugin': + value: $centreon_plugin$ + '--privpassphrase': + value: $snmpv3_auth_key$ + '--privprotocol': + value: $snmpv3_priv_protocol$ + '--snmp-community': + value: $snmp_community$ + '--snmp-timeout': + value: $snmp_timeout$ + '--snmp-username': + value: $snmpv3_user$ + '--snmp-version': + value: $snmp_version$ + '--subsetleef': + value: $centreon_subsetleef$ + '--verbose': + set_if: $centreon_verbose$ + '--warning': + value: $centreon_warning$ + '--dummy-arg': + description: "dummy arg using Icinga DSL code" + value: + type: "Function" + body: 'return macro("$dummy_var$")' + command: "/opt/centreon-plugins/centreon_plugins.pl" + command_type: "PluginCheck" + object_name: centreon-plugins-template + disabled: false + vars: + centreon_maxrepetitions: 20 + centreon_subsetleef: 20 + centreon_verbose: false + snmp_address: $address$ + snmp_timeout: 60 + snmp_version: '2' + snmpv3_auth_key: authkey + snmpv3_priv_key: privkey + snmpv3_user: user + + - name: Update command template + telekom_mms.icinga_director.icinga_command_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: centreon-plugins-template + timeout: "2m" + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Lars Krahl (@mmslkr) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_template_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_template_info.rst new file mode 100644 index 000000000..22c41cfd2 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_command_template_info.rst @@ -0,0 +1,151 @@ +.. _icinga_command_template_info_module: + + +icinga_command_template_info -- Query command templates in Icinga2 +================================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of command template objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a command template in icinga + telekom_mms.icinga_director.icinga_command_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "centreon-plugins-template" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_deploy.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_deploy.rst new file mode 100644 index 000000000..b436f54c9 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_deploy.rst @@ -0,0 +1,127 @@ +.. _icinga_deploy_module: + + +icinga_deploy -- Trigger deployment in Icinga2 +============================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Trigger a deployment to Icinga2 through the director API. + + + + + + +Parameters +---------- + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Deploy the icinga config + telekom_mms.icinga_director.icinga_deploy: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + + + +Return Values +------------- + +checksum (always, str, {'checksum': '294bdfb53c4da471e37317beed549a953c939424'}) + Checksum of the configuration that should be rolled out + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Falk Händler (@flkhndlr) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_deploy_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_deploy_info.rst new file mode 100644 index 000000000..1b8dd5b60 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_deploy_info.rst @@ -0,0 +1,147 @@ +.. _icinga_deploy_info_module: + + +icinga_deploy_info -- Get deployment information through the director API +========================================================================= + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get deployment information through the director API. + + + + + + +Parameters +---------- + + configs (optional, list, None) + A list of checksums of configs to query information for + + + activities (optional, list, None) + A list of checksums of activities to query information for + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query the current deployment info in icinga + telekom_mms.icinga_director.icinga_deploy_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + + + +Return Values +------------- + +active_configuration (if active configuration exists, dict, {'active_configuration': {'activity': '3557598829f2a2fc4acc7b565fb54bae24754c67', 'config': '299d9d49e03435c6de562c4b22a26e63990d30a9', 'stage_name': '902cb282-e702-43ce-bb3c-962f850a1694'}}) + Checksums of the active configuration + + Contains current activity checksum, config checksum + + and a checksum for the stage\_name + + +configs (only if requested, list, {'configs': {'b175ca0562434deeb4fb1fc03fd80cd7361b56df': 'deployed', 'b175ca0562434deeb4fb1fc03fd80cd7361b56de': 'active'}}) + Checksum of the requested config and its state + + +activities (only if requested, list, {'activities': {'a4c955364bc7b77efd0323fc87d95307f827e30c': 'deployed', '3557598829f2a2fc4acc7b565fb54bae24754c67': 'active'}}) + checksum of the requested activities and its state + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Falk Händler (@flkhndlr) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_director_inventory.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_director_inventory.rst new file mode 100644 index 000000000..1891edc7b --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_director_inventory.rst @@ -0,0 +1,205 @@ +.. _icinga_director_inventory_module: + + +icinga_director_inventory -- Returns Ansible inventory from Icinga +================================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Returns Ansible inventory from Icinga + + + + + + +Parameters +---------- + + plugin (True, any, None) + Name of the plugin + + + url (True, str, None) + Icinga URL to connect to + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \`url\_password\` for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \`url\_username\` parameter is not specified, the \`url\_password\` parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \`url\_username\` and \`url\_password\` should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \`client\_key\` is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \`client\_cert\` contains both the certificate and key, this option is not required. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \`no\`, it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \`no\`, SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \`gssapi \<https://github.com/pythongssapi/python-gssapi\>\` to be installed. + + Credentials for GSSAPI can be specified with \`url\_username\`/ \`url\_password\` + + or with the GSSAPI env var \`KRB5CCNAME\` that specified a custom Kerberos credential cache. + + NTLM authentication is \`not\` supported even if the GSSAPI mech for NTLM has been installed. + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + strict (optional, bool, False) + If \ :literal:`yes`\ make invalid entries a fatal error, otherwise skip and continue. + + Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. + + + compose (optional, dict, {}) + Create vars from jinja2 expressions. + + + groups (optional, dict, {}) + Add hosts to group based on Jinja2 conditionals. + + + keyed_groups (optional, list, []) + Add hosts to group based on the values of a variable. + + + parent_group (optional, str, None) + parent group for keyed group + + + prefix (optional, str, ) + A keyed group name will start with this prefix + + + separator (optional, str, _) + separator used to build the keyed group name + + + key (optional, str, None) + The key from input dictionary used to generate groups + + + default_value (optional, str, None) + The default value when the host variable's value is an empty string. + + This option is mutually exclusive with \ :literal:`trailing\_separator`\ . + + + trailing_separator (optional, bool, True) + Set this option to \ :emphasis:`False`\ to omit the \ :literal:`separator`\ after the host variable when the value is an empty string. + + This option is mutually exclusive with \ :literal:`default\_value`\ . + + + + use_extra_vars (optional, bool, False) + Merge extra vars into the available variables for composition (highest precedence). + + + leading_separator (optional, boolean, True) + Use in conjunction with keyed\_groups. + + By default, a keyed group that does not have a prefix or a separator provided will have a name that starts with an underscore. + + This is because the default prefix is "" and the default separator is "\_". + + Set this option to False to omit the leading underscore (or other separator) if no prefix is given. + + If the group name is derived from a mapping the separator is still used to concatenate the items. + + To not use a separator in the group name at all, set the separator for the keyed group to an empty string instead. + + + + + + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + plugin: telekom_mms.icinga_director.icinga_director_inventory + url: 'https://example.com' + url_username: foo + url_password: bar + force_basic_auth: False + strict: False + + # use the object_name you defined as hostname + compose: + hostname: object_name + + # create a group based on the operating system defined in a custom variable + keyed_groups: + - prefix: os + key: vars.HostOS + + # create groups based on jinja templates + # here we create a group called "rb" if the host variable "check_period" is "24/7" + groups: + rb: check_period == "24/7" + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_endpoint.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_endpoint.rst new file mode 100644 index 000000000..ea1222176 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_endpoint.rst @@ -0,0 +1,178 @@ +.. _icinga_endpoint_module: + + +icinga_endpoint -- Manage endpoints in Icinga2 +============================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove an endpoint to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Icinga object name for this endpoint. + + This is usually a fully qualified host name but it could basically be any kind of string. + + To make things easier for your users we strongly suggest to use meaningful names for templates. + + For example "generic-endpoint" is ugly, "Standard Linux Server" is easier to understand. + + + host (optional, str, None) + The hostname/IP address of the remote Icinga 2 instance. + + + port (optional, int, None) + The service name/port of the remote Icinga 2 instance. Defaults to 5665. + + + log_duration (optional, str, None) + Duration for keeping replay logs on connection loss. Defaults to 1d (86400 seconds). Attribute is specified in seconds. If log\_duration is set to 0, replaying logs is disabled. You could also specify the value in human readable format like 10m for 10 minutes or 1h for one hour. + + + zone (optional, str, None) + The name of the zone this endpoint is part of. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "fooendpoint" + host: "127.0.0.1" + zone: "foozone" + + - name: Update an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "fooendpoint" + host: "127.0.0.1" + zone: "foozone" + port: 5665 + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Aaron Bulmahn (@arbu) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_endpoint_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_endpoint_info.rst new file mode 100644 index 000000000..515325d9a --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_endpoint_info.rst @@ -0,0 +1,151 @@ +.. _icinga_endpoint_info_module: + + +icinga_endpoint_info -- Query endpoints in Icinga2 +================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of endpoint objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooendpoint" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_host.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host.rst new file mode 100644 index 000000000..9228e7e12 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host.rst @@ -0,0 +1,339 @@ +.. _icinga_host_module: + + +icinga_host -- Manage hosts in Icinga2 +====================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a host to Icinga2 through the director API. + + + + + + +Parameters +---------- + + accept_config (optional, bool, None) + Whether the agent is configured to accept config. + + + address (optional, str, None) + Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with. + + + address6 (optional, str, None) + Host IPv6 address. Usually an IPv6 address, but may be any kind of address your check plugin is able to deal with. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + check_command (optional, str, None) + The name of the check command. + + Though this is not required to be defined in the director, you still have to supply a check\_command in a host or host-template. + + + check_interval (optional, str, None) + Your regular check interval. + + + check_period (optional, str, None) + The name of a time period which determines when this object should be monitored. Not limited by default. + + + check_timeout (optional, str, None) + Check command timeout in seconds. Overrides the CheckCommand's timeout attribute + + + command_endpoint (optional, str, None) + The endpoint where commands are executed on. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + display_name (optional, str, None) + Alternative name for this host. Might be a host alias or and kind of string helping your users to identify this host. + + + enable_active_checks (optional, bool, None) + Whether to actively check this object. + + + enable_event_handler (optional, bool, None) + Whether to enable event handlers this object. + + + enable_flapping (optional, bool, None) + Whether flap detection is enabled on this object. + + + enable_notifications (optional, bool, None) + Whether to send notifications for this object. + + + enable_passive_checks (optional, bool, None) + Whether to accept passive check results for this object. + + + enable_perfdata (optional, bool, None) + Whether to process performance data provided by this object. + + + event_command (optional, str, None) + Event command for host which gets called on every check execution if one of these conditions matches + + The host is in a soft state + + The host state changes into a hard state + + The host state recovers from a soft or hard state to OK/Up + + + flapping_threshold_high (optional, str, None) + Flapping upper bound in percent for a service to be considered flapping + + + flapping_threshold_low (optional, str, None) + Flapping lower bound in percent for a service to be considered not flapping + + + groups (optional, list, []) + Hostgroups that should be directly assigned to this node. Hostgroups can be useful for various reasons. + + You might assign service checks based on assigned hostgroup. They are also often used as an instrument to enforce restricted views in Icinga Web 2. + + Hostgroups can be directly assigned to single hosts or to host templates. + + You might also want to consider assigning hostgroups using apply rules. + + + has_agent (optional, bool, None) + Whether this host has the Icinga 2 Agent installed. + + + icon_image (optional, str, None) + An URL pointing to an icon for this object. + + Try "tux.png" for icons relative to public/img/icons or "cloud" (no extension) for items from the Icinga icon font + + + icon_image_alt (optional, str, None) + Alternative text to be shown in case above icon is missing + + + imports (optional, list, None) + Choose a Host Template. Required when state is \ :literal:`present`\ . + + Required if \ :emphasis:`state`\ is \ :literal:`present`\ . + + + master_should_connect (optional, bool, None) + Whether the parent (master) node should actively try to connect to this agent. + + + max_check_attempts (optional, str, None) + Defines after how many check attempts a new hard state is reached. + + + notes (optional, str, None) + Additional notes for this object. + + + notes_url (optional, str, None) + An URL pointing to additional notes for this object. + + Separate multiple urls like this "'http://url1' 'http://url2'". + + Maximum length is 255 characters. + + + object_name (True, str, None) + Icinga object name for this host. + + This is usually a fully qualified host name but it could basically be any kind of string. + + To make things easier for your users we strongly suggest to use meaningful names for templates. + + For example "generic-host" is ugly, "Standard Linux Server" is easier to understand. + + + retry_interval (optional, str, None) + Retry interval, will be applied after a state change unless the next hard state is reached. + + + state (optional, str, present) + Apply feature state. + + + vars (optional, dict, None) + Custom properties of the host. + + + volatile (optional, bool, None) + Whether this check is volatile. + + + zone (optional, str, None) + Set the zone. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create a host in icinga + telekom_mms.icinga_director.icinga_host: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + accept_config: true + address: "127.0.0.1" + address6: "::1" + check_command: hostalive + check_interval: 90s + check_timeout: 60 + command_endpoint: fooendpoint + disabled: false + display_name: "foohost" + enable_active_checks: true + enable_event_handler: false + enable_flapping: false + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + has_agent: true + icon_image_alt: "alt text" + icon_image: "http://url1" + master_should_connect: true + max_check_attempts: 3 + object_name: "foohost" + retry_interval: "1m" + volatile: false + groups: + - "foohostgroup" + imports: + - "foohosttemplate" + vars: + dnscheck: "no" + + - name: update a host in icinga + telekom_mms.icinga_director.icinga_host: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foohost" + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_info.rst new file mode 100644 index 000000000..65fed0004 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_info.rst @@ -0,0 +1,151 @@ +.. _icinga_host_info_module: + + +icinga_host_info -- Query hosts in Icinga2 +========================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of host objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a host in icinga + telekom_mms.icinga_director.icinga_host_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohost" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_template.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_template.rst new file mode 100644 index 000000000..ed35aef91 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_template.rst @@ -0,0 +1,335 @@ +.. _icinga_host_template_module: + + +icinga_host_template -- Manage host templates in Icinga2 +======================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a host template to Icinga2 through the director API. + + + + + + +Parameters +---------- + + accept_config (optional, bool, None) + Whether the agent is configured to accept config. + + + address (optional, str, None) + Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with. + + + address6 (optional, str, None) + Host IPv6 address. Usually an IPv6 address, but may be any kind of address your check plugin is able to deal with. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + check_command (optional, str, None) + The name of the check command. + + Though this is not required to be defined in the director, you still have to supply a check\_command in a host or host-template. + + + check_interval (optional, str, None) + Your regular check interval. + + + check_period (optional, str, None) + The name of a time period which determines when this object should be monitored. Not limited by default. + + + check_timeout (optional, str, None) + Check command timeout in seconds. Overrides the CheckCommand's timeout attribute + + + command_endpoint (optional, str, None) + The endpoint where commands are executed on. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + display_name (optional, str, None) + Alternative name for this host. Might be a host alias or and kind of string helping your users to identify this host. + + + enable_active_checks (optional, bool, None) + Whether to actively check this object. + + + enable_event_handler (optional, bool, None) + Whether to enable event handlers this object. + + + enable_flapping (optional, bool, None) + Whether flap detection is enabled on this object. + + + enable_notifications (optional, bool, None) + Whether to send notifications for this object. + + + enable_passive_checks (optional, bool, None) + Whether to accept passive check results for this object. + + + enable_perfdata (optional, bool, None) + Whether to process performance data provided by this object. + + + event_command (optional, str, None) + Event command for host which gets called on every check execution if one of these conditions matches + + The host is in a soft state + + The host state changes into a hard state + + The host state recovers from a soft or hard state to OK/Up + + + flapping_threshold_high (optional, str, None) + Flapping upper bound in percent for a service to be considered flapping + + + flapping_threshold_low (optional, str, None) + Flapping lower bound in percent for a service to be considered not flapping + + + groups (optional, list, []) + Hostgroups that should be directly assigned to this node. Hostgroups can be useful for various reasons. + + You might assign service checks based on assigned hostgroup. They are also often used as an instrument to enforce restricted views in Icinga Web 2. + + Hostgroups can be directly assigned to single hosts or to host templates. + + You might also want to consider assigning hostgroups using apply rules. + + + has_agent (optional, bool, None) + Whether this host has the Icinga 2 Agent installed. + + + icon_image (optional, str, None) + An URL pointing to an icon for this object. + + Try "tux.png" for icons relative to public/img/icons or "cloud" (no extension) for items from the Icinga icon font + + + icon_image_alt (optional, str, None) + Alternative text to be shown in case above icon is missing + + + imports (optional, list, None) + Choose a host-template. + + + master_should_connect (optional, bool, None) + Whether the parent (master) node should actively try to connect to this agent. + + + max_check_attempts (optional, str, None) + Defines after how many check attempts a new hard state is reached. + + + notes (optional, str, None) + Additional notes for this object. + + + notes_url (optional, str, None) + An URL pointing to additional notes for this object. + + Separate multiple urls like this "'http://url1' 'http://url2'". + + Maximum length is 255 characters. + + + object_name (True, str, None) + Icinga object name for this host template. + + This is usually a fully qualified host name but it could basically be any kind of string. + + To make things easier for your users we strongly suggest to use meaningful names for templates. + + For example "generic-host" is ugly, "Standard Linux Server" is easier to understand. + + + retry_interval (optional, str, None) + Retry interval, will be applied after a state change unless the next hard state is reached. + + + state (optional, str, present) + Apply feature state. + + + vars (optional, dict, None) + Custom properties of the host. + + + volatile (optional, bool, None) + Whether this check is volatile. + + + zone (optional, str, None) + Set the zone. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create host template + telekom_mms.icinga_director.icinga_host_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + accept_config: true + check_command: hostalive + check_interval: 90s + check_timeout: 60 + command_endpoint: fooendpoint + disabled: false + display_name: foohosttemplate + enable_active_checks: true + enable_event_handler: false + enable_flapping: false + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + has_agent: true + icon_image_alt: "alt text" + icon_image: "http://url1" + master_should_connect: true + max_check_attempts: 3 + object_name: foohosttemplate + retry_interval: "1m" + volatile: false + groups: + - "foohostgroup" + imports: + - '' + vars: + dnscheck: "no" + + - name: Update host template + telekom_mms.icinga_director.icinga_host_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohosttemplate + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Michaela Mattes (@michaelamattes) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_template_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_template_info.rst new file mode 100644 index 000000000..792ae4262 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_host_template_info.rst @@ -0,0 +1,151 @@ +.. _icinga_host_template_info_module: + + +icinga_host_template_info -- Query host templates in Icinga2 +============================================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of host template objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a host template in icinga + telekom_mms.icinga_director.icinga_host_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohosttemplate" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_hostgroup.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_hostgroup.rst new file mode 100644 index 000000000..261cf4ebc --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_hostgroup.rst @@ -0,0 +1,177 @@ +.. _icinga_hostgroup_module: + + +icinga_hostgroup -- Manage hostgroups in Icinga2 +================================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a hostgroup to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Icinga object name for this hostgroup. + + + display_name (optional, str, None) + An alternative display name for this group. + + If you wonder how this could be helpful just leave it blank. + + + assign_filter (optional, str, None) + This allows you to configure an assignment filter. + + Please feel free to combine as many nested operators as you want. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create hostgroup + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + display_name: foohostgroup + + - name: Update hostgroup + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + assign_filter: 'host.name="foohost"' + append: true + + - name: Update hostgroup using multiple contiditions in assign_filter + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + assign_filter: 'host.vars.something="{{ your_var_here }}"|host.vars.something_else="anything"' + append: true + vars: + your_var_here: foo + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_hostgroup_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_hostgroup_info.rst new file mode 100644 index 000000000..9419ceadf --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_hostgroup_info.rst @@ -0,0 +1,151 @@ +.. _icinga_hostgroup_info_module: + + +icinga_hostgroup_info -- Query hostgroups in Icinga2 +==================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of hostgroup objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a hostgroup in icinga + telekom_mms.icinga_director.icinga_hostgroup_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohostgroup" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification.rst new file mode 100644 index 000000000..9e1625a7f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification.rst @@ -0,0 +1,236 @@ +.. _icinga_notification_module: + + +icinga_notification -- Manage notifications in Icinga2 +====================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a notification to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the notification. + + + notification_interval (optional, str, None) + The notification interval (in seconds). This interval is used for active notifications. + + Defaults to 30 minutes. If set to 0, re-notifications are disabled. + + + types (optional, list, None) + The state transition types you want to get notifications for. + + + users (optional, list, None) + Users that should be notified by this notification. + + + states (optional, list, None) + The host or service states you want to get notifications for. + + + apply_to (optional, str, None) + Whether this notification should affect hosts or services. + + Required if \ :emphasis:`state`\ is \ :literal:`present`\ . + + + assign_filter (optional, str, None) + The filter where the notification will take effect. + + + imports (optional, list, None) + Importable templates, add as many as you want. Required when state is \ :literal:`present`\ . + + Please note that order matters when importing properties from multiple templates - last one wins. + + Required if \ :emphasis:`state`\ is \ :literal:`present`\ . + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + vars (optional, dict, {}) + Custom properties of the notification. + + + period (optional, str, None) + The name of a time period which determines when this notification should be triggered. + + + times_begin (optional, int, None) + First notification delay. + + Delay unless the first notification should be sent. + + + times_end (optional, int, None) + Last notification. + + When the last notification should be sent. + + + user_groups (optional, list, None) + User Groups that should be notified by this notification. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create notification + telekom_mms.icinga_director.icinga_notification: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + apply_to: host + assign_filter: 'host.name="foohost"' + imports: + - foonotificationtemplate + notification_interval: '0' + object_name: E-Mail_host + states: + - Up + - Down + types: + - Problem + - Recovery + users: + - rb + user_groups: + - OnCall + disabled: false + time_period: "24/7" + times_begin: 20 + times_end: 120 + + - name: Update notification + telekom_mms.icinga_director.icinga_notification: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: E-Mail_host + vars: + foo: bar + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) / Sebastian Gruber (sgruber94) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_info.rst new file mode 100644 index 000000000..3712bbb2a --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_info.rst @@ -0,0 +1,151 @@ +.. _icinga_notification_info_module: + + +icinga_notification_info -- Query notifications in Icinga2 +========================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of notification objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a notification in icinga + telekom_mms.icinga_director.icinga_notification_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "E-Mail_host" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_template.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_template.rst new file mode 100644 index 000000000..c9616cf46 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_template.rst @@ -0,0 +1,213 @@ +.. _icinga_notification_template_module: + + +icinga_notification_template -- Manage notification templates in Icinga2 +======================================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a notification template to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the notification template. + + + notification_interval (optional, str, None) + The notification interval (in seconds). This interval is used for active notifications. + + Defaults to 30 minutes. If set to 0, re-notifications are disabled. + + + types (optional, list, None) + The state transition types you want to get notifications for. + + + states (optional, list, None) + The host or service states you want to get notifications for. + + + times_begin (optional, int, None) + First notification delay. + + Delay unless the first notification should be sent. + + + times_end (optional, int, None) + Last notification. + + When the last notification should be sent. + + + zone (optional, str, None) + Set the zone. + + + period (optional, str, None) + The name of a time period which determines when this notification should be triggered. + + + command (optional, str, None) + Check command definition + + + users (optional, list, None) + Users that should be notified by this notification + + + user_groups (optional, list, None) + User Groups that should be notified by this notification. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create notification template + telekom_mms.icinga_director.icinga_notification_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foonotificationtemplate + states: + - Up + - Down + types: + - Problem + - Recovery + times_begin: 20 + times_end: 120 + time_period: "24/7" + notification_command: "mail-host-notification" + users: + - "rb" + user_groups: + - "OnCall" + zone: "foozone" + + - name: Update notification template + telekom_mms.icinga_director.icinga_notification_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foonotificationtemplate + notification_interval: '0' + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) / Sebastian Gruber (sgruber94) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_template_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_template_info.rst new file mode 100644 index 000000000..1f1db6ee3 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_notification_template_info.rst @@ -0,0 +1,151 @@ +.. _icinga_notification_template_info_module: + + +icinga_notification_template_info -- Query notification templates in Icinga2 +============================================================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of notification template objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a notification template in icinga + telekom_mms.icinga_director.icinga_notification_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foonotificationtemplate" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_scheduled_downtime.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_scheduled_downtime.rst new file mode 100644 index 000000000..4ee245f7b --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_scheduled_downtime.rst @@ -0,0 +1,226 @@ +.. _icinga_scheduled_downtime_module: + + +icinga_scheduled_downtime -- Manage downtimes in Icinga2 +======================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a downtime to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Icinga object name for this downtime. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + author (optional, str, None) + Name of the downtime author. + + Required if \ :emphasis:`state`\ is \ :literal:`present`\ . + + + comment (optional, str, None) + A descriptive comment for the downtime. + + Required if \ :emphasis:`state`\ is \ :literal:`present`\ . + + + fixed (optional, bool, False) + Whether this downtime is fixed or flexible. If unsure please check the related documentation https://icinga.com/docs/icinga2/latest/doc/08-advanced-topics/#downtimes + + Required if \ :emphasis:`state`\ is \ :literal:`present`\ . + + + with_services (optional, bool, True) + Whether you only downtime the hosts or add some services with it. + + + ranges (optional, dict, {}) + The period which should be downtimed + + + apply_to (optional, str, None) + Whether this dependency should affect hosts or services + + Required if \ :emphasis:`state`\ is \ :literal:`present`\ . + + + assign_filter (optional, str, None) + The filter where the downtime will take effect. + + + duration (optional, str, None) + How long the downtime lasts. Only has an effect for flexible (non-fixed) downtimes. Time in seconds, supported suffixes include ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). To express "90 minutes" you might want to write 1h 30m + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: create icinga_scheduled_downtime + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + disabled: false + object_name: "foodowntime" + state: present + author: testuser + comment: test + fixed: true + with_services: true + apply_to: host + assign_filter: 'host.name="foohost"' + duration: 500 + ranges: + "tuesday": "00:00-24:00" + + - name: create icinga_scheduled_downtime2 + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + disabled: false + object_name: "foodowntime2" + state: present + author: testuser + comment: test + fixed: false + with_services: false + apply_to: host + assign_filter: 'host.name="foohost"' + duration: 500 + ranges: + "tuesday": "00:00-24:00" + + - name: update icinga_scheduled_downtime2 + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foodowntime2" + state: present + duration: 1000 + append: true + apply_to: host + with_services: false + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Daniel Uhlmann (@xFuture603) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_service.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service.rst new file mode 100644 index 000000000..41f09f06d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service.rst @@ -0,0 +1,278 @@ +.. _icinga_service_module: + + +icinga_service -- Manage services in Icinga2 +============================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a service to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the service. + + + check_command (optional, str, None) + Check command definition. + + + check_interval (optional, str, None) + Your regular check interval. + + + check_period (optional, str, None) + The name of a time period which determines when this object should be monitored. Not limited by default. + + + check_timeout (optional, str, None) + Check command timeout in seconds. Overrides the CheckCommand's timeout attribute. + + + display_name (optional, str, None) + Alternative name for this service. + + + enable_active_checks (optional, bool, None) + Whether to actively check this object. + + + enable_event_handler (optional, bool, None) + Whether to enable event handlers this object. + + + enable_notifications (optional, bool, None) + Whether to send notifications for this object. + + + enable_passive_checks (optional, bool, None) + Whether to accept passive check results for this object. + + + enable_perfdata (optional, bool, None) + Whether to process performance data provided by this object. + + + groups (optional, list, []) + Service groups that should be directly assigned to this service. + + Servicegroups can be useful for various reasons. + + They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions. + + Service groups can be directly assigned to single services or to service templates. + + + host (False, str, None) + Choose the host this single service should be assigned to. + + This field will be required when \`service\_set\` is not defined. + + + imports (optional, list, []) + Importable templates, add as many as you want. + + Please note that order matters when importing properties from multiple templates - last one wins. + + + max_check_attempts (optional, str, None) + Defines after how many check attempts a new hard state is reached. + + + notes (optional, str, None) + Additional notes for this object. + + + notes_url (optional, str, None) + An URL pointing to additional notes for this object. + + Separate multiple urls like this "'http://url1' 'http://url2'". + + Maximum length is 255 characters. + + + retry_interval (optional, str, None) + Retry interval, will be applied after a state change unless the next hard state is reached. + + + use_agent (optional, bool, None) + Whether the check command for this service should be executed on the Icinga agent. + + + vars (optional, dict, {}) + Custom properties of the service. + + + volatile (optional, bool, None) + Whether this check is volatile. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + service_set (optional, str, None) + Choose the service set name this single service should be assigned to. + + This field will be required when \`host\` is not defined. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create service + tags: service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service" + display_name: "foo service" + check_command: hostalive + use_agent: false + host: foohost + vars: + procs_argument: consul + procs_critical: '1:' + procs_warning: '1:' + + - name: Update service + tags: service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service" + display_name: "foo service" + host: foohost + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true + + - name: Create serviceset service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service serviceset" + service_set: "foo_serviceset" + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_apply.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_apply.rst new file mode 100644 index 000000000..7846c9510 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_apply.rst @@ -0,0 +1,308 @@ +.. _icinga_service_apply_module: + + +icinga_service_apply -- Manage service apply rules in Icinga2 +============================================================= + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a service apply rule to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name for the Icinga service apply rule. + + + display_name (optional, str, None) + Alternative displayed name of the service apply rule. + + + check_command (optional, str, None) + Check command definition. + + + check_interval (False, str, None) + Your regular check interval. + + + check_period (False, str, None) + The name of a time period which determines when this object should be monitored. Not limited by default. + + + check_timeout (False, str, None) + Check command timeout in seconds. Overrides the CheckCommand's timeout attribute. + + + enable_active_checks (False, bool, None) + Whether to actively check this object. + + + enable_event_handler (False, bool, None) + Whether to enable event handlers this object. + + + enable_notifications (False, bool, None) + Whether to send notifications for this object. + + + enable_passive_checks (False, bool, None) + Whether to accept passive check results for this object. + + + enable_perfdata (False, bool, None) + Whether to process performance data provided by this object. + + + event_command (False, str, None) + Event command for service which gets called on every check execution if one of these conditions matches + + The service is in a soft state + + The service state changes into a hard state + + The service state recovers from a soft or hard state to OK/Up + + + max_check_attempts (False, str, None) + Defines after how many check attempts a new hard state is reached. + + + retry_interval (False, str, None) + Retry interval, will be applied after a state change unless the next hard state is reached. + + + groups (optional, list, []) + Service groups that should be directly assigned to this service. + + Servicegroups can be useful for various reasons. + + They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions. + + Service groups can be directly assigned to single services or to service templates. + + + apply_for (optional, str, None) + Evaluates the apply for rule for all objects with the custom attribute specified. + + For example selecting "host.vars.custom\_attr" will generate "for (config in host.vars.array\_var)" where "config" will be accessible through "$config$". + + Note - only custom variables of type "Array" are eligible. + + + assign_filter (optional, str, None) + The filter where the service apply rule will take effect. + + + command_endpoint (optional, str, None) + The host where the service should be executed on. + + + imports (optional, list, None) + Importable templates, add as many as you want. + + Please note that order matters when importing properties from multiple templates - last one wins. + + + vars (optional, dict, {}) + Custom properties of the service apply rule. + + + notes (optional, str, None) + Additional notes for this object. + + + notes_url (optional, str, None) + An URL pointing to additional notes for this object. + + Separate multiple urls like this "'http://url1' 'http://url2'". + + Maximum length is 255 characters. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Add service apply rule to icinga + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + assign_filter: 'host.name="foohost"' + check_command: hostalive + display_name: "dummy process" + check_interval: "10m" + check_period: "24/7" + check_timeout: "1m" + enable_active_checks: true + enable_event_handler: true + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + event_command: restart_httpd + max_check_attempts: "5" + retry_interval: "3m" + imports: + - fooservicetemplate + groups: + - fooservicegroup + vars: + http_address: "$address$" + http_port: "9080" + http_uri: "/ready" + http_string: "Ready" + http_expect: "Yes" + + - name: Add service apply rule with command_endpoint + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + assign_filter: 'host.name="foohost"' + check_command: hostalive + display_name: "dummy process" + check_interval: "10m" + check_period: "24/7" + check_timeout: "1m" + enable_active_checks: true + enable_event_handler: true + enable_notifications: true + enable_passive_checks: false + event_command: restart_httpd + max_check_attempts: "5" + retry_interval: "3m" + command_endpoint: "fooendpoint" + imports: + - fooservicetemplate + groups: + - fooservicegroup + + - name: Update service apply rule with command_endpoint + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + enable_perfdata: true + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_apply_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_apply_info.rst new file mode 100644 index 000000000..3d87fff81 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_apply_info.rst @@ -0,0 +1,151 @@ +.. _icinga_service_apply_info_module: + + +icinga_service_apply_info -- Query service apply rules in Icinga2 +================================================================= + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of service apply rule objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a service apply rule in icinga + telekom_mms.icinga_director.icinga_service_apply_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "SERVICE_dummy" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_info.rst new file mode 100644 index 000000000..cc552097a --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_info.rst @@ -0,0 +1,151 @@ +.. _icinga_service_info_module: + + +icinga_service_info -- Query services in Icinga2 +================================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of service objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a service in icinga + telekom_mms.icinga_director.icinga_service_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foo service" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_template.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_template.rst new file mode 100644 index 000000000..1eabbb8f3 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_template.rst @@ -0,0 +1,295 @@ +.. _icinga_service_template_module: + + +icinga_service_template -- Manage service templates in Icinga2 +============================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a service template to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the service template. + + + check_command (optional, str, None) + Check command definition. + + + check_interval (optional, str, None) + Your regular check interval. + + + check_period (optional, str, None) + The name of a time period which determines when this object should be monitored. Not limited by default. + + + check_timeout (optional, str, None) + Check command timeout in seconds. Overrides the CheckCommand's timeout attribute. + + + enable_active_checks (optional, bool, None) + Whether to actively check this object. + + + enable_event_handler (optional, bool, None) + Whether to enable event handlers this object. + + + enable_flapping (optional, bool, None) + Whether flap detection is enabled on this object. + + + enable_notifications (optional, bool, None) + Whether to send notifications for this object. + + + enable_passive_checks (optional, bool, None) + Whether to accept passive check results for this object. + + + enable_perfdata (optional, bool, None) + Whether to process performance data provided by this object. + + + event_command (optional, str, None) + Event command for service which gets called on every check execution if one of these conditions matches + + The service is in a soft state + + The service state changes into a hard state + + The service state recovers from a soft or hard state to OK/Up + + + flapping_threshold_high (optional, str, None) + Flapping upper bound in percent for a service to be considered flapping + + + flapping_threshold_low (optional, str, None) + Flapping lower bound in percent for a service to be considered not flapping + + + groups (optional, list, []) + Service groups that should be directly assigned to this service. + + Servicegroups can be useful for various reasons. + + They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions. + + Service groups can be directly assigned to single services or to service templates. + + + icon_image (optional, str, None) + An URL pointing to an icon for this object. + + Try "tux.png" for icons relative to public/img/icons or "cloud" (no extension) for items from the Icinga icon font + + + icon_image_alt (optional, str, None) + Alternative text to be shown in case above icon is missing + + + imports (optional, list, []) + Importable templates, add as many as you want. + + Please note that order matters when importing properties from multiple templates - last one wins. + + + max_check_attempts (optional, str, None) + Defines after how many check attempts a new hard state is reached. + + + notes (optional, str, None) + Additional notes for this object. + + + notes_url (optional, str, None) + An URL pointing to additional notes for this object. + + Separate multiple urls like this "'http://url1' 'http://url2'". + + Maximum length is 255 characters. + + + retry_interval (optional, str, None) + Retry interval, will be applied after a state change unless the next hard state is reached. + + + use_agent (optional, bool, None) + Whether the check command for this service should be executed on the Icinga agent. + + + vars (optional, dict, {}) + Custom properties of the service template. + + + volatile (optional, bool, None) + Whether this check is volatile. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create servicetemplate + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + enable_flapping: true + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + icon_image_alt: "alt text" + icon_image: "http://url1" + object_name: fooservicetemplate + use_agent: false + vars: + procs_argument: consul + procs_critical: '1:' + procs_warning: '1:' + + - name: Update servicetemplate + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicetemplate + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true + + - name: Create servicetemplate with event command + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: apache_check_servicetemplate + use_agent: false + event_command: restart_httpd + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_template_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_template_info.rst new file mode 100644 index 000000000..cb873a033 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_service_template_info.rst @@ -0,0 +1,151 @@ +.. _icinga_service_template_info_module: + + +icinga_service_template_info -- Query service templates in Icinga2 +================================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of service template objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a service template in icinga + telekom_mms.icinga_director.icinga_service_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooservicetemplate" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_servicegroup.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_servicegroup.rst new file mode 100644 index 000000000..3573402ab --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_servicegroup.rst @@ -0,0 +1,165 @@ +.. _icinga_servicegroup_module: + + +icinga_servicegroup -- Manage servicegroups in Icinga2 +====================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a servicegroup to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name for the Icinga servicegroup. + + + display_name (optional, str, None) + An alternative display name for this group. + + If you wonder how this could be helpful just leave it blank. + + + assign_filter (optional, str, None) + This allows you to configure an assignment filter. + + Please feel free to combine as many nested operators as you want. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create servicegroup + telekom_mms.icinga_director.icinga_servicegroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicegroup + assign_filter: 'host.name="foo"' + + - name: Update servicegroup + telekom_mms.icinga_director.icinga_servicegroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicegroup + display_name: fooservicegroup + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_servicegroup_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_servicegroup_info.rst new file mode 100644 index 000000000..de4b2149a --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_servicegroup_info.rst @@ -0,0 +1,151 @@ +.. _icinga_servicegroup_info_module: + + +icinga_servicegroup_info -- Query servicegroups in Icinga2 +========================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of servicegroup objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a servicegroup in icinga + telekom_mms.icinga_director.icinga_servicegroup_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooservicegroup" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_serviceset.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_serviceset.rst new file mode 100644 index 000000000..99ed370ee --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_serviceset.rst @@ -0,0 +1,164 @@ +.. _icinga_serviceset_module: + + +icinga_serviceset -- Manage servicesets in Icinga2 +================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a serviceset to Icinga2 through the director API. + + + + + + +Parameters +---------- + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + assign_filter (optional, str, None) + This allows you to configure an assignment filter. + + Please feel free to combine as many nested operators as you want. + + + description (optional, str, None) + A meaningful description explaining your users what to expect when assigning this set of services. + + + object_name (True, str, None) + Icinga object name for this serviceset. + + + state (optional, str, present) + Apply feature state. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create serviceset + telekom_mms.icinga_director.icinga_serviceset: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo_serviceset" + assign_filter: 'host.name="foohost"' + description: "foo description" + + - name: Update serviceset + telekom_mms.icinga_director.icinga_serviceset: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo_serviceset" + assign_filter: 'host.name="foohost2"' + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Heiko Neblung (@HeikoNeblung) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod.rst new file mode 100644 index 000000000..a84052580 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod.rst @@ -0,0 +1,176 @@ +.. _icinga_timeperiod_module: + + +icinga_timeperiod -- Manage timeperiods in Icinga2 +================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a timeperiod to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the time period. + + + display_name (optional, str, None) + Alternative name for this timeperiod. + + + imports (optional, list, []) + Importable templates, add as many as you want. + + Please note that order matters when importing properties from multiple templates - last one wins. + + + ranges (optional, dict, None) + A dict of days and timeperiods. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create timeperiod + telekom_mms.icinga_director.icinga_timeperiod: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: '24/7' + imports: + - "timeperiod_template" + ranges: + monday: "00:00-23:59" + tuesday: "00:00-23:59" + wednesday: "00:00-23:59" + thursday: "00:00-23:59" + friday: "00:00-23:59" + saturday: "00:00-23:59" + sunday: "00:00-23:59" + + - name: Update timeperiod + telekom_mms.icinga_director.icinga_timeperiod: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: '24/7' + display_name: '24/7' + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_info.rst new file mode 100644 index 000000000..289c96976 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_info.rst @@ -0,0 +1,151 @@ +.. _icinga_timeperiod_info_module: + + +icinga_timeperiod_info -- Query timeperiods in Icinga2 +====================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of timeperiod objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a timeperiod in icinga + telekom_mms.icinga_director.icinga_timeperiod_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "24/7" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_template.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_template.rst new file mode 100644 index 000000000..ac61b2a2a --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_template.rst @@ -0,0 +1,202 @@ +.. _icinga_timeperiod_template_module: + + +icinga_timeperiod_template -- Manage timeperiod templates in Icinga2 +==================================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a timeperiod template to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the time period. + + + display_name (optional, str, None) + Alternative name for this timeperiod template. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + imports (optional, list, []) + Importable templates, add as many as you want. + + Please note that order matters when importing properties from multiple templates - last one wins. + + + includes (optional, list, []) + Include other time periods into this. + + + excludes (optional, list, []) + Exclude other time periods from this. + + + prefer_includes (optional, bool, True) + Whether to prefer timeperiods includes or excludes. Default to true. + + + ranges (optional, dict, None) + A dict of days and timeperiods. + + + zone (optional, str, None) + Set the zone. + + + update_method (optional, str, LegacyTimePeriod) + Define the update method. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create timeperiod template + telekom_mms.icinga_director.icinga_timeperiod_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "timeperiod_template" + imports: [] + disabled: false + prefer_includes: false + ranges: + monday: "00:00-23:59" + tuesday: "00:00-23:59" + wednesday: "00:00-23:59" + thursday: "00:00-23:59" + friday: "00:00-23:59" + saturday: "00:00-23:59" + sunday: "00:00-23:59" + update_method: "LegacyTimePeriod" + + - name: Update timeperiod template + telekom_mms.icinga_director.icinga_timeperiod_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "timeperiod_template" + display_name: "timeperiod template" + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_template_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_template_info.rst new file mode 100644 index 000000000..82e85b0b7 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_timeperiod_template_info.rst @@ -0,0 +1,151 @@ +.. _icinga_timeperiod_template_info_module: + + +icinga_timeperiod_template_info -- Query timeperiod templates in Icinga2 +======================================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of timeperiod template objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a timeperiod template in icinga + telekom_mms.icinga_director.icinga_timeperiod_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "timeperiod_template" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_user.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user.rst new file mode 100644 index 000000000..f359bebc1 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user.rst @@ -0,0 +1,193 @@ +.. _icinga_user_module: + + +icinga_user -- Manage users in Icinga2 +====================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a user to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the user. + + + display_name (optional, str, None) + Alternative name for this user. + + In case your object name is a username, this could be the full name of the corresponding person. + + + imports (optional, list, None) + Importable templates, add as many as you want. + + Please note that order matters when importing properties from multiple templates - last one wins. + + + pager (optional, str, None) + The pager address of the user. + + + period (optional, str, None) + The name of a time period which determines when notifications to this User should be triggered. Not set by default. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + email (optional, str, None) + The Email address of the user. + + + groups (optional, list, None) + User groups that should be directly assigned to this user. + + Groups can be useful for various reasons. You might prefer to send notifications to groups instead of single users. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create user + telekom_mms.icinga_director.icinga_user: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "rb" + pager: 'SIP/emergency' + period: '24/7' + email: "foouser@example.com" + imports: + - foousertemplate + groups: + - onCall + + - name: Update user + telekom_mms.icinga_director.icinga_user: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "rb" + display_name: "Rufbereitschaft" + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_group.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_group.rst new file mode 100644 index 000000000..76efc60d1 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_group.rst @@ -0,0 +1,163 @@ +.. _icinga_user_group_module: + + +icinga_user_group -- Manage users groups in Icinga2 +=================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a user group to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the user group. + + + display_name (optional, str, None) + Alternative name for this user group. + + In case your object name is a username, this could be the full name of the corresponding person. + + + disabled (optional, bool, False) + Disabled objects will not be deployed. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create user group + telekom_mms.icinga_director.icinga_user_group: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "onCall" + disabled: false + + - name: Update user group + telekom_mms.icinga_director.icinga_user_group: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "onCall" + display_name: "on call group" + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_group_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_group_info.rst new file mode 100644 index 000000000..c1e9f3c34 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_group_info.rst @@ -0,0 +1,151 @@ +.. _icinga_user_group_info_module: + + +icinga_user_group_info -- Query user groups in Icinga2 +====================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of user group objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a user group in icinga + telekom_mms.icinga_director.icinga_user_group_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "onCall" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Sebastian Gumprich (@rndmh3ro) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_info.rst new file mode 100644 index 000000000..936655a7c --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_info.rst @@ -0,0 +1,151 @@ +.. _icinga_user_info_module: + + +icinga_user_info -- Query users in Icinga2 +========================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of user objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a user in icinga + telekom_mms.icinga_director.icinga_user_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "rb" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_template.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_template.rst new file mode 100644 index 000000000..4c716e0c1 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_template.rst @@ -0,0 +1,173 @@ +.. _icinga_user_template_module: + + +icinga_user_template -- Manage user templates in Icinga2 +======================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a user template to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Name of the user template. + + + imports (optional, list, []) + Importable templates, add as many as you want. + + Please note that order matters when importing properties from multiple templates - last one wins. + + + period (optional, str, None) + The name of a time period which determines when notifications to this User should be triggered. Not set by default. + + + enable_notifications (optional, bool, None) + Whether to send notifications for this user. + + + zone (optional, str, None) + Set the zone. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create user template + telekom_mms.icinga_director.icinga_user_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foousertemplate" + enable_notifications: false + period: '24/7' + zone: "foozone" + + - name: Update user template + telekom_mms.icinga_director.icinga_user_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foousertemplate" + enable_notifications: true + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Lars Krahl (@mmslkr) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_template_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_template_info.rst new file mode 100644 index 000000000..541f379e3 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_user_template_info.rst @@ -0,0 +1,151 @@ +.. _icinga_user_template_info_module: + + +icinga_user_template_info -- Query user templates in Icinga2 +============================================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of user template objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a user template in icinga + telekom_mms.icinga_director.icinga_user_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foousertemplate" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_zone.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_zone.rst new file mode 100644 index 000000000..7648c8a27 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_zone.rst @@ -0,0 +1,166 @@ +.. _icinga_zone_module: + + +icinga_zone -- Manage zones in Icinga2 +====================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Add or remove a zone to Icinga2 through the director API. + + + + + + +Parameters +---------- + + state (optional, str, present) + Apply feature state. + + + object_name (True, str, None) + Icinga object name for this zone. + + This is usually a fully qualified host name but it could basically be any kind of string. + + To make things easier for your users we strongly suggest to use meaningful names for templates. + + For example "generic-zone" is ugly, "Standard Linux Server" is easier to understand. + + + is_global (optional, bool, False) + Whether configuration files for this zone should be synced to all endpoints. + + + parent (optional, str, None) + The name of the parent zone. + + + append (optional, bool, None) + Do not overwrite the whole object but instead append the defined properties. + + Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + + Note - Variables that are set by default will also be applied, even if not set. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Create a zone in icinga + telekom_mms.icinga_director.icinga_zone: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foozone" + + - name: Update a zone in icinga + telekom_mms.icinga_director.icinga_zone: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foozone" + parent: "master" + append: true + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Aaron Bulmahn (@arbu) + diff --git a/ansible_collections/telekom_mms/icinga_director/docs/icinga_zone_info.rst b/ansible_collections/telekom_mms/icinga_director/docs/icinga_zone_info.rst new file mode 100644 index 000000000..c3cc416f2 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/docs/icinga_zone_info.rst @@ -0,0 +1,155 @@ +.. _icinga_zone_info_module: + + +icinga_zone_info -- Query zones in Icinga2 +========================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Get a list of zone objects from Icinga2 through the director API. + + + + + + +Parameters +---------- + + query (False, str, ) + Text to filter search results. + + The text is matched on object\_name. + + Only objects containing this text will be returned in the resultset. + + Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + + + resolved (optional, bool, False) + Resolve all inherited object properties and omit templates in output. + + + external (optional, bool, False) + Also include external objects in output. + + + url (True, str, None) + HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path + + + force (optional, bool, False) + If \ :literal:`yes`\ do not get a cached copy. + + + http_agent (optional, str, ansible-httpget) + Header to identify as, generally appears in web server logs. + + + use_proxy (optional, bool, True) + If \ :literal:`no`\ , it will not use a proxy, even if one is defined in an environment variable on the target hosts. + + + validate_certs (optional, bool, True) + If \ :literal:`no`\ , SSL certificates will not be validated. + + This should only be used on personally controlled sites using self-signed certificates. + + + url_username (optional, str, None) + The username for use in HTTP basic authentication. + + This parameter can be used without \ :emphasis:`url\_password`\ for sites that allow empty passwords + + + url_password (optional, str, None) + The password for use in HTTP basic authentication. + + If the \ :emphasis:`url\_username`\ parameter is not specified, the \ :emphasis:`url\_password`\ parameter will not be used. + + + force_basic_auth (optional, bool, False) + Credentials specified with \ :emphasis:`url\_username`\ and \ :emphasis:`url\_password`\ should be passed in HTTP Header. + + + client_cert (optional, path, None) + PEM formatted certificate chain file to be used for SSL client authentication. + + This file can also include the key as well, and if the key is included, \ :literal:`client\_key`\ is not required. + + + client_key (optional, path, None) + PEM formatted file that contains your private key to be used for SSL client authentication. + + If \ :literal:`client\_cert`\ contains both the certificate and key, this option is not required. + + + use_gssapi (optional, bool, False) + Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + + Requires the Python library \ `gssapi <https://github.com/pythongssapi/python-gssapi>`__\ to be installed. + + Credentials for GSSAPI can be specified with \ :emphasis:`url\_username`\ /\ :emphasis:`url\_password`\ or with the GSSAPI env var \ :literal:`KRB5CCNAME`\ that specified a custom Kerberos credential cache. + + NTLM authentication is \ :literal:`not`\ supported even if the GSSAPI mech for NTLM has been installed. + + + + + +Notes +----- + +.. note:: + - This module supports check mode. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Query a zone in icinga + telekom_mms.icinga_director.icinga_zone_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foozone" + + + +Return Values +------------- + +objects (always, list, ) + A list of returned Director objects. + + The list contains all objects matching the query filter. + + If the filter does not match any object, the list will be empty. + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Martin Schurz (@schurzi) + diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_command.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command.yml new file mode 100644 index 000000000..2616dca7f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command.yml @@ -0,0 +1,89 @@ +--- +- name: Create command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + arguments: + '--authpassphrase': + value: $snmpv3_priv_key$ + '--authprotocol': + value: $snmpv3_auth_protocol$ + '--critical': + value: $centreon_critical$ + '--filter': + value: $centreon_filter$ + '--hostname': + value: $snmp_address$ + '--maxrepetitions': + value: $centreon_maxrepetitions$ + '--mode': + value: $centreon_mode$ + '--plugin': + value: $centreon_plugin$ + '--privpassphrase': + value: $snmpv3_auth_key$ + '--privprotocol': + value: $snmpv3_priv_protocol$ + '--snmp-community': + value: $snmp_community$ + '--snmp-timeout': + value: $snmp_timeout$ + '--snmp-username': + value: $snmpv3_user$ + '--snmp-version': + value: $snmp_version$ + '--subsetleef': + value: $centreon_subsetleef$ + '--verbose': + set_if: $centreon_verbose$ + '--warning': + value: $centreon_warning$ + '--dummy-arg': + description: "dummy arg using Icinga DSL code" + value: + type: "Function" + body: 'return macro("$dummy_var$")' + command: "/opt/centreon-plugins/centreon_plugins.pl" + command_type: "PluginCheck" + disabled: false + object_name: centreon-plugins + imports: + - centreon-plugins-template + vars: + centreon_maxrepetitions: 20 + centreon_subsetleef: 20 + centreon_verbose: false + snmp_address: $address$ + snmp_timeout: 60 + snmp_version: '2' + snmpv3_auth_key: authkey + snmpv3_priv_key: privkey + snmpv3_user: user +- name: Update command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: centreon-plugins + timeout: "1m" + append: true +- name: Create event command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + command: "/opt/scripts/restart_httpd" + object_name: "restart_httpd" + command_type: "PluginEvent" + arguments: + '-s': + value: $service.state$ + '-t': + value: $service.state_type$ + '-a': + set_if: $service.check_attempt$ + value: $restart_service$ diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_info.yml new file mode 100644 index 000000000..602986600 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a command in icinga + telekom_mms.icinga_director.icinga_command_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "centreon-plugins" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_template.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_template.yml new file mode 100644 index 000000000..3772eae23 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_template.yml @@ -0,0 +1,70 @@ +--- +- name: Create command template + telekom_mms.icinga_director.icinga_command_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + arguments: + '--authpassphrase': + value: $snmpv3_priv_key$ + '--authprotocol': + value: $snmpv3_auth_protocol$ + '--critical': + value: $centreon_critical$ + '--filter': + value: $centreon_filter$ + '--hostname': + value: $snmp_address$ + '--maxrepetitions': + value: $centreon_maxrepetitions$ + '--mode': + value: $centreon_mode$ + '--plugin': + value: $centreon_plugin$ + '--privpassphrase': + value: $snmpv3_auth_key$ + '--privprotocol': + value: $snmpv3_priv_protocol$ + '--snmp-community': + value: $snmp_community$ + '--snmp-timeout': + value: $snmp_timeout$ + '--snmp-username': + value: $snmpv3_user$ + '--snmp-version': + value: $snmp_version$ + '--subsetleef': + value: $centreon_subsetleef$ + '--verbose': + set_if: $centreon_verbose$ + '--warning': + value: $centreon_warning$ + '--dummy-arg': + description: "dummy arg using Icinga DSL code" + value: + type: "Function" + body: 'return macro("$dummy_var$")' + command: "/opt/centreon-plugins/centreon_plugins.pl" + command_type: "PluginCheck" + object_name: centreon-plugins-template + disabled: false + vars: + centreon_maxrepetitions: 20 + centreon_subsetleef: 20 + centreon_verbose: false + snmp_address: $address$ + snmp_timeout: 60 + snmp_version: '2' + snmpv3_auth_key: authkey + snmpv3_priv_key: privkey + snmpv3_user: user +- name: Update command template + telekom_mms.icinga_director.icinga_command_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: centreon-plugins-template + timeout: "2m" + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_template_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_template_info.yml new file mode 100644 index 000000000..58d597587 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_command_template_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a command template in icinga + telekom_mms.icinga_director.icinga_command_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "centreon-plugins-template" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_deploy.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_deploy.yml new file mode 100644 index 000000000..017ab6b2c --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_deploy.yml @@ -0,0 +1,6 @@ +--- +- name: Deploy the icinga config + telekom-mms.icinga_director.icinga_deploy: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_deploy_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_deploy_info.yml new file mode 100644 index 000000000..f25795832 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_deploy_info.yml @@ -0,0 +1,6 @@ +--- +- name: Query the current deployment info in icinga + telekom_mms.icinga_director.icinga_deploy_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_endpoint.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_endpoint.yml new file mode 100644 index 000000000..db4b0832c --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_endpoint.yml @@ -0,0 +1,21 @@ +--- +- name: Create an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "fooendpoint" + host: "127.0.0.1" + zone: "foozone" +- name: Update an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "fooendpoint" + host: "127.0.0.1" + zone: "foozone" + port: 5665 + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_endpoint_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_endpoint_info.yml new file mode 100644 index 000000000..45d36a5e7 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_endpoint_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooendpoint" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_host.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host.yml new file mode 100644 index 000000000..96b1a3e28 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host.yml @@ -0,0 +1,48 @@ +--- +- name: Create a host in icinga + telekom_mms.icinga_director.icinga_host: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + accept_config: true + address: "127.0.0.1" + address6: "::1" + check_command: hostalive + check_interval: 90s + check_timeout: 60 + command_endpoint: fooendpoint + disabled: false + display_name: "foohost" + enable_active_checks: true + enable_event_handler: false + enable_flapping: false + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + has_agent: true + icon_image_alt: "alt text" + icon_image: "http://url1" + master_should_connect: true + max_check_attempts: 3 + object_name: "foohost" + retry_interval: "1m" + volatile: false + groups: + - "foohostgroup" + imports: + - "foohosttemplate" + vars: + dnscheck: "no" +- name: update a host in icinga + telekom_mms.icinga_director.icinga_host: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foohost" + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_info.yml new file mode 100644 index 000000000..a1cd39ed1 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a host in icinga + telekom_mms.icinga_director.icinga_host_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohost" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_template.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_template.yml new file mode 100644 index 000000000..71a9a5e8f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_template.yml @@ -0,0 +1,46 @@ +--- +- name: Create host template + telekom_mms.icinga_director.icinga_host_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + accept_config: true + check_command: hostalive + check_interval: 90s + check_timeout: 60 + command_endpoint: fooendpoint + disabled: false + display_name: foohosttemplate + enable_active_checks: true + enable_event_handler: false + enable_flapping: false + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + has_agent: true + icon_image_alt: "alt text" + icon_image: "http://url1" + master_should_connect: true + max_check_attempts: 3 + object_name: foohosttemplate + retry_interval: "1m" + volatile: false + groups: + - "foohostgroup" + imports: + - '' + vars: + dnscheck: "no" +- name: Update host template + telekom_mms.icinga_director.icinga_host_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohosttemplate + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_template_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_template_info.yml new file mode 100644 index 000000000..f66ce177b --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_host_template_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a host template in icinga + telekom_mms.icinga_director.icinga_host_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohosttemplate" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_hostgroup.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_hostgroup.yml new file mode 100644 index 000000000..d67a680ea --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_hostgroup.yml @@ -0,0 +1,29 @@ +--- +- name: Create hostgroup + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + display_name: foohostgroup +- name: Update hostgroup + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + assign_filter: 'host.name="foohost"' + append: true +- name: Update hostgroup using multiple contiditions in assign_filter + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + assign_filter: 'host.vars.something="{{ your_var_here }}"|host.vars.something_else="anything"' + append: true + vars: + your_var_here: foo diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_hostgroup_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_hostgroup_info.yml new file mode 100644 index 000000000..f2247abf9 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_hostgroup_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a hostgroup in icinga + telekom_mms.icinga_director.icinga_hostgroup_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohostgroup" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification.yml new file mode 100644 index 000000000..c19cfe547 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification.yml @@ -0,0 +1,37 @@ +--- +- name: Create notification + telekom_mms.icinga_director.icinga_notification: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + apply_to: host + assign_filter: 'host.name="foohost"' + imports: + - foonotificationtemplate + notification_interval: '0' + object_name: E-Mail_host + states: + - Up + - Down + types: + - Problem + - Recovery + users: + - rb + user_groups: + - OnCall + disabled: false + time_period: "24/7" + times_begin: 20 + times_end: 120 +- name: Update notification + telekom_mms.icinga_director.icinga_notification: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: E-Mail_host + vars: + foo: bar + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_info.yml new file mode 100644 index 000000000..267c1f132 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a notification in icinga + telekom_mms.icinga_director.icinga_notification_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "E-Mail_host" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_template.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_template.yml new file mode 100644 index 000000000..bf8200d2f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_template.yml @@ -0,0 +1,32 @@ +--- +- name: Create notification template + telekom_mms.icinga_director.icinga_notification_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foonotificationtemplate + states: + - Up + - Down + types: + - Problem + - Recovery + times_begin: 20 + times_end: 120 + time_period: "24/7" + notification_command: "mail-host-notification" + users: + - "rb" + user_groups: + - "OnCall" + zone: "foozone" +- name: Update notification template + telekom_mms.icinga_director.icinga_notification_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foonotificationtemplate + notification_interval: '0' + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_template_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_template_info.yml new file mode 100644 index 000000000..13738e96d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_notification_template_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a notification template in icinga + telekom_mms.icinga_director.icinga_notification_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foonotificationtemplate" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_scheduled_downtime.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_scheduled_downtime.yml new file mode 100644 index 000000000..f86d67afa --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_scheduled_downtime.yml @@ -0,0 +1,46 @@ +--- +- name: create icinga_scheduled_downtime + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + disabled: false + object_name: "foodowntime" + state: present + author: testuser + comment: test + fixed: true + with_services: true + apply_to: host + assign_filter: 'host.name="foohost"' + duration: 500 + ranges: + "tuesday": "00:00-24:00" +- name: create icinga_scheduled_downtime2 + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + disabled: false + object_name: "foodowntime2" + state: present + author: testuser + comment: test + fixed: false + with_services: false + apply_to: host + assign_filter: 'host.name="foohost"' + duration: 500 + ranges: + "tuesday": "00:00-24:00" +- name: update icinga_scheduled_downtime2 + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foodowntime2" + state: present + duration: 1000 + append: true + apply_to: host + with_services: false diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_service.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service.yml new file mode 100644 index 000000000..5b03ef581 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service.yml @@ -0,0 +1,38 @@ +--- +- name: Create service + tags: service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service" + display_name: "foo service" + check_command: hostalive + use_agent: false + host: foohost + vars: + procs_argument: consul + procs_critical: '1:' + procs_warning: '1:' +- name: Update service + tags: service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service" + display_name: "foo service" + host: foohost + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true +- name: Create serviceset service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service serviceset" + service_set: "foo_serviceset" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_apply.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_apply.yml new file mode 100644 index 000000000..09539b6b9 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_apply.yml @@ -0,0 +1,66 @@ +--- +- name: Add service apply rule to icinga + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + assign_filter: 'host.name="foohost"' + check_command: hostalive + display_name: "dummy process" + check_interval: "10m" + check_period: "24/7" + check_timeout: "1m" + enable_active_checks: true + enable_event_handler: true + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + event_command: restart_httpd + max_check_attempts: "5" + retry_interval: "3m" + imports: + - fooservicetemplate + groups: + - fooservicegroup + vars: + http_address: "$address$" + http_port: "9080" + http_uri: "/ready" + http_string: "Ready" + http_expect: "Yes" +- name: Add service apply rule with command_endpoint + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + assign_filter: 'host.name="foohost"' + check_command: hostalive + display_name: "dummy process" + check_interval: "10m" + check_period: "24/7" + check_timeout: "1m" + enable_active_checks: true + enable_event_handler: true + enable_notifications: true + enable_passive_checks: false + event_command: restart_httpd + max_check_attempts: "5" + retry_interval: "3m" + command_endpoint: "fooendpoint" + imports: + - fooservicetemplate + groups: + - fooservicegroup +- name: Update service apply rule with command_endpoint + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + enable_perfdata: true + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_apply_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_apply_info.yml new file mode 100644 index 000000000..614c4788d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_apply_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a service apply rule in icinga + telekom_mms.icinga_director.icinga_service_apply_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "SERVICE_dummy" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_info.yml new file mode 100644 index 000000000..cbabb1c51 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a service in icinga + telekom_mms.icinga_director.icinga_service_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foo service" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_template.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_template.yml new file mode 100644 index 000000000..d7d4d9cab --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_template.yml @@ -0,0 +1,39 @@ +--- +- name: Create servicetemplate + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + enable_flapping: true + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + icon_image_alt: "alt text" + icon_image: "http://url1" + object_name: fooservicetemplate + use_agent: false + vars: + procs_argument: consul + procs_critical: '1:' + procs_warning: '1:' +- name: Update servicetemplate + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicetemplate + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true +- name: Create servicetemplate with event command + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: apache_check_servicetemplate + use_agent: false + event_command: restart_httpd + notes: "example note" + notes_url: "'http://url1' 'http://url2'" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_template_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_template_info.yml new file mode 100644 index 000000000..c0c08c861 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_service_template_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a service template in icinga + telekom_mms.icinga_director.icinga_service_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooservicetemplate" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_servicegroup.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_servicegroup.yml new file mode 100644 index 000000000..12c1fc248 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_servicegroup.yml @@ -0,0 +1,18 @@ +--- +- name: Create servicegroup + telekom_mms.icinga_director.icinga_servicegroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicegroup + assign_filter: 'host.name="foo"' +- name: Update servicegroup + telekom_mms.icinga_director.icinga_servicegroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicegroup + display_name: fooservicegroup + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_servicegroup_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_servicegroup_info.yml new file mode 100644 index 000000000..5ea86d8cc --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_servicegroup_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a servicegroup in icinga + telekom_mms.icinga_director.icinga_servicegroup_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooservicegroup" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_serviceset.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_serviceset.yml new file mode 100644 index 000000000..5cb803368 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_serviceset.yml @@ -0,0 +1,19 @@ +--- +- name: Create serviceset + telekom_mms.icinga_director.icinga_serviceset: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo_serviceset" + assign_filter: 'host.name="foohost"' + description: "foo description" +- name: Update serviceset + telekom_mms.icinga_director.icinga_serviceset: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo_serviceset" + assign_filter: 'host.name="foohost2"' + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod.yml new file mode 100644 index 000000000..686ca9946 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod.yml @@ -0,0 +1,27 @@ +--- +- name: Create timeperiod + telekom_mms.icinga_director.icinga_timeperiod: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: '24/7' + imports: + - "timeperiod_template" + ranges: + monday: "00:00-23:59" + tuesday: "00:00-23:59" + wednesday: "00:00-23:59" + thursday: "00:00-23:59" + friday: "00:00-23:59" + saturday: "00:00-23:59" + sunday: "00:00-23:59" +- name: Update timeperiod + telekom_mms.icinga_director.icinga_timeperiod: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: '24/7' + display_name: '24/7' + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_info.yml new file mode 100644 index 000000000..5ce352401 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a timeperiod in icinga + telekom_mms.icinga_director.icinga_timeperiod_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "24/7" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_template.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_template.yml new file mode 100644 index 000000000..b7679c962 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_template.yml @@ -0,0 +1,29 @@ +--- +- name: Create timeperiod template + telekom_mms.icinga_director.icinga_timeperiod_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "timeperiod_template" + imports: [] + disabled: false + prefer_includes: false + ranges: + monday: "00:00-23:59" + tuesday: "00:00-23:59" + wednesday: "00:00-23:59" + thursday: "00:00-23:59" + friday: "00:00-23:59" + saturday: "00:00-23:59" + sunday: "00:00-23:59" + update_method: "LegacyTimePeriod" +- name: Update timeperiod template + telekom_mms.icinga_director.icinga_timeperiod_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "timeperiod_template" + display_name: "timeperiod template" + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_template_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_template_info.yml new file mode 100644 index 000000000..44e86ecde --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_timeperiod_template_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a timeperiod template in icinga + telekom_mms.icinga_director.icinga_timeperiod_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "timeperiod_template" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_user.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user.yml new file mode 100644 index 000000000..869a03220 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user.yml @@ -0,0 +1,24 @@ +--- +- name: Create user + telekom_mms.icinga_director.icinga_user: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "rb" + pager: 'SIP/emergency' + period: '24/7' + email: "foouser@example.com" + imports: + - foousertemplate + groups: + - onCall +- name: Update user + telekom_mms.icinga_director.icinga_user: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "rb" + display_name: "Rufbereitschaft" + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_group.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_group.yml new file mode 100644 index 000000000..a7128a9a5 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_group.yml @@ -0,0 +1,18 @@ +--- +- name: Create user group + telekom_mms.icinga_director.icinga_user_group: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "onCall" + disabled: false +- name: Update user group + telekom_mms.icinga_director.icinga_user_group: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "onCall" + display_name: "on call group" + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_group_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_group_info.yml new file mode 100644 index 000000000..a2c4235cb --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_group_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a user group in icinga + telekom_mms.icinga_director.icinga_user_group_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "onCall" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_info.yml new file mode 100644 index 000000000..3b2545d5d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a user in icinga + telekom_mms.icinga_director.icinga_user_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "rb" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_template.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_template.yml new file mode 100644 index 000000000..a86bbf6ce --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_template.yml @@ -0,0 +1,20 @@ +--- +- name: Create user template + telekom_mms.icinga_director.icinga_user_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foousertemplate" + enable_notifications: false + period: '24/7' + zone: "foozone" +- name: Update user template + telekom_mms.icinga_director.icinga_user_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foousertemplate" + enable_notifications: true + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_template_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_template_info.yml new file mode 100644 index 000000000..46cda758f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_user_template_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a user template in icinga + telekom_mms.icinga_director.icinga_user_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foousertemplate" diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_zone.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_zone.yml new file mode 100644 index 000000000..8113de823 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_zone.yml @@ -0,0 +1,17 @@ +--- +- name: Create a zone in icinga + telekom_mms.icinga_director.icinga_zone: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foozone" +- name: Update a zone in icinga + telekom_mms.icinga_director.icinga_zone: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foozone" + parent: "master" + append: true diff --git a/ansible_collections/telekom_mms/icinga_director/examples/icinga_zone_info.yml b/ansible_collections/telekom_mms/icinga_director/examples/icinga_zone_info.yml new file mode 100644 index 000000000..1c5f9e30c --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/examples/icinga_zone_info.yml @@ -0,0 +1,7 @@ +--- +- name: Query a zone in icinga + telekom_mms.icinga_director.icinga_zone_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foozone" diff --git a/ansible_collections/telekom_mms/icinga_director/meta/runtime.yml b/ansible_collections/telekom_mms/icinga_director/meta/runtime.yml new file mode 100644 index 000000000..6d1ae61a8 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/meta/runtime.yml @@ -0,0 +1,45 @@ +--- +requires_ansible: '>=2.9.10' + +action_groups: + icinga: + - icinga_command + - icinga_command_info + - icinga_command_template + - icinga_command_template_info + - icinga_deploy + - icinga_deploy_info + - icinga_endpoint + - icinga_endpoint_info + - icinga_host + - icinga_host_info + - icinga_host_template + - icinga_host_template_info + - icinga_hostgroup + - icinga_hostgroup_info + - icinga_notification + - icinga_notification_info + - icinga_notification_template + - icinga_notification_template_info + - icinga_scheduled_downtime + - icinga_service + - icinga_service_apply + - icinga_service_apply_info + - icinga_service_info + - icinga_service_template + - icinga_service_template_info + - icinga_servicegroup + - icinga_servicegroup_info + - icinga_serviceset + - icinga_timeperiod + - icinga_timeperiod_info + - icinga_timeperiod_template + - icinga_timeperiod_template_info + - icinga_user + - icinga_user_group + - icinga_user_group_info + - icinga_user_info + - icinga_user_template + - icinga_user_template_info + - icinga_zone + - icinga_zone_info diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/doc_fragments/common_options.py b/ansible_collections/telekom_mms/icinga_director/plugins/doc_fragments/common_options.py new file mode 100644 index 000000000..698e23bc5 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/doc_fragments/common_options.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class ModuleDocFragment(object): + # Documentation for common options that are always the same + DOCUMENTATION = r""" + options: + url: + required: true + """ diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/inventory/icinga_director_inventory.py b/ansible_collections/telekom_mms/icinga_director/plugins/inventory/icinga_director_inventory.py new file mode 100644 index 000000000..214ebc694 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/inventory/icinga_director_inventory.py @@ -0,0 +1,238 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = r""" +name: icinga_director_inventory +short_description: Returns Ansible inventory from Icinga +description: Returns Ansible inventory from Icinga +author: +- Sebastian Gumprich (@rndmh3ro) +options: + plugin: + description: Name of the plugin + required: true + choices: ['telekom_mms.icinga_director.icinga_director_inventory'] + url: + description: Icinga URL to connect to + required: true + url_username: + description: + - The username for use in HTTP basic authentication. + - This parameter can be used without `url_password` for sites that allow empty passwords + url_password: + description: + - The password for use in HTTP basic authentication. + - If the `url_username` parameter is not specified, the `url_password` parameter will not be used. + force_basic_auth: + description: + - Credentials specified with `url_username` and `url_password` should be passed in HTTP Header. + client_cert: + description: + - PEM formatted certificate chain file to be used for SSL client authentication. + - This file can also include the key as well, and if the key is included, `client_key` is not required. + client_key: + description: + - PEM formatted file that contains your private key to be used for SSL client authentication. + - If `client_cert` contains both the certificate and key, this option is not required. + http_agent: + description: + - Header to identify as, generally appears in web server logs. + use_proxy: + description: + - If `no`, it will not use a proxy, even if one is defined in an environment variable on the target hosts. + validate_certs: + description: + - If `no`, SSL certificates will not be validated. + - This should only be used on personally controlled sites using self-signed certificates. + use_gssapi: + description: + - Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. + - Requires the Python library `gssapi <https://github.com/pythongssapi/python-gssapi>` to be installed. + - Credentials for GSSAPI can be specified with `url_username`/ `url_password` + - or with the GSSAPI env var `KRB5CCNAME` that specified a custom Kerberos credential cache. + - NTLM authentication is `not` supported even if the GSSAPI mech for NTLM has been installed. +extends_documentation_fragment: + - ansible.builtin.url + - constructed +""" + +EXAMPLES = r""" +plugin: telekom_mms.icinga_director.icinga_director_inventory +url: 'https://example.com' +url_username: foo +url_password: bar +force_basic_auth: False +strict: False + +# use the object_name you defined as hostname +compose: + hostname: object_name + +# create a group based on the operating system defined in a custom variable +keyed_groups: + - prefix: os + key: vars.HostOS + +# create groups based on jinja templates +# here we create a group called "rb" if the host variable "check_period" is "24/7" +groups: + rb: check_period == "24/7" +""" + + +from ansible.plugins.inventory import BaseInventoryPlugin, Constructable + +from ansible.module_utils.urls import open_url +import json + + +class InventoryModule(BaseInventoryPlugin, Constructable): + NAME = "telekom_mms.icinga_director.icinga_director_inventory" + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def call_url(self, url_path): + """ + Execute the request against the API with the provided arguments and return json. + """ + + headers = { + "Accept": "application/json", + "X-HTTP-Method-Override": "GET", + } + url = self.url + url_path + rsp = open_url( + url, + url_username=self.url_username, + url_password=self.url_password, + force_basic_auth=self.force_basic_auth, + client_cert=self.client_cert, + client_key=self.client_key, + http_agent=self.http_agent, + use_proxy=self.use_proxy, + validate_certs=self.validate_certs, + use_gssapi=self.use_gssapi, + headers=headers, + ) + content = "" + if rsp: + content = json.loads(rsp.read().decode("utf-8")) + return content + + def verify_file(self, path): + """Verify the configuration file.""" + if super(InventoryModule, self).verify_file(path): + endings = ( + "icinga_director_inventory.yaml", + "icinga_director_inventory.yml", + ) + if any((path.endswith(ending) for ending in endings)): + return True + return False + + def add_hosts_to_groups(self): + hostgroups = self.set_hostgroups() + + for hostgroup in hostgroups: + members = self.call_url( + url_path="/monitoring/list/hosts" + + "?hostgroup_name=" + + hostgroup, + ) + for member in members: + self.inventory.add_host(member["host_name"], group=hostgroup) + + def set_hostgroups(self): + hostgroup_list = self.call_url( + url_path="/director/hostgroups", + ) + + hostgroups = [] + + for hostgroup in hostgroup_list["objects"]: + hostgroups.append(hostgroup["object_name"]) + self.inventory.add_group(hostgroup["object_name"]) + return hostgroups + + def parse(self, inventory, loader, path, cache=True): + """Return dynamic inventory from source""" + + # call base method to ensure properties are available for use with other helper methods + super(InventoryModule, self).parse(inventory, loader, path, cache) + + # Read the inventory YAML file + self._read_config_data(path) + + # Store the options from the YAML file + self.plugin = self.get_option("plugin") + self.url = self.get_option("url") + self.url_username = self.get_option("url_username") + self.url_password = self.get_option("url_password") + self.force_basic_auth = self.get_option("force_basic_auth") + self.client_cert = self.get_option("client_cert") + self.client_key = self.get_option("client_key") + self.http_agent = self.get_option("http_agent") + self.use_proxy = self.get_option("use_proxy") + self.validate_certs = self.get_option("validate_certs") + self.force_basic_auth = self.get_option("force_basic_auth") + self.use_gssapi = self.get_option("use_gssapi") + self.strict = self.get_option("strict") + self.compose = self.get_option("compose") + + host_list = self.call_url( + url_path="/director/hosts" + "?resolved", + ) + + for host in host_list["objects"]: + self.inventory.add_host(host["object_name"], group="all") + for item in host: + self.inventory.set_variable( + host["object_name"], item, host[item] + ) + + host_vars = self.inventory.get_host(host["object_name"]).get_vars() + + # Add variables created by the user's Jinja2 expressions to the host + self._set_composite_vars( + self.compose, + host_vars, + host["object_name"], + strict=self.strict, + ) + + # The following two methods combine the provided variables dictionary with the latest host variables + # Using these methods after _set_composite_vars() allows groups to be created with the composed variables + self._add_host_to_composed_groups( + self.get_option("groups"), + host_vars, + host["object_name"], + strict=self.strict, + ) + self._add_host_to_keyed_groups( + self.get_option("keyed_groups"), + host_vars, + host["object_name"], + strict=self.strict, + ) + + self.add_hosts_to_groups() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/module_utils/icinga.py b/ansible_collections/telekom_mms/icinga_director/plugins/module_utils/icinga.py new file mode 100644 index 000000000..ca56d5fe8 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/module_utils/icinga.py @@ -0,0 +1,360 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import json +from collections import defaultdict + +from ansible.module_utils.urls import fetch_url +from ansible.module_utils.six import iteritems +from ansible.module_utils.common.text.converters import to_text +from ansible.module_utils.six.moves.urllib.parse import quote as urlquote + + +class Icinga2APIObject(object): + """Interact with the icinga2 director API""" + + def __init__(self, module, path, data): + self.module = module + self.params = module.params + self.path = path + self.data = data + self.object_id = None + + def call_url(self, path, data="", method="GET"): + """ + Execute the request against the API with the provided arguments and return json. + + Parameters: + path: type str, the path of the api to call + data: type str, the module params passed to the api + method: type str, default "GET", the method to run against the api. + GET to check objects, POST to create or modify objects, DELETE to delete objects + + Returns: + jsonString with return code, the resulting data from the api-call and errors if there are any + """ + + headers = { + "Accept": "application/json", + "X-HTTP-Method-Override": method, + } + url = self.module.params.get("url") + "/director" + path + rsp, info = fetch_url( + module=self.module, + url=url, + data=data, + headers=headers, + method=method, + use_proxy=self.module.params["use_proxy"], + ) + content = "" + error = "" + + # handle 400 errors + if info["status"] >= 400: + try: + content = json.loads(info["body"].decode("utf-8")) + error = content["error"] + except (ValueError, KeyError): + error = info["msg"] + + # handle other errors + elif info["status"] < 0: + error = info["msg"] + + # if nothing is modified when trying to change objects, fetch_url + # returns only the 304 status but no body. + # if that happens we set the content to an empty json object. + # else we serialize the response as a json object. + elif info["status"] == 304: + content = {} + else: + content = json.loads(rsp.read().decode("utf-8")) + + return {"code": info["status"], "data": content, "error": error} + + def exists(self, find_by="name"): + """ + Check if the object already exists in the director. + + Parameters: + find_by: type str, default "name", the object key to search for. by default 'name' of the object, + however service apply rules have no name and have to be found by their id. + Returns: + boolean that tells whether the object exists + """ + + ret = self.call_url( + path=self.path + + "?" + + find_by + + "=" + + to_text(urlquote(self.data["object_name"])) + ) + self.object_id = to_text(urlquote(self.data["object_name"])) + return ret["code"] == 200 + + def query(self, query="", resolved=False): + """ + Find all matching objects in the director and return the result of the api-call. + + Parameters: + query: type str, default "", searchstring to limit the results. By default Director will search in + the name of the resource. Usually that means 'object_name', but for services it also covers + the host name. + resolved: type bool, default False, resolve all object variables. If True, this will include all + variables inherited via imports. + + Returns: + the result of the api-call + """ + + try: + ret = self.call_url( + path=self.path + + "?q=" + + to_text(urlquote(query)) + + ("&resolved" if resolved else "") + ) + if ret["code"] != 200: + self.module.fail_json( + msg="bad return code while querying: %d. Error message: %s" + % (ret["code"], ret["error"]) + ) + return ret + except Exception as e: + self.module.fail_json(msg="exception when querying: " + str(e)) + + def query_deployment(self, configs=None, activities=None): + """ + Find the current deployment or the deployment specified with configs or activities + in the director and return the result of the api-call. + + Parameters: + configs: type list, default empty, list of checksums for configs to search for. + If left empty, only the active_configuration will be returned. + activities: type list, default empty, list of checksums for activities to search for. + If left empty, only the active_configuration will be returned. + + Returns: + the result of the api-call + """ + + if configs is None: + configs = [] + + if activities is None: + activities = [] + + try: + ret = self.call_url( + path=self.path + + "?configs=" + + ",".join(configs) + + "&activities=" + + ",".join(activities) + ) + if ret["code"] != 200: + self.module.fail_json( + msg="bad return code while querying: %d. Error message: %s" + % (ret["code"], ret["error"]) + ) + return ret + except Exception as e: + self.module.fail_json(msg="exception when querying: " + str(e)) + + def create(self): + """ + Create the object in the director and return the result of the api-call. + + Parameters: + none + + Returns: + the result of the api-call + """ + + return self.call_url( + path=self.path, data=self.module.jsonify(self.data), method="POST" + ) + + def delete(self, find_by="name"): + """ + Delete the object in the director and return the result of the api-call. + + Parameters: + find_by: type str, default "name", the object key to search for. by default 'name' of the object, + however service apply rules have no name and have to be found by their id. + Returns: + the result of the api-call + """ + + return self.call_url( + path=self.path + "?" + find_by + "=" + self.object_id, + method="DELETE", + ) + + def modify(self, find_by="name"): + """ + Modify the object in the director and return the result of the api-call. + + Parameters: + find_by: type str, default "name", the object key to search for. by default 'name' of the object, + however service apply rules have no name and have to be found by their id. + Returns: + the result of the api-call + """ + + return self.call_url( + path=self.path + "?" + find_by + "=" + self.object_id, + data=self.module.jsonify(self.data), + method="POST", + ) + + def scrub_diff_value(self, value): + """ + Scrub the 'command_id' key from the returned data. + + The command api returns the command_id, rendering the diff useless + + Parameters: + value: type dict, the dict to remove the command_id key from + + Returns: + the dict value without the key command_id + """ + + if isinstance(value, dict): + for k, v in iteritems(value.copy()): + if isinstance(value[k], dict): + value[k].pop("command_id", None) + + return value + + def diff(self, find_by="name"): + """ + Produce the diff for the changed object and return it. + + Parameters: + find_by: type str, default "name", the object key to search for. by default 'name' of the object, + however service apply rules have no name and have to be found by their id. + + Returns: + the generated diff + """ + + ret = self.call_url( + path=self.path + "?" + find_by + "=" + self.object_id + "&withNull", + ) + + data_from_director = json.loads(self.module.jsonify(ret["data"])) + data_from_task = json.loads(self.module.jsonify(self.data)) + + diff = defaultdict(dict) + for key, value in data_from_director.items(): + value = self.scrub_diff_value(value) + if key in data_from_task.keys() and value != data_from_task[key]: + diff["before"][key] = "{val}".format(val=value) + diff["after"][key] = "{val}".format(val=data_from_task[key]) + + return diff + + def update(self, state): + """ + Create, update or delete the objects in the director. + + Parameters: + state: type str, the state of the object, present or absent + + Returns: + changed: whether the object was changed + diff_result: the diff of the object + """ + + changed = False + diff_result = {"before": "", "after": ""} + + try: + exists = self.exists() + except Exception as e: + self.module.fail_json(msg="exception when deleting: " + str(e)) + if exists: + diff_result["before"] = "state: present\n" + if state == "absent": + if self.module.check_mode: + diff_result["after"] = "state: absent\n" + self.module.exit_json( + changed=True, + object_name=self.data["object_name"], + diff=diff_result, + ) + else: + try: + ret = self.delete() + if ret["code"] == 200: + changed = True + diff_result["after"] = "state: absent\n" + else: + self.module.fail_json( + msg="bad return code while deleting: %d. Error message: %s" + % (ret["code"], ret["error"]) + ) + except Exception as e: + self.module.fail_json( + msg="exception when deleting: " + str(e) + ) + + else: + try: + diff_result = self.diff() + except Exception as e: + self.module.fail_json( + msg="exception when diffing: " + str(e) + ) + + if self.module.check_mode: + if diff_result: + changed = True + self.module.exit_json( + changed=changed, + object_name=self.data["object_name"], + data=self.data, + diff=diff_result, + ) + + ret = self.modify() + if ret["code"] == 200: + changed = True + elif ret["code"] == 304: + changed = False + else: + self.module.fail_json( + msg="bad return code while modifying: %d. Error message: %s" + % (ret["code"], ret["error"]) + ) + + else: + diff_result.update({"before": "state: absent\n"}) + if state == "present": + if self.module.check_mode: + changed = True + diff_result.update({"after": "state: created\n"}) + else: + try: + ret = self.create() + if ret["code"] == 201: + changed = True + diff_result.update({"after": "state: created\n"}) + else: + self.module.fail_json( + msg="bad return code while creating: %d. Error message: %s" + % (ret["code"], ret["error"]) + ) + except Exception as e: + self.module.fail_json( + msg="exception while creating: " + str(e) + ) + return changed, diff_result diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command.py new file mode 100644 index 000000000..d82e40965 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command.py @@ -0,0 +1,290 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_command +short_description: Manage commands in Icinga2 +description: + - Add or remove a command to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +version_added: '1.0.0' +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + command: + description: + - The command Icinga should run. Required when state is C(present). + - Absolute paths are accepted as provided, relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed. + - Spaces will lead to separation of command path and standalone arguments. + - Please note that this means that we do not support spaces in plugin names and paths right now. + type: str + methods_execute: + description: + - Plugin Check commands are what you need when running checks against your infrastructure. + - Notification commands will be used when it comes to notify your users. + - Event commands allow you to trigger specific actions when problems occur. + - Some people use them for auto-healing mechanisms, like restarting services or rebooting systems at specific thresholds. + choices: ["PluginCheck", "PluginNotification", "PluginEvent"] + default: "PluginCheck" + aliases: ['command_type'] + type: str + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + object_name: + description: + - Name of the command. + aliases: ['name'] + required: true + type: str + imports: + description: + - Importable templates, add as many as you want. Please note that order matters when importing properties from multiple templates - last one wins. + type: list + elements: str + default: [] + timeout: + description: + - Optional command timeout. Allowed values are seconds or durations postfixed with a specific unit (for example 1m or also 3m 30s). + type: str + zone: + description: + - Icinga cluster zone. Allows to manually override Directors decisions of where to deploy your config to. + - You should consider not doing so unless you gained deep understanding of how an Icinga Cluster stack works. + type: str + vars: + description: + - Custom properties of the command. + type: "dict" + default: {} + arguments: + description: + - Arguments of the command. + - Each argument can take either a string, a json or a dict + - When using a dict as argument value, the following properties are supported. + C(skip_key), C(repeat_key), C(required), C(order), C(description)), + C(set_if), C(value). + - The C(value) property can be either a string, a json or a dict. When used as a dict, you can define + its C(type) as C(Function) and set its C(body) property as an Icinga DSL piece of config. + type: "dict" + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + arguments: + '--authpassphrase': + value: $snmpv3_priv_key$ + '--authprotocol': + value: $snmpv3_auth_protocol$ + '--critical': + value: $centreon_critical$ + '--filter': + value: $centreon_filter$ + '--hostname': + value: $snmp_address$ + '--maxrepetitions': + value: $centreon_maxrepetitions$ + '--mode': + value: $centreon_mode$ + '--plugin': + value: $centreon_plugin$ + '--privpassphrase': + value: $snmpv3_auth_key$ + '--privprotocol': + value: $snmpv3_priv_protocol$ + '--snmp-community': + value: $snmp_community$ + '--snmp-timeout': + value: $snmp_timeout$ + '--snmp-username': + value: $snmpv3_user$ + '--snmp-version': + value: $snmp_version$ + '--subsetleef': + value: $centreon_subsetleef$ + '--verbose': + set_if: $centreon_verbose$ + '--warning': + value: $centreon_warning$ + '--dummy-arg': + description: "dummy arg using Icinga DSL code" + value: + type: "Function" + body: 'return macro("$dummy_var$")' + command: "/opt/centreon-plugins/centreon_plugins.pl" + command_type: "PluginCheck" + disabled: false + object_name: centreon-plugins + imports: + - centreon-plugins-template + vars: + centreon_maxrepetitions: 20 + centreon_subsetleef: 20 + centreon_verbose: false + snmp_address: $address$ + snmp_timeout: 60 + snmp_version: '2' + snmpv3_auth_key: authkey + snmpv3_priv_key: privkey + snmpv3_user: user + +- name: Update command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: centreon-plugins + timeout: "1m" + append: true + +- name: Create event command + telekom_mms.icinga_director.icinga_command: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + command: "/opt/scripts/restart_httpd" + object_name: "restart_httpd" + command_type: "PluginEvent" + arguments: + '-s': + value: $service.state$ + '-t': + value: $service.state_type$ + '-a': + set_if: $service.check_attempt$ + value: $restart_service$ +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + imports=dict(type="list", elements="str", required=False, default=[]), + disabled=dict( + type="bool", required=False, default=False, choices=[True, False] + ), + vars=dict(type="dict", default={}), + command=dict(required=False), + methods_execute=dict( + default="PluginCheck", + choices=["PluginCheck", "PluginNotification", "PluginEvent"], + aliases=["command_type"], + ), + timeout=dict(required=False, default=None), + zone=dict(required=False, default=None), + arguments=dict(type="dict", default=None), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + # type of arguments is actually dict, i.e. without specification = {} + # the director API returns an empty array if nothing is defined + # therefore overwrite so that the diff works better + if not module.params["arguments"]: + module.params["arguments"] = [] + + data_keys = [ + "object_name", + "imports", + "disabled", + "vars", + "command", + "methods_execute", + "timeout", + "zone", + "arguments", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject(module=module, path="/command", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_info.py new file mode 100644 index 000000000..781d4e422 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_info.py @@ -0,0 +1,133 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_command_info +short_description: Query commands in Icinga2 +description: + - Get a list of command objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] + external: + description: + - Also include external objects in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a command in icinga + telekom_mms.icinga_director.icinga_command_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "centreon-plugins" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + external=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/commands", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + + # icinga also returns normal objects when querying templates, + # we need to filter these + filtered_list = [ + i + for i in object_list["data"]["objects"] + if i["object_type"] != "template" + ] + + if not module.params["external"]: + filtered_list = [ + i for i in filtered_list if i["object_type"] != "external_object" + ] + + module.exit_json( + objects=filtered_list, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_template.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_template.py new file mode 100644 index 000000000..327ea50f8 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_template.py @@ -0,0 +1,269 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_command_template +short_description: Manage command templates in Icinga2 +description: + - Add or remove a command template to Icinga2 through the director API. +author: Lars Krahl (@mmslkr) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.1.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + command: + description: + - The command Icinga should run. + - Absolute paths are accepted as provided, relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed. + - Spaces will lead to separation of command path and standalone arguments. + - Please note that this means that we do not support spaces in plugin names and paths right now. + type: str + methods_execute: + description: + - Plugin Check commands are what you need when running checks against your infrastructure. + - Notification commands will be used when it comes to notify your users. + - Event commands allow you to trigger specific actions when problems occur. + - Some people use them for auto-healing mechanisms, like restarting services or rebooting systems at specific thresholds. + choices: ["PluginCheck", "PluginNotification", "PluginEvent"] + default: "PluginCheck" + aliases: ['command_type'] + type: str + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + object_name: + description: + - Name of the command template. + aliases: ['name'] + required: true + type: str + imports: + description: + - Importable templates, add as many as you want. Please note that order matters when importing properties from multiple templates - last one wins. + type: list + elements: str + default: [] + timeout: + description: + - Optional command timeout. Allowed values are seconds or durations postfixed with a specific unit (for example 1m or also 3m 30s). + type: str + zone: + description: + - Icinga cluster zone. Allows to manually override Directors decisions of where to deploy your config to. + - You should consider not doing so unless you gained deep understanding of how an Icinga Cluster stack works. + type: str + vars: + description: + - Custom properties of the command template. + type: "dict" + default: {} + arguments: + description: + - Arguments of the command template. + - Each argument can take either a string, a json or a dict + - When using a dict as argument value, the following properties are supported. + C(skip_key), C(repeat_key), C(required), C(order), C(description)), + C(set_if), C(value). + - The C(value) property can be either a string, a json or a dict. When used as a dict, you can define + its C(type) as C(Function) and set its C(body) property as an Icinga DSL piece of config. + type: "dict" + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create command template + telekom_mms.icinga_director.icinga_command_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + arguments: + '--authpassphrase': + value: $snmpv3_priv_key$ + '--authprotocol': + value: $snmpv3_auth_protocol$ + '--critical': + value: $centreon_critical$ + '--filter': + value: $centreon_filter$ + '--hostname': + value: $snmp_address$ + '--maxrepetitions': + value: $centreon_maxrepetitions$ + '--mode': + value: $centreon_mode$ + '--plugin': + value: $centreon_plugin$ + '--privpassphrase': + value: $snmpv3_auth_key$ + '--privprotocol': + value: $snmpv3_priv_protocol$ + '--snmp-community': + value: $snmp_community$ + '--snmp-timeout': + value: $snmp_timeout$ + '--snmp-username': + value: $snmpv3_user$ + '--snmp-version': + value: $snmp_version$ + '--subsetleef': + value: $centreon_subsetleef$ + '--verbose': + set_if: $centreon_verbose$ + '--warning': + value: $centreon_warning$ + '--dummy-arg': + description: "dummy arg using Icinga DSL code" + value: + type: "Function" + body: 'return macro("$dummy_var$")' + command: "/opt/centreon-plugins/centreon_plugins.pl" + command_type: "PluginCheck" + object_name: centreon-plugins-template + disabled: false + vars: + centreon_maxrepetitions: 20 + centreon_subsetleef: 20 + centreon_verbose: false + snmp_address: $address$ + snmp_timeout: 60 + snmp_version: '2' + snmpv3_auth_key: authkey + snmpv3_priv_key: privkey + snmpv3_user: user + +- name: Update command template + telekom_mms.icinga_director.icinga_command_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: centreon-plugins-template + timeout: "2m" + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + imports=dict(type="list", elements="str", required=False, default=[]), + disabled=dict( + type="bool", required=False, default=False, choices=[True, False] + ), + vars=dict(type="dict", default={}), + command=dict(required=False), + methods_execute=dict( + default="PluginCheck", + choices=["PluginCheck", "PluginNotification", "PluginEvent"], + aliases=["command_type"], + ), + timeout=dict(required=False, default=None), + zone=dict(required=False, default=None), + arguments=dict(type="dict", default=None), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + # `arguments` is of type dict, default should be {} + # however, the director api returns [] when no `arguments` are set, making the diff seem changed + # therefore set the default to [] as well to get a clean diff output + if not module.params["arguments"]: + module.params["arguments"] = [] + + data_keys = [ + "object_name", + "imports", + "disabled", + "vars", + "command", + "methods_execute", + "timeout", + "zone", + "arguments", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "template" + + icinga_object = Icinga2APIObject(module=module, path="/command", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_template_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_template_info.py new file mode 100644 index 000000000..bcea5afca --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_command_template_info.py @@ -0,0 +1,122 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_command_template_info +short_description: Query command templates in Icinga2 +description: + - Get a list of command template objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a command template in icinga + telekom_mms.icinga_director.icinga_command_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "centreon-plugins-template" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/commands/templates", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + + # icinga also returns normal objects when querying templates, + # we need to filter these + filtered_list = [ + i + for i in object_list["data"]["objects"] + if i["object_type"] == "template" + ] + module.exit_json( + objects=filtered_list, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_deploy.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_deploy.py new file mode 100644 index 000000000..08abc7b4f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_deploy.py @@ -0,0 +1,119 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2023 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_deploy +short_description: Trigger deployment in Icinga2 +description: + - Trigger a deployment to Icinga2 through the director API. +author: Falk Händler (@flkhndlr) +version_added: '1.33.0' +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +""" + +EXAMPLES = """ +- name: Deploy the icinga config + telekom_mms.icinga_director.icinga_deploy: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" +""" + +RETURN = r""" +checksum: + description: + - Checksum of the configuration that should be rolled out + returned: always + type: str + sample: + checksum: 294bdfb53c4da471e37317beed549a953c939424 +""" + + +from time import sleep +from ansible.module_utils.urls import url_argument_spec +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) +# =========================================== +# Module execution. +# + + +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + + # add our own arguments + argument_spec.update( + url=dict(required=True), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=False, + ) + + # get the current deployment status + icinga_deploy_status = Icinga2APIObject(module=module, path="/config/deployment-status", data=[]) + + # if there is no existing deployment (e.g. on a new instance), there is no config object + if "config" in icinga_deploy_status.query_deployment()["data"]["active_configuration"]: + active_deployment = icinga_deploy_status.query_deployment()["data"]["active_configuration"]["config"] + else: + active_deployment = "" + + # execute the deployment + icinga_deployment = Icinga2APIObject(module=module, path="/config/deploy", data=[]) + result = icinga_deployment.create() + # the deployment is asynchronous and I don't know of a way to check if it is finished. + # so we need some sleep here. 2 seconds is a wild guess. + sleep(2) + + # get the new deployment status + create_deployment = icinga_deploy_status.query_deployment()["data"]["active_configuration"]["config"] + + # when the old checksum, the checksum to be created and the new checksum are the same, nothing changed + if result["data"]["checksum"] == active_deployment == create_deployment: + module.exit_json( + changed=False, + checksum=result["data"]["checksum"], + ) + # when the current and new deployment are the same, but the checksum to be created is different, the deployment failed + elif create_deployment == active_deployment: + module.fail_json(msg="deployment failed") + # in other cases the deployment succeeded and changed something + else: + module.exit_json( + changed=True, + checksum=result["data"]["checksum"], + ) + + +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_deploy_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_deploy_info.py new file mode 100644 index 000000000..c9d1bd149 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_deploy_info.py @@ -0,0 +1,140 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2023 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_deploy_info +short_description: Get deployment information through the director API +description: + - Get deployment information through the director API. +author: Falk Händler (@flkhndlr) +version_added: '1.33.0' +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +options: + configs: + description: + - A list of checksums of configs to query information for + type: list + elements: str + activities: + description: + - A list of checksums of activities to query information for + type: list + elements: str +""" + +EXAMPLES = """ +- name: Query the current deployment info in icinga + telekom_mms.icinga_director.icinga_deploy_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" +""" + +RETURN = r""" +active_configuration: + description: + - Checksums of the active configuration + - Contains current activity checksum, config checksum + - and a checksum for the stage_name + returned: if active configuration exists + type: dict + sample: + active_configuration: + activity: 3557598829f2a2fc4acc7b565fb54bae24754c67 + config: 299d9d49e03435c6de562c4b22a26e63990d30a9 + stage_name: 902cb282-e702-43ce-bb3c-962f850a1694 +configs: + description: + - Checksum of the requested config and its state + returned: only if requested + type: list + sample: + configs: + b175ca0562434deeb4fb1fc03fd80cd7361b56df: deployed + b175ca0562434deeb4fb1fc03fd80cd7361b56de: active +activities: + description: + - checksum of the requested activities and its state + returned: only if requested + type: list + sample: + activities: + a4c955364bc7b77efd0323fc87d95307f827e30c: deployed + 3557598829f2a2fc4acc7b565fb54bae24754c67: active +""" + +from ansible.module_utils.urls import url_argument_spec +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + + # add our own arguments + argument_spec.update( + url=dict(required=True), + configs=dict(type="list", required=False, default=None, elements="str"), + activities=dict(type="list", required=False, default=None, elements="str"), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/config/deployment-status", data=[]) + + object_list = icinga_object.query_deployment( + configs=module.params["configs"], activities=module.params["activities"] + ) + + config_list = {} + activity_list = {} + + if "configs" in object_list["data"].keys(): + config_list = dict(object_list["data"]["configs"].items()) + + if "activities" in object_list["data"].keys(): + activity_list = dict(object_list["data"]["activities"].items()) + + module.exit_json( + objects=object_list, + active_configuration=object_list["data"]["active_configuration"], + configs=config_list, + activities=activity_list + ) + + +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_endpoint.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_endpoint.py new file mode 100644 index 000000000..679abff7e --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_endpoint.py @@ -0,0 +1,168 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_endpoint +short_description: Manage endpoints in Icinga2 +description: + - Add or remove an endpoint to Icinga2 through the director API. +author: Aaron Bulmahn (@arbu) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.5.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Icinga object name for this endpoint. + - This is usually a fully qualified host name but it could basically be any kind of string. + - To make things easier for your users we strongly suggest to use meaningful names for templates. + - For example "generic-endpoint" is ugly, "Standard Linux Server" is easier to understand. + required: true + aliases: ['name'] + type: str + host: + description: + - The hostname/IP address of the remote Icinga 2 instance. + type: str + port: + description: + - The service name/port of the remote Icinga 2 instance. Defaults to 5665. + type: int + log_duration: + description: + - Duration for keeping replay logs on connection loss. Defaults to 1d (86400 seconds). + Attribute is specified in seconds. If log_duration is set to 0, replaying logs is disabled. + You could also specify the value in human readable format like 10m for 10 minutes or 1h for one hour. + type: str + zone: + description: + - The name of the zone this endpoint is part of. + type: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "fooendpoint" + host: "127.0.0.1" + zone: "foozone" + +- name: Update an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "fooendpoint" + host: "127.0.0.1" + zone: "foozone" + port: 5665 + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + host=dict(required=False), + port=dict(required=False, type="int"), + log_duration=dict(required=False), + zone=dict(required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "host", + "port", + "log_duration", + "zone", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject(module=module, path="/endpoint", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_endpoint_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_endpoint_info.py new file mode 100644 index 000000000..a125ecdff --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_endpoint_info.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_endpoint_info +short_description: Query endpoints in Icinga2 +description: + - Get a list of endpoint objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query an endpoint in icinga + telekom_mms.icinga_director.icinga_endpoint_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooendpoint" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/endpoints", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host.py new file mode 100644 index 000000000..655c1d5e9 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host.py @@ -0,0 +1,445 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_host +short_description: Manage hosts in Icinga2 +description: + - Add or remove a host to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + accept_config: + choices: + - true + - false + description: + - Whether the agent is configured to accept config. + type: bool + version_added: 1.9.0 + address: + description: + - Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with. + type: str + address6: + description: + - Host IPv6 address. Usually an IPv6 address, but may be any kind of address your check plugin is able to deal with. + type: str + version_added: 1.4.0 + append: + choices: + - true + - false + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + version_added: 1.25.0 + check_command: + description: + - The name of the check command. + - Though this is not required to be defined in the director, you still have to supply a check_command in a host or host-template. + type: str + check_interval: + description: + - Your regular check interval. + type: str + check_period: + description: + - The name of a time period which determines when this object should be monitored. Not limited by default. + type: str + check_timeout: + description: + - Check command timeout in seconds. Overrides the CheckCommand's timeout attribute + type: str + command_endpoint: + description: + - The endpoint where commands are executed on. + type: str + disabled: + choices: + - true + - false + default: false + description: + - Disabled objects will not be deployed. + type: bool + display_name: + description: + - Alternative name for this host. Might be a host alias or and kind of string helping your users to identify this host. + type: str + enable_active_checks: + choices: + - true + - false + description: + - Whether to actively check this object. + type: bool + enable_event_handler: + choices: + - true + - false + description: + - Whether to enable event handlers this object. + type: bool + enable_flapping: + choices: + - true + - false + description: + - Whether flap detection is enabled on this object. + type: bool + enable_notifications: + choices: + - true + - false + description: + - Whether to send notifications for this object. + type: bool + enable_passive_checks: + choices: + - true + - false + description: + - Whether to accept passive check results for this object. + type: bool + enable_perfdata: + choices: + - true + - false + description: + - Whether to process performance data provided by this object. + type: bool + event_command: + description: + - Event command for host which gets called on every check execution if one of these conditions matches + - The host is in a soft state + - The host state changes into a hard state + - The host state recovers from a soft or hard state to OK/Up + type: str + flapping_threshold_high: + description: + - Flapping upper bound in percent for a service to be considered flapping + type: str + flapping_threshold_low: + description: + - Flapping lower bound in percent for a service to be considered not flapping + type: str + groups: + default: [] + description: + - Hostgroups that should be directly assigned to this node. Hostgroups can be useful for various reasons. + - You might assign service checks based on assigned hostgroup. They are also often used as an instrument to enforce restricted views in Icinga Web 2. + - Hostgroups can be directly assigned to single hosts or to host templates. + - You might also want to consider assigning hostgroups using apply rules. + elements: str + type: list + has_agent: + choices: + - true + - false + description: + - Whether this host has the Icinga 2 Agent installed. + type: bool + version_added: 1.9.0 + icon_image: + description: + - An URL pointing to an icon for this object. + - Try "tux.png" for icons relative to public/img/icons or "cloud" (no extension) for items from the Icinga icon font + type: str + icon_image_alt: + description: + - Alternative text to be shown in case above icon is missing + type: str + imports: + description: + - Choose a Host Template. Required when state is C(present). + - Required if I(state) is C(present). + elements: str + type: list + master_should_connect: + choices: + - true + - false + description: + - Whether the parent (master) node should actively try to connect to this agent. + type: bool + version_added: 1.9.0 + max_check_attempts: + description: + - Defines after how many check attempts a new hard state is reached. + type: str + notes: + description: + - Additional notes for this object. + type: str + version_added: 1.8.0 + notes_url: + description: + - An URL pointing to additional notes for this object. + - Separate multiple urls like this "'http://url1' 'http://url2'". + - Maximum length is 255 characters. + type: str + version_added: 1.8.0 + object_name: + aliases: + - name + description: + - Icinga object name for this host. + - This is usually a fully qualified host name but it could basically be any kind of string. + - To make things easier for your users we strongly suggest to use meaningful names for templates. + - For example "generic-host" is ugly, "Standard Linux Server" is easier to understand. + required: true + type: str + retry_interval: + description: + - Retry interval, will be applied after a state change unless the next hard state is reached. + type: str + state: + choices: + - present + - absent + default: present + description: + - Apply feature state. + type: str + vars: + description: + - Custom properties of the host. + type: dict + volatile: + choices: + - true + - false + description: + - Whether this check is volatile. + type: bool + zone: + description: + - Set the zone. + type: str +""" + +EXAMPLES = """ +- name: Create a host in icinga + telekom_mms.icinga_director.icinga_host: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + accept_config: true + address: "127.0.0.1" + address6: "::1" + check_command: hostalive + check_interval: 90s + check_timeout: 60 + command_endpoint: fooendpoint + disabled: false + display_name: "foohost" + enable_active_checks: true + enable_event_handler: false + enable_flapping: false + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + has_agent: true + icon_image_alt: "alt text" + icon_image: "http://url1" + master_should_connect: true + max_check_attempts: 3 + object_name: "foohost" + retry_interval: "1m" + volatile: false + groups: + - "foohostgroup" + imports: + - "foohosttemplate" + vars: + dnscheck: "no" + +- name: update a host in icinga + telekom_mms.icinga_director.icinga_host: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foohost" + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + accept_config=dict(type="bool", choices=[True, False]), + address=dict(required=False), + address6=dict(required=False), + append=dict(type="bool", choices=[True, False]), + check_command=dict(required=False), + check_interval=dict(required=False), + check_period=dict(type="str", required=False), + check_timeout=dict(type="str", required=False), + command_endpoint=dict(type="str", required=False), + disabled=dict(type="bool", default=False, choices=[True, False]), + display_name=dict(required=False), + enable_active_checks=dict( + type="bool", choices=[True, False], required=False + ), + enable_event_handler=dict( + type="bool", choices=[True, False], required=False + ), + enable_flapping=dict( + type="bool", choices=[True, False], required=False + ), + enable_notifications=dict( + type="bool", choices=[True, False], required=False + ), + enable_passive_checks=dict( + type="bool", choices=[True, False], required=False + ), + enable_perfdata=dict( + type="bool", choices=[True, False], required=False + ), + event_command=dict(type="str", required=False), + flapping_threshold_high=dict(type="str", required=False), + flapping_threshold_low=dict(type="str", required=False), + groups=dict(type="list", elements="str", default=[], required=False), + has_agent=dict(type="bool", choices=[True, False]), + icon_image_alt=dict(type="str", required=False), + icon_image=dict(type="str", required=False), + imports=dict(type="list", elements="str", required=False), + master_should_connect=dict(type="bool", choices=[True, False]), + max_check_attempts=dict(required=False), + notes_url=dict(type="str", required=False), + notes=dict(type="str", required=False), + object_name=dict(required=True, aliases=["name"]), + retry_interval=dict(required=False), + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + vars=dict(type="dict", default=None), + volatile=dict(type="bool", choices=[True, False], required=False), + zone=dict(required=False, default=None), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + # When deleting objects, only the name is necessary, so we cannot use + # required=True in the argument_spec. Instead we define here what is + # necessary when state is present and we do not append to an existing object + # We cannot use "required_if" here, because we rely on module.params. + # These are defined at the same time we'd define the required_if arguments. + if ( + module.params["state"] == "present" + and not module.params["append"] + and not (module.params["imports"]) + ): + module.fail_json(msg="missing required arguments: imports.") + + data_keys = [ + "accept_config", + "address", + "address6", + "check_command", + "check_interval", + "check_period", + "check_timeout", + "command_endpoint", + "disabled", + "display_name", + "enable_active_checks", + "enable_event_handler", + "enable_flapping", + "enable_notifications", + "enable_passive_checks", + "enable_perfdata", + "event_command", + "flapping_threshold_high", + "flapping_threshold_low", + "groups", + "has_agent", + "icon_image_alt", + "icon_image", + "imports", + "master_should_connect", + "max_check_attempts", + "notes_url", + "notes", + "object_name", + "retry_interval", + "vars", + "volatile", + "zone", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject(module=module, path="/host", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_info.py new file mode 100644 index 000000000..2a09e6395 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_info.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_host_info +short_description: Query hosts in Icinga2 +description: + - Get a list of host objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a host in icinga + telekom_mms.icinga_director.icinga_host_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohost" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/hosts", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_template.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_template.py new file mode 100644 index 000000000..20e97cf12 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_template.py @@ -0,0 +1,429 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_host_template +short_description: Manage host templates in Icinga2 +description: + - Add or remove a host template to Icinga2 through the director API. +author: Michaela Mattes (@michaelamattes) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.2.0' +notes: + - This module supports check mode. +options: + accept_config: + choices: + - true + - false + description: + - Whether the agent is configured to accept config. + type: bool + version_added: 1.9.0 + address: + description: + - Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with. + type: str + address6: + description: + - Host IPv6 address. Usually an IPv6 address, but may be any kind of address your check plugin is able to deal with. + type: str + append: + choices: + - true + - false + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + version_added: 1.25.0 + check_command: + description: + - The name of the check command. + - Though this is not required to be defined in the director, you still have to supply a check_command in a host or host-template. + type: str + check_interval: + description: + - Your regular check interval. + type: str + check_period: + description: + - The name of a time period which determines when this object should be monitored. Not limited by default. + type: str + check_timeout: + description: + - Check command timeout in seconds. Overrides the CheckCommand's timeout attribute + type: str + command_endpoint: + description: + - The endpoint where commands are executed on. + type: str + disabled: + choices: + - true + - false + default: false + description: + - Disabled objects will not be deployed. + type: bool + display_name: + description: + - Alternative name for this host. Might be a host alias or and kind of string helping your users to identify this host. + type: str + enable_active_checks: + choices: + - true + - false + description: + - Whether to actively check this object. + type: bool + enable_event_handler: + choices: + - true + - false + description: + - Whether to enable event handlers this object. + type: bool + enable_flapping: + choices: + - true + - false + description: + - Whether flap detection is enabled on this object. + type: bool + enable_notifications: + choices: + - true + - false + description: + - Whether to send notifications for this object. + type: bool + enable_passive_checks: + choices: + - true + - false + description: + - Whether to accept passive check results for this object. + type: bool + enable_perfdata: + choices: + - true + - false + description: + - Whether to process performance data provided by this object. + type: bool + event_command: + description: + - Event command for host which gets called on every check execution if one of these conditions matches + - The host is in a soft state + - The host state changes into a hard state + - The host state recovers from a soft or hard state to OK/Up + type: str + flapping_threshold_high: + description: + - Flapping upper bound in percent for a service to be considered flapping + type: str + flapping_threshold_low: + description: + - Flapping lower bound in percent for a service to be considered not flapping + type: str + groups: + default: [] + description: + - Hostgroups that should be directly assigned to this node. Hostgroups can be useful for various reasons. + - You might assign service checks based on assigned hostgroup. They are also often used as an instrument to enforce restricted views in Icinga Web 2. + - Hostgroups can be directly assigned to single hosts or to host templates. + - You might also want to consider assigning hostgroups using apply rules. + elements: str + type: list + has_agent: + choices: + - true + - false + description: + - Whether this host has the Icinga 2 Agent installed. + type: bool + version_added: 1.9.0 + icon_image: + description: + - An URL pointing to an icon for this object. + - Try "tux.png" for icons relative to public/img/icons or "cloud" (no extension) for items from the Icinga icon font + type: str + icon_image_alt: + description: + - Alternative text to be shown in case above icon is missing + type: str + imports: + description: + - Choose a host-template. + elements: str + type: list + master_should_connect: + choices: + - true + - false + description: + - Whether the parent (master) node should actively try to connect to this agent. + type: bool + version_added: 1.9.0 + max_check_attempts: + description: + - Defines after how many check attempts a new hard state is reached. + type: str + notes: + description: + - Additional notes for this object. + type: str + version_added: 1.8.0 + notes_url: + description: + - An URL pointing to additional notes for this object. + - Separate multiple urls like this "'http://url1' 'http://url2'". + - Maximum length is 255 characters. + type: str + version_added: 1.8.0 + object_name: + aliases: + - name + description: + - Icinga object name for this host template. + - This is usually a fully qualified host name but it could basically be any kind of string. + - To make things easier for your users we strongly suggest to use meaningful names for templates. + - For example "generic-host" is ugly, "Standard Linux Server" is easier to understand. + required: true + type: str + retry_interval: + description: + - Retry interval, will be applied after a state change unless the next hard state is reached. + type: str + state: + choices: + - present + - absent + default: present + description: + - Apply feature state. + type: str + vars: + description: + - Custom properties of the host. + type: dict + volatile: + choices: + - true + - false + description: + - Whether this check is volatile. + type: bool + zone: + description: + - Set the zone. + type: str +""" + +EXAMPLES = """ +- name: Create host template + telekom_mms.icinga_director.icinga_host_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + accept_config: true + check_command: hostalive + check_interval: 90s + check_timeout: 60 + command_endpoint: fooendpoint + disabled: false + display_name: foohosttemplate + enable_active_checks: true + enable_event_handler: false + enable_flapping: false + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + has_agent: true + icon_image_alt: "alt text" + icon_image: "http://url1" + master_should_connect: true + max_check_attempts: 3 + object_name: foohosttemplate + retry_interval: "1m" + volatile: false + groups: + - "foohostgroup" + imports: + - '' + vars: + dnscheck: "no" + +- name: Update host template + telekom_mms.icinga_director.icinga_host_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohosttemplate + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + accept_config=dict(type="bool", choices=[True, False]), + address=dict(required=False), + address6=dict(required=False), + append=dict(type="bool", choices=[True, False]), + check_command=dict(required=False), + check_interval=dict(required=False), + check_period=dict(type="str", required=False), + check_timeout=dict(type="str", required=False), + command_endpoint=dict(type="str", required=False), + disabled=dict(type="bool", default=False, choices=[True, False]), + display_name=dict(required=False), + enable_active_checks=dict( + type="bool", choices=[True, False], required=False + ), + enable_event_handler=dict( + type="bool", choices=[True, False], required=False + ), + enable_flapping=dict( + type="bool", choices=[True, False], required=False + ), + enable_notifications=dict( + type="bool", choices=[True, False], required=False + ), + enable_passive_checks=dict( + type="bool", choices=[True, False], required=False + ), + enable_perfdata=dict( + type="bool", choices=[True, False], required=False + ), + event_command=dict(type="str", required=False), + flapping_threshold_high=dict(type="str", required=False), + flapping_threshold_low=dict(type="str", required=False), + groups=dict(type="list", elements="str", default=[], required=False), + has_agent=dict(type="bool", choices=[True, False]), + icon_image_alt=dict(type="str", required=False), + icon_image=dict(type="str", required=False), + imports=dict(type="list", elements="str", required=False), + master_should_connect=dict(type="bool", choices=[True, False]), + max_check_attempts=dict(required=False), + notes_url=dict(type="str", required=False), + notes=dict(type="str", required=False), + object_name=dict(required=True, aliases=["name"]), + retry_interval=dict(required=False), + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + vars=dict(type="dict", default=None), + volatile=dict(type="bool", choices=[True, False], required=False), + zone=dict(required=False, default=None), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + data_keys = [ + "accept_config", + "address", + "address6", + "check_command", + "check_interval", + "check_period", + "check_timeout", + "command_endpoint", + "disabled", + "display_name", + "enable_active_checks", + "enable_event_handler", + "enable_flapping", + "enable_notifications", + "enable_passive_checks", + "enable_perfdata", + "event_command", + "flapping_threshold_high", + "flapping_threshold_low", + "groups", + "has_agent", + "icon_image_alt", + "icon_image", + "imports", + "master_should_connect", + "max_check_attempts", + "notes_url", + "notes", + "object_name", + "retry_interval", + "vars", + "volatile", + "zone", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "template" + + icinga_object = Icinga2APIObject(module=module, path="/host", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_template_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_template_info.py new file mode 100644 index 000000000..5d2b78a17 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_host_template_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_host_template_info +short_description: Query host templates in Icinga2 +description: + - Get a list of host template objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a host template in icinga + telekom_mms.icinga_director.icinga_host_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohosttemplate" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/hosts/templates", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_hostgroup.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_hostgroup.py new file mode 100644 index 000000000..81486f394 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_hostgroup.py @@ -0,0 +1,166 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_hostgroup +short_description: Manage hostgroups in Icinga2 +description: + - Add or remove a hostgroup to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Icinga object name for this hostgroup. + aliases: ['name'] + required: true + type: str + display_name: + description: + - An alternative display name for this group. + - If you wonder how this could be helpful just leave it blank. + type: str + assign_filter: + description: + - This allows you to configure an assignment filter. + - Please feel free to combine as many nested operators as you want. + type: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create hostgroup + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + display_name: foohostgroup + +- name: Update hostgroup + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + assign_filter: 'host.name="foohost"' + append: true + +- name: Update hostgroup using multiple contiditions in assign_filter + telekom_mms.icinga_director.icinga_hostgroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foohostgroup + assign_filter: 'host.vars.something="{{ your_var_here }}"|host.vars.something_else="anything"' + append: true + vars: + your_var_here: foo +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# + + +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + display_name=dict(required=False), + assign_filter=dict(required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "display_name", + "assign_filter", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject( + module=module, path="/hostgroup", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_hostgroup_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_hostgroup_info.py new file mode 100644 index 000000000..b47b6b388 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_hostgroup_info.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_hostgroup_info +short_description: Query hostgroups in Icinga2 +description: + - Get a list of hostgroup objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a hostgroup in icinga + telekom_mms.icinga_director.icinga_hostgroup_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foohostgroup" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/hostgroups", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification.py new file mode 100644 index 000000000..9d100ef75 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification.py @@ -0,0 +1,274 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_notification +short_description: Manage notifications in Icinga2 +description: + - Add or remove a notification to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) / Sebastian Gruber (sgruber94) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the notification. + aliases: ['name'] + required: true + type: str + notification_interval: + description: + - The notification interval (in seconds). This interval is used for active notifications. + - Defaults to 30 minutes. If set to 0, re-notifications are disabled. + type: str + types: + description: + - The state transition types you want to get notifications for. + type: "list" + elements: str + users: + description: + - Users that should be notified by this notification. + type: "list" + elements: str + states: + description: + - The host or service states you want to get notifications for. + type: "list" + elements: str + version_added: "1.9.0" + apply_to: + description: + - Whether this notification should affect hosts or services. + - Required if I(state) is C(present). + type: str + choices: ["host", "service"] + assign_filter: + description: + - The filter where the notification will take effect. + type: "str" + imports: + description: + - Importable templates, add as many as you want. Required when state is C(present). + - Please note that order matters when importing properties from multiple templates - last one wins. + - Required if I(state) is C(present). + type: "list" + elements: str + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + version_added: "1.9.0" + vars: + description: + - Custom properties of the notification. + type: "dict" + version_added: "1.9.0" + default: {} + period: + description: + - The name of a time period which determines when this notification should be triggered. + type: "str" + aliases: ['time_period'] + version_added: "1.15.0" + times_begin: + description: + - First notification delay. + - Delay unless the first notification should be sent. + type: "int" + version_added: "1.15.0" + times_end: + description: + - Last notification. + - When the last notification should be sent. + type: "int" + version_added: "1.15.0" + user_groups: + description: + - User Groups that should be notified by this notification. + type: "list" + elements: str + version_added: '1.16.0' + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create notification + telekom_mms.icinga_director.icinga_notification: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + apply_to: host + assign_filter: 'host.name="foohost"' + imports: + - foonotificationtemplate + notification_interval: '0' + object_name: E-Mail_host + states: + - Up + - Down + types: + - Problem + - Recovery + users: + - rb + user_groups: + - OnCall + disabled: false + time_period: "24/7" + times_begin: 20 + times_end: 120 + +- name: Update notification + telekom_mms.icinga_director.icinga_notification: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: E-Mail_host + vars: + foo: bar + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + imports=dict(type="list", elements="str", required=False), + apply_to=dict(choices=["service", "host"]), + assign_filter=dict(required=False), + disabled=dict( + type="bool", required=False, default=False, choices=[True, False] + ), + notification_interval=dict(required=False), + states=dict(type="list", elements="str", required=False), + users=dict(type="list", elements="str", required=False), + user_groups=dict(type="list", elements="str", required=False), + types=dict(type="list", elements="str", required=False), + vars=dict(type="dict", default={}, required=False), + period=dict(required=False, aliases=["time_period"]), + times_begin=dict(type="int", required=False), + times_end=dict(type="int", required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + # When deleting objects, only the name is necessary, so we cannot use + # required=True in the argument_spec. Instead we define here what is + # necessary when state is present and we do not append to an existing object + # We cannot use "required_if" here, because we rely on module.params. + # These are defined at the same time we'd define the required_if arguments. + if ( + module.params["state"] == "present" + and not module.params["append"] + and not (module.params["apply_to"] and module.params["imports"]) + ): + module.fail_json(msg="missing required arguments: imports.") + + data_keys = [ + "object_name", + "imports", + "apply_to", + "disabled", + "assign_filter", + "notification_interval", + "states", + "users", + "user_groups", + "types", + "vars", + "period", + "times_begin", + "times_end", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "apply" + + icinga_object = Icinga2APIObject( + module=module, path="/notification", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_info.py new file mode 100644 index 000000000..cab1a4267 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_notification_info +short_description: Query notifications in Icinga2 +description: + - Get a list of notification objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a notification in icinga + telekom_mms.icinga_director.icinga_notification_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "E-Mail_host" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/notifications/applyrules", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_template.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_template.py new file mode 100644 index 000000000..15d06d06f --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_template.py @@ -0,0 +1,227 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_notification_template +short_description: Manage notification templates in Icinga2 +description: + - Add or remove a notification template to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) / Sebastian Gruber (sgruber94) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: "1.9.0" +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the notification template. + aliases: ['name'] + required: true + type: str + notification_interval: + description: + - The notification interval (in seconds). This interval is used for active notifications. + - Defaults to 30 minutes. If set to 0, re-notifications are disabled. + type: str + types: + description: + - The state transition types you want to get notifications for. + type: "list" + elements: str + states: + description: + - The host or service states you want to get notifications for. + type: "list" + elements: str + times_begin: + description: + - First notification delay. + - Delay unless the first notification should be sent. + type: "int" + times_end: + description: + - Last notification. + - When the last notification should be sent. + type: "int" + zone: + description: + - Set the zone. + type: str + period: + description: + - The name of a time period which determines when this notification should be triggered. + type: "str" + aliases: ['time_period'] + version_added: "1.15.0" + command: + description: + - Check command definition + type: "str" + aliases: ['notification_command'] + version_added: "1.15.0" + users: + description: + - Users that should be notified by this notification + type: "list" + elements: str + version_added: "1.15.0" + user_groups: + description: + - User Groups that should be notified by this notification. + type: "list" + elements: str + version_added: '1.16.0' + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create notification template + telekom_mms.icinga_director.icinga_notification_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foonotificationtemplate + states: + - Up + - Down + types: + - Problem + - Recovery + times_begin: 20 + times_end: 120 + time_period: "24/7" + notification_command: "mail-host-notification" + users: + - "rb" + user_groups: + - "OnCall" + zone: "foozone" + +- name: Update notification template + telekom_mms.icinga_director.icinga_notification_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: foonotificationtemplate + notification_interval: '0' + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + notification_interval=dict(required=False), + states=dict(type="list", elements="str", required=False), + times_begin=dict(type="int", required=False), + times_end=dict(type="int", required=False), + types=dict(type="list", elements="str", required=False), + zone=dict(required=False, default=None), + period=dict(required=False, aliases=["time_period"]), + command=dict(required=False, aliases=["notification_command"]), + users=dict(type="list", elements="str", required=False), + user_groups=dict(type="list", elements="str", required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + data_keys = [ + "object_name", + "notification_interval", + "states", + "times_begin", + "times_end", + "types", + "zone", + "period", + "command", + "users", + "user_groups", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "template" + + icinga_object = Icinga2APIObject( + module=module, path="/notification", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_template_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_template_info.py new file mode 100644 index 000000000..551cba5e2 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_notification_template_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_notification_template_info +short_description: Query notification templates in Icinga2 +description: + - Get a list of notification template objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a notification template in icinga + telekom_mms.icinga_director.icinga_notification_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foonotificationtemplate" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/notifications/templates", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_scheduled_downtime.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_scheduled_downtime.py new file mode 100644 index 000000000..40b9cee8b --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_scheduled_downtime.py @@ -0,0 +1,269 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_scheduled_downtime +short_description: Manage downtimes in Icinga2 +description: + - Add or remove a downtime to Icinga2 through the director API. +author: Daniel Uhlmann (@xFuture603) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.25.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Icinga object name for this downtime. + aliases: ['name'] + required: true + type: str + disabled: + description: + - Disabled objects will not be deployed. + default: false + type: bool + choices: [true, false] + author: + description: + - Name of the downtime author. + - Required if I(state) is C(present). + type: str + comment: + description: + - A descriptive comment for the downtime. + - Required if I(state) is C(present). + type: str + fixed: + description: + - Whether this downtime is fixed or flexible. + If unsure please check the related documentation https://icinga.com/docs/icinga2/latest/doc/08-advanced-topics/#downtimes + - Required if I(state) is C(present). + type: bool + choices: [true, false] + default: false + with_services: + description: + - Whether you only downtime the hosts or add some services with it. + type: bool + choices: [true, false] + default: true + ranges: + description: + - The period which should be downtimed + type: dict + default: {} + apply_to: + description: + - Whether this dependency should affect hosts or services + - Required if I(state) is C(present). + type: str + choices: ["host", "service"] + assign_filter: + description: + - The filter where the downtime will take effect. + type: str + duration: + description: + - How long the downtime lasts. + Only has an effect for flexible (non-fixed) downtimes. + Time in seconds, supported suffixes include ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). + To express "90 minutes" you might want to write 1h 30m + type: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: create icinga_scheduled_downtime + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + disabled: false + object_name: "foodowntime" + state: present + author: testuser + comment: test + fixed: true + with_services: true + apply_to: host + assign_filter: 'host.name="foohost"' + duration: 500 + ranges: + "tuesday": "00:00-24:00" + +- name: create icinga_scheduled_downtime2 + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + disabled: false + object_name: "foodowntime2" + state: present + author: testuser + comment: test + fixed: false + with_services: false + apply_to: host + assign_filter: 'host.name="foohost"' + duration: 500 + ranges: + "tuesday": "00:00-24:00" + +- name: update icinga_scheduled_downtime2 + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foodowntime2" + state: present + duration: 1000 + append: true + apply_to: host + with_services: false +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + disabled=dict(type="bool", default=False, choices=[True, False]), + apply_to=dict(choices=["host", "service"]), + assign_filter=dict(required=False), + author={}, + comment={}, + duration=dict(required=False), + fixed=dict(type="bool", choices=[True, False], default=False), + ranges=dict(type="dict", required=False, default={}), + with_services=dict(type="bool", default=True, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + # Icinga expects 'y' or 'n' instead of booleans for option "with_services" + if module.params["with_services"]: + _withservices = "y" + else: + _withservices = "n" + + # Icinga expects 'yes' or 'no' instead of booleans for option "fixed" + if module.params["fixed"]: + _fixed = "y" + else: + _fixed = "n" + + # When deleting objects, only the name is necessary, so we cannot use + # required=True in the argument_spec. Instead we define here what is + # necessary when state is present and we do not append to an existing object + # We cannot use "required_if" here, because we rely on module.params. + # These are defined at the same time we'd define the required_if arguments. + if ( + module.params["state"] == "present" + and not module.params["append"] + and not ( + module.params["apply_to"] + and module.params["author"] + and module.params["comment"] + and _fixed in ("y", "n") + ) + ): + module.fail_json( + msg="missing required arguments: apply_to, author, comment, fixed." + ) + + data_keys = [ + "object_name", + "disabled", + "apply_to", + "assign_filter", + "author", + "comment", + "duration", + "ranges", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "apply" + data["fixed"] = _fixed + data["with_services"] = _withservices + + icinga_object = Icinga2APIObject( + module=module, path="/scheduled-downtime", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service.py new file mode 100644 index 000000000..db3a8c08e --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service.py @@ -0,0 +1,409 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_service +short_description: Manage services in Icinga2 +description: + - Add or remove a service to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the service. + aliases: ['name'] + required: true + type: str + check_command: + description: + - Check command definition. + type: str + check_interval: + description: + - Your regular check interval. + type: str + check_period: + description: + - The name of a time period which determines when this object should be monitored. Not limited by default. + type: str + check_timeout: + description: + - Check command timeout in seconds. Overrides the CheckCommand's timeout attribute. + type: str + display_name: + description: + - Alternative name for this service. + type: str + enable_active_checks: + description: + - Whether to actively check this object. + type: "bool" + enable_event_handler: + description: + - Whether to enable event handlers this object. + type: "bool" + enable_notifications: + description: + - Whether to send notifications for this object. + type: "bool" + enable_passive_checks: + description: + - Whether to accept passive check results for this object. + type: "bool" + enable_perfdata: + description: + - Whether to process performance data provided by this object. + type: "bool" + groups: + description: + - Service groups that should be directly assigned to this service. + - Servicegroups can be useful for various reasons. + - They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions. + - Service groups can be directly assigned to single services or to service templates. + type: "list" + elements: "str" + default: [] + host: + description: + - Choose the host this single service should be assigned to. + - This field will be required when `service_set` is not defined. + required: false + type: "str" + imports: + description: + - Importable templates, add as many as you want. + - Please note that order matters when importing properties from multiple templates - last one wins. + type: "list" + elements: "str" + default: [] + max_check_attempts: + description: + - Defines after how many check attempts a new hard state is reached. + type: str + notes: + description: + - Additional notes for this object. + type: str + version_added: '1.8.0' + notes_url: + description: + - An URL pointing to additional notes for this object. + - Separate multiple urls like this "'http://url1' 'http://url2'". + - Maximum length is 255 characters. + type: str + version_added: '1.8.0' + retry_interval: + description: + - Retry interval, will be applied after a state change unless the next hard state is reached. + type: str + use_agent: + description: + - Whether the check command for this service should be executed on the Icinga agent. + type: "bool" + vars: + description: + - Custom properties of the service. + type: "dict" + default: {} + volatile: + description: + - Whether this check is volatile. + type: "bool" + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' + service_set: + description: + - Choose the service set name this single service should be assigned to. + - This field will be required when `host` is not defined. + type: str + version_added: '1.29.0' +""" + +EXAMPLES = """ +- name: Create service + tags: service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service" + display_name: "foo service" + check_command: hostalive + use_agent: false + host: foohost + vars: + procs_argument: consul + procs_critical: '1:' + procs_warning: '1:' + +- name: Update service + tags: service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service" + display_name: "foo service" + host: foohost + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true + +- name: Create serviceset service + telekom_mms.icinga_director.icinga_service: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo service serviceset" + service_set: "foo_serviceset" +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible.module_utils.common.text.converters import to_text +from ansible.module_utils.six.moves.urllib.parse import quote as urlquote +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) +import json +from collections import defaultdict + + +class IcingaServiceObject(Icinga2APIObject): + module = None + + def __init__(self, module, path, data): + super(IcingaServiceObject, self).__init__(module, path, data) + self.module = module + self.params = module.params + self.path = path + self.data = data + self.object_id = None + # set url parameters when service is assigned to a host + if "host" in self.data: + if self.data["host"]: + param_service_type = "host=" + param_service_type_filter = to_text(urlquote(self.data["host"])) + # set url parameters when service is assigned to a serviceset + if "service_set" in self.data: + if self.data["service_set"]: + param_service_type = "set=" + param_service_type_filter = to_text( + urlquote(self.data["service_set"]) + ) + + self.url = ( + "/service" + + "?" + + "name=" + + to_text(urlquote(self.data["object_name"])) + + "&" + + param_service_type + + param_service_type_filter + ) + + def exists(self, find_by="name"): + ret = super(IcingaServiceObject, self).call_url(path=self.url) + self.object_id = to_text(urlquote(self.data["object_name"])) + if ret["code"] == 200: + return True + return False + + def delete(self, find_by="name"): + return super(IcingaServiceObject, self).call_url( + path=self.url, + method="DELETE", + ) + + def modify(self, find_by="name"): + return super(IcingaServiceObject, self).call_url( + path=self.url, + data=self.module.jsonify(self.data), + method="POST", + ) + + def diff(self, find_by="name"): + ret = super(IcingaServiceObject, self).call_url( + path=self.url, + method="GET", + ) + + data_from_director = json.loads(self.module.jsonify(ret["data"])) + data_from_task = json.loads(self.module.jsonify(self.data)) + + diff = defaultdict(dict) + for key, value in data_from_director.items(): + value = self.scrub_diff_value(value) + if key in data_from_task.keys() and value != data_from_task[key]: + diff["before"][key] = "{val}".format(val=value) + diff["after"][key] = "{val}".format(val=data_from_task[key]) + + return diff + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + disabled=dict(type="bool", default=False, choices=[True, False]), + check_command=dict(required=False), + check_interval=dict(required=False), + check_period=dict(required=False), + check_timeout=dict(required=False), + display_name=dict(required=False), + enable_active_checks=dict(type="bool", required=False), + enable_event_handler=dict(type="bool", required=False), + enable_notifications=dict(type="bool", required=False), + enable_passive_checks=dict(type="bool", required=False), + enable_perfdata=dict(type="bool", required=False), + host=dict(type="str", required=False), + groups=dict(type="list", elements="str", default=[], required=False), + imports=dict(type="list", elements="str", default=[], required=False), + max_check_attempts=dict(required=False), + notes=dict(type="str", required=False), + notes_url=dict(type="str", required=False), + retry_interval=dict(required=False), + service_set=dict(type="str", required=False), + use_agent=dict(type="bool", required=False), + vars=dict(type="dict", default={}, required=False), + volatile=dict(type="bool", required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "disabled", + "check_command", + "check_interval", + "check_period", + "check_timeout", + "display_name", + "enable_active_checks", + "enable_event_handler", + "enable_notifications", + "enable_passive_checks", + "enable_perfdata", + "groups", + "host", + "imports", + "max_check_attempts", + "notes", + "notes_url", + "retry_interval", + "service_set", + "use_agent", + "vars", + "volatile", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + # Only one of "service_set" or "host" needs to be present at the + # same time so we cannot use required=True in the argument_spec. + # Instead we define here that only one of the two parameters is defined at the same time. + if ( + module.params["state"] == "present" + and not module.params["append"] + and module.params["host"] + and module.params["service_set"] + ): + module.fail_json( + msg="Only one of the properties host or service_set can be defined within the same object." + ) + + if ( + module.params["state"] == "present" + and not module.params["append"] + and not module.params["host"] + and not module.params["service_set"] + ): + module.fail_json( + msg="One of the properties host or service_set is required." + ) + + icinga_object = IcingaServiceObject( + module=module, path="/service", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_apply.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_apply.py new file mode 100644 index 000000000..e5b5cba2d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_apply.py @@ -0,0 +1,365 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_service_apply +short_description: Manage service apply rules in Icinga2 +description: + - Add or remove a service apply rule to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name for the Icinga service apply rule. + aliases: ['name'] + required: true + type: str + display_name: + description: + - Alternative displayed name of the service apply rule. + type: str + check_command: + description: + - Check command definition. + type: str + version_added: '1.7.0' + check_interval: + description: + - Your regular check interval. + required: false + type: str + check_period: + description: + - The name of a time period which determines when this object should be monitored. Not limited by default. + required: false + type: str + check_timeout: + description: + - Check command timeout in seconds. Overrides the CheckCommand's timeout attribute. + required: false + type: str + enable_active_checks: + description: + - Whether to actively check this object. + required: false + type: "bool" + enable_event_handler: + description: + - Whether to enable event handlers this object. + required: false + type: "bool" + enable_notifications: + description: + - Whether to send notifications for this object. + required: false + type: "bool" + enable_passive_checks: + description: + - Whether to accept passive check results for this object. + required: false + type: "bool" + enable_perfdata: + description: + - Whether to process performance data provided by this object. + required: false + type: "bool" + event_command: + description: + - Event command for service which gets called on every check execution if one of these conditions matches + - The service is in a soft state + - The service state changes into a hard state + - The service state recovers from a soft or hard state to OK/Up + required: false + type: str + max_check_attempts: + description: + - Defines after how many check attempts a new hard state is reached. + required: false + type: str + retry_interval: + description: + - Retry interval, will be applied after a state change unless the next hard state is reached. + required: false + type: str + groups: + description: + - Service groups that should be directly assigned to this service. + - Servicegroups can be useful for various reasons. + - They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions. + - Service groups can be directly assigned to single services or to service templates. + type: "list" + elements: str + default: [] + apply_for: + description: + - Evaluates the apply for rule for all objects with the custom attribute specified. + - For example selecting "host.vars.custom_attr" will generate "for (config in host.vars.array_var)" where "config" will be accessible through "$config$". + - Note - only custom variables of type "Array" are eligible. + type: str + assign_filter: + description: + - The filter where the service apply rule will take effect. + type: str + command_endpoint: + description: + - The host where the service should be executed on. + type: str + imports: + description: + - Importable templates, add as many as you want. + - Please note that order matters when importing properties from multiple templates - last one wins. + type: "list" + elements: str + vars: + description: + - Custom properties of the service apply rule. + type: "dict" + default: {} + notes: + description: + - Additional notes for this object. + type: str + notes_url: + description: + - An URL pointing to additional notes for this object. + - Separate multiple urls like this "'http://url1' 'http://url2'". + - Maximum length is 255 characters. + type: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Add service apply rule to icinga + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + assign_filter: 'host.name="foohost"' + check_command: hostalive + display_name: "dummy process" + check_interval: "10m" + check_period: "24/7" + check_timeout: "1m" + enable_active_checks: true + enable_event_handler: true + enable_notifications: true + enable_passive_checks: false + enable_perfdata: false + event_command: restart_httpd + max_check_attempts: "5" + retry_interval: "3m" + imports: + - fooservicetemplate + groups: + - fooservicegroup + vars: + http_address: "$address$" + http_port: "9080" + http_uri: "/ready" + http_string: "Ready" + http_expect: "Yes" + +- name: Add service apply rule with command_endpoint + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + assign_filter: 'host.name="foohost"' + check_command: hostalive + display_name: "dummy process" + check_interval: "10m" + check_period: "24/7" + check_timeout: "1m" + enable_active_checks: true + enable_event_handler: true + enable_notifications: true + enable_passive_checks: false + event_command: restart_httpd + max_check_attempts: "5" + retry_interval: "3m" + command_endpoint: "fooendpoint" + imports: + - fooservicetemplate + groups: + - fooservicegroup + +- name: Update service apply rule with command_endpoint + telekom_mms.icinga_director.icinga_service_apply: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "SERVICE_dummy" + enable_perfdata: true + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Icinga2 API class +# +class ServiceApplyRule(Icinga2APIObject): + def __init__(self, module, data): + path = "/service" + super(ServiceApplyRule, self).__init__(module, path, data) + + def exists(self): + ret = self.call_url(path="/serviceapplyrules") + if ret["code"] == 200: + for existing_rule in ret["data"]["objects"]: + if existing_rule["object_name"] == self.data["object_name"]: + self.object_id = existing_rule["id"] + return self.object_id + return False + + def delete(self): + return super(ServiceApplyRule, self).delete(find_by="id") + + def modify(self): + return super(ServiceApplyRule, self).modify(find_by="id") + + def diff(self): + return super(ServiceApplyRule, self).diff(find_by="id") + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + display_name=dict(required=False), + check_command=dict(required=False), + check_interval=dict(required=False), + check_period=dict(required=False), + check_timeout=dict(required=False), + enable_active_checks=dict(type="bool", required=False), + enable_event_handler=dict(type="bool", required=False), + enable_notifications=dict(type="bool", required=False), + enable_passive_checks=dict(type="bool", required=False), + enable_perfdata=dict(type="bool", required=False), + event_command=dict(type="str", required=False), + max_check_attempts=dict(required=False), + retry_interval=dict(required=False), + apply_for=dict(required=False), + assign_filter=dict(required=False), + command_endpoint=dict(required=False), + imports=dict(type="list", elements="str", required=False), + groups=dict(type="list", elements="str", default=[], required=False), + vars=dict(type="dict", default={}), + notes=dict(type="str", required=False), + notes_url=dict(type="str", required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "display_name", + "apply_for", + "check_command", + "check_interval", + "check_period", + "check_timeout", + "enable_active_checks", + "enable_event_handler", + "enable_notifications", + "enable_passive_checks", + "enable_perfdata", + "event_command", + "max_check_attempts", + "retry_interval", + "command_endpoint", + "assign_filter", + "imports", + "groups", + "vars", + "notes", + "notes_url", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "apply" + + icinga_object = ServiceApplyRule(module=module, data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_apply_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_apply_info.py new file mode 100644 index 000000000..7dc79efbd --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_apply_info.py @@ -0,0 +1,115 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_service_apply_info +short_description: Query service apply rules in Icinga2 +description: + - Get a list of service apply rule objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a service apply rule in icinga + telekom_mms.icinga_director.icinga_service_apply_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "SERVICE_dummy" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/services/applyrules", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_info.py new file mode 100644 index 000000000..8e1c436f3 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_info.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_service_info +short_description: Query services in Icinga2 +description: + - Get a list of service objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a service in icinga + telekom_mms.icinga_director.icinga_service_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foo service" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/services", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_template.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_template.py new file mode 100644 index 000000000..910accc68 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_template.py @@ -0,0 +1,327 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_service_template +short_description: Manage service templates in Icinga2 +description: + - Add or remove a service template to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the service template. + aliases: ['name'] + required: true + type: str + check_command: + description: + - Check command definition. + type: str + check_interval: + description: + - Your regular check interval. + type: str + check_period: + description: + - The name of a time period which determines when this object should be monitored. Not limited by default. + type: str + check_timeout: + description: + - Check command timeout in seconds. Overrides the CheckCommand's timeout attribute. + type: str + enable_active_checks: + description: + - Whether to actively check this object. + type: "bool" + enable_event_handler: + description: + - Whether to enable event handlers this object. + type: "bool" + enable_flapping: + description: + - Whether flap detection is enabled on this object. + type: bool + enable_notifications: + description: + - Whether to send notifications for this object. + type: "bool" + enable_passive_checks: + description: + - Whether to accept passive check results for this object. + type: "bool" + enable_perfdata: + description: + - Whether to process performance data provided by this object. + type: "bool" + event_command: + description: + - Event command for service which gets called on every check execution if one of these conditions matches + - The service is in a soft state + - The service state changes into a hard state + - The service state recovers from a soft or hard state to OK/Up + type: "str" + flapping_threshold_high: + description: + - Flapping upper bound in percent for a service to be considered flapping + type: str + flapping_threshold_low: + description: + - Flapping lower bound in percent for a service to be considered not flapping + type: str + groups: + description: + - Service groups that should be directly assigned to this service. + - Servicegroups can be useful for various reasons. + - They are helpful to provided service-type specific view in Icinga Web 2, either for custom dashboards or as an instrument to enforce restrictions. + - Service groups can be directly assigned to single services or to service templates. + type: "list" + elements: "str" + default: [] + icon_image: + description: + - An URL pointing to an icon for this object. + - Try "tux.png" for icons relative to public/img/icons or "cloud" (no extension) for items from the Icinga icon font + type: str + icon_image_alt: + description: + - Alternative text to be shown in case above icon is missing + type: str + imports: + description: + - Importable templates, add as many as you want. + - Please note that order matters when importing properties from multiple templates - last one wins. + type: "list" + elements: "str" + default: [] + max_check_attempts: + description: + - Defines after how many check attempts a new hard state is reached. + type: str + notes: + description: + - Additional notes for this object. + type: str + version_added: '1.8.0' + notes_url: + description: + - An URL pointing to additional notes for this object. + - Separate multiple urls like this "'http://url1' 'http://url2'". + - Maximum length is 255 characters. + type: str + version_added: '1.8.0' + retry_interval: + description: + - Retry interval, will be applied after a state change unless the next hard state is reached. + type: str + use_agent: + description: + - Whether the check command for this service should be executed on the Icinga agent. + type: "bool" + vars: + description: + - Custom properties of the service template. + type: "dict" + default: {} + volatile: + description: + - Whether this check is volatile. + type: "bool" + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create servicetemplate + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + enable_flapping: true + flapping_threshold_high: "30.0" + flapping_threshold_low: "25.0" + icon_image_alt: "alt text" + icon_image: "http://url1" + object_name: fooservicetemplate + use_agent: false + vars: + procs_argument: consul + procs_critical: '1:' + procs_warning: '1:' + +- name: Update servicetemplate + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicetemplate + notes: "example note" + notes_url: "'http://url1' 'http://url2'" + append: true + +- name: Create servicetemplate with event command + telekom_mms.icinga_director.icinga_service_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: apache_check_servicetemplate + use_agent: false + event_command: restart_httpd + notes: "example note" + notes_url: "'http://url1' 'http://url2'" +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + disabled=dict(type="bool", default=False, choices=[True, False]), + check_command=dict(required=False), + check_interval=dict(required=False), + check_period=dict(required=False), + check_timeout=dict(required=False), + enable_active_checks=dict(type="bool", required=False), + enable_event_handler=dict(type="bool", required=False), + enable_flapping=dict(type="bool", required=False), + enable_notifications=dict(type="bool", required=False), + enable_passive_checks=dict(type="bool", required=False), + enable_perfdata=dict(type="bool", required=False), + event_command=dict(type="str", required=False), + flapping_threshold_high=dict(type="str", required=False), + flapping_threshold_low=dict(type="str", required=False), + groups=dict(type="list", elements="str", default=[], required=False), + icon_image_alt=dict(type="str", required=False), + icon_image=dict(type="str", required=False), + imports=dict(type="list", elements="str", default=[], required=False), + max_check_attempts=dict(required=False), + notes=dict(type="str", required=False), + notes_url=dict(type="str", required=False), + retry_interval=dict(required=False), + use_agent=dict(type="bool", required=False), + vars=dict(type="dict", default={}, required=False), + volatile=dict(type="bool", required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "disabled", + "check_command", + "check_interval", + "check_period", + "check_timeout", + "enable_active_checks", + "enable_event_handler", + "enable_flapping", + "enable_notifications", + "enable_passive_checks", + "enable_perfdata", + "event_command", + "flapping_threshold_high", + "flapping_threshold_low", + "groups", + "icon_image_alt", + "icon_image", + "imports", + "max_check_attempts", + "notes", + "notes_url", + "retry_interval", + "use_agent", + "vars", + "volatile", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "template" + + icinga_object = Icinga2APIObject(module=module, path="/service", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_template_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_template_info.py new file mode 100644 index 000000000..22a54e269 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_service_template_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_service_template_info +short_description: Query service templates in Icinga2 +description: + - Get a list of service template objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a service template in icinga + telekom_mms.icinga_director.icinga_service_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooservicetemplate" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/services/templates", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_servicegroup.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_servicegroup.py new file mode 100644 index 000000000..c8b2d638e --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_servicegroup.py @@ -0,0 +1,154 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_servicegroup +short_description: Manage servicegroups in Icinga2 +description: + - Add or remove a servicegroup to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name for the Icinga servicegroup. + aliases: ['name'] + required: true + type: str + display_name: + description: + - An alternative display name for this group. + - If you wonder how this could be helpful just leave it blank. + type: str + assign_filter: + description: + - This allows you to configure an assignment filter. + - Please feel free to combine as many nested operators as you want. + type: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create servicegroup + telekom_mms.icinga_director.icinga_servicegroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicegroup + assign_filter: 'host.name="foo"' + +- name: Update servicegroup + telekom_mms.icinga_director.icinga_servicegroup: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: fooservicegroup + display_name: fooservicegroup + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# + + +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + display_name=dict(required=False), + assign_filter=dict(required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "display_name", + "assign_filter", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject( + module=module, path="/servicegroup", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_servicegroup_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_servicegroup_info.py new file mode 100644 index 000000000..aaa22ada7 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_servicegroup_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_servicegroup_info +short_description: Query servicegroups in Icinga2 +description: + - Get a list of servicegroup objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a servicegroup in icinga + telekom_mms.icinga_director.icinga_servicegroup_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "fooservicegroup" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/servicegroups", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_serviceset.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_serviceset.py new file mode 100644 index 000000000..074b5223d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_serviceset.py @@ -0,0 +1,151 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_serviceset +short_description: Manage servicesets in Icinga2 +description: + - Add or remove a serviceset to Icinga2 through the director API. +author: Heiko Neblung (@HeikoNeblung) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.29.0' +notes: + - This module supports check mode. +options: + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + assign_filter: + description: + - This allows you to configure an assignment filter. + - Please feel free to combine as many nested operators as you want. + type: str + description: + description: + - A meaningful description explaining your users what to expect when assigning this set of services. + type: str + object_name: + description: + - Icinga object name for this serviceset. + aliases: ['name'] + required: true + type: str + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str +""" + +EXAMPLES = """ +- name: Create serviceset + telekom_mms.icinga_director.icinga_serviceset: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo_serviceset" + assign_filter: 'host.name="foohost"' + description: "foo description" + +- name: Update serviceset + telekom_mms.icinga_director.icinga_serviceset: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foo_serviceset" + assign_filter: 'host.name="foohost2"' + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + append=dict(type="bool", choices=[True, False]), + assign_filter=dict(required=False), + description=dict(required=False), + object_name=dict(required=True, aliases=["name"]), + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "assign_filter", + "description", + "object_name", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "template" + + icinga_object = Icinga2APIObject( + module=module, path="/serviceSet", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod.py new file mode 100644 index 000000000..35529a4fb --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod.py @@ -0,0 +1,168 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_timeperiod +short_description: Manage timeperiods in Icinga2 +description: + - Add or remove a timeperiod to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the time period. + aliases: ['name'] + required: true + type: str + display_name: + description: + - Alternative name for this timeperiod. + type: str + imports: + description: + - Importable templates, add as many as you want. + - Please note that order matters when importing properties from multiple templates - last one wins. + type: list + elements: str + default: [] + ranges: + description: + - A dict of days and timeperiods. + type: dict + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create timeperiod + telekom_mms.icinga_director.icinga_timeperiod: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: '24/7' + imports: + - "timeperiod_template" + ranges: + monday: "00:00-23:59" + tuesday: "00:00-23:59" + wednesday: "00:00-23:59" + thursday: "00:00-23:59" + friday: "00:00-23:59" + saturday: "00:00-23:59" + sunday: "00:00-23:59" + +- name: Update timeperiod + telekom_mms.icinga_director.icinga_timeperiod: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: '24/7' + display_name: '24/7' + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + display_name=dict(required=False), + imports=dict(type="list", elements="str", default=[], required=False), + ranges=dict(type="dict", required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "display_name", + "imports", + "ranges", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject( + module=module, path="/timeperiod", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_info.py new file mode 100644 index 000000000..0031a06fb --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_timeperiod_info +short_description: Query timeperiods in Icinga2 +description: + - Get a list of timeperiod objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a timeperiod in icinga + telekom_mms.icinga_director.icinga_timeperiod_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "24/7" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/timeperiods", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_template.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_template.py new file mode 100644 index 000000000..bb73215ef --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_template.py @@ -0,0 +1,229 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_timeperiod_template +short_description: Manage timeperiod templates in Icinga2 +description: + - Add or remove a timeperiod template to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.17.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the time period. + aliases: ['name'] + required: true + type: str + display_name: + description: + - Alternative name for this timeperiod template. + type: str + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + imports: + description: + - Importable templates, add as many as you want. + - Please note that order matters when importing properties from multiple templates - last one wins. + type: list + elements: str + default: [] + includes: + description: + - Include other time periods into this. + type: list + elements: str + aliases: ["include_period"] + default: [] + excludes: + description: + - Exclude other time periods from this. + type: list + elements: str + aliases: ["exclude_period"] + default: [] + prefer_includes: + description: + - Whether to prefer timeperiods includes or excludes. Default to true. + type: bool + default: true + choices: [true, false] + ranges: + description: + - A dict of days and timeperiods. + type: dict + zone: + description: + - Set the zone. + type: str + update_method: + description: + - Define the update method. + type: str + default: "LegacyTimePeriod" + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create timeperiod template + telekom_mms.icinga_director.icinga_timeperiod_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "timeperiod_template" + imports: [] + disabled: false + prefer_includes: false + ranges: + monday: "00:00-23:59" + tuesday: "00:00-23:59" + wednesday: "00:00-23:59" + thursday: "00:00-23:59" + friday: "00:00-23:59" + saturday: "00:00-23:59" + sunday: "00:00-23:59" + update_method: "LegacyTimePeriod" + +- name: Update timeperiod template + telekom_mms.icinga_director.icinga_timeperiod_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "timeperiod_template" + display_name: "timeperiod template" + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + display_name=dict(required=False), + disabled=dict(type="bool", default=False, choices=[True, False]), + zone=dict(required=False, default=None), + imports=dict(type="list", elements="str", default=[], required=False), + ranges=dict(type="dict", required=False), + prefer_includes=dict(type="bool", default=True, choices=[True, False]), + excludes=dict( + type="list", + elements="str", + default=[], + required=False, + aliases=["exclude_period"], + ), + includes=dict( + type="list", + elements="str", + default=[], + required=False, + aliases=["include_period"], + ), + update_method=dict(required=False, default="LegacyTimePeriod"), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "display_name", + "disabled", + "zone", + "imports", + "ranges", + "prefer_includes", + "excludes", + "includes", + "update_method", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "template" + + icinga_object = Icinga2APIObject( + module=module, path="/timeperiod", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_template_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_template_info.py new file mode 100644 index 000000000..a5dd8658c --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_timeperiod_template_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_timeperiod_template_info +short_description: Query timeperiod templates in Icinga2 +description: + - Get a list of timeperiod template objects from Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.17.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a timeperiod template in icinga + telekom_mms.icinga_director.icinga_timeperiod_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "timeperiod_template" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/timeperiods/templates", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user.py new file mode 100644 index 000000000..f376aae8d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user.py @@ -0,0 +1,191 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_user +short_description: Manage users in Icinga2 +description: + - Add or remove a user to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the user. + aliases: ['name'] + required: true + type: str + display_name: + description: + - Alternative name for this user. + - In case your object name is a username, this could be the full name of the corresponding person. + type: str + imports: + description: + - Importable templates, add as many as you want. + - Please note that order matters when importing properties from multiple templates - last one wins. + type: list + elements: str + pager: + description: + - The pager address of the user. + type: str + period: + description: + - The name of a time period which determines when notifications to this User should be triggered. Not set by default. + type: str + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + email: + description: + - The Email address of the user. + type: str + groups: + description: + - User groups that should be directly assigned to this user. + - Groups can be useful for various reasons. You might prefer to send notifications to groups instead of single users. + type: list + elements: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create user + telekom_mms.icinga_director.icinga_user: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "rb" + pager: 'SIP/emergency' + period: '24/7' + email: "foouser@example.com" + imports: + - foousertemplate + groups: + - onCall + +- name: Update user + telekom_mms.icinga_director.icinga_user: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "rb" + display_name: "Rufbereitschaft" + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + display_name=dict(required=False), + disabled=dict(type="bool", default=False, choices=[True, False]), + imports=dict(type="list", elements="str", required=False), + email=dict(required=False), + pager=dict(required=False), + period=dict(required=False), + groups=dict(type="list", elements="str", required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "display_name", + "imports", + "disabled", + "email", + "pager", + "period", + "groups", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject(module=module, path="/user", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_group.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_group.py new file mode 100644 index 000000000..899a6ed04 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_group.py @@ -0,0 +1,153 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_user_group +short_description: Manage users groups in Icinga2 +description: + - Add or remove a user group to Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.16.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the user group. + aliases: ['name'] + required: true + type: str + display_name: + description: + - Alternative name for this user group. + - In case your object name is a username, this could be the full name of the corresponding person. + type: str + disabled: + description: + - Disabled objects will not be deployed. + type: bool + default: false + choices: [true, false] + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create user group + telekom_mms.icinga_director.icinga_user_group: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "onCall" + disabled: false + +- name: Update user group + telekom_mms.icinga_director.icinga_user_group: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "onCall" + display_name: "on call group" + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + display_name=dict(required=False), + disabled=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "display_name", + "disabled", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject( + module=module, path="/usergroup", data=data + ) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_group_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_group_info.py new file mode 100644 index 000000000..f463850af --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_group_info.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_user_group_info +short_description: Query user groups in Icinga2 +description: + - Get a list of user group objects from Icinga2 through the director API. +author: Sebastian Gumprich (@rndmh3ro) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.16.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a user group in icinga + telekom_mms.icinga_director.icinga_user_group_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "onCall" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/usergroups", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_info.py new file mode 100644 index 000000000..7b25c333c --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_info.py @@ -0,0 +1,112 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_user_info +short_description: Query users in Icinga2 +description: + - Get a list of user objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a user in icinga + telekom_mms.icinga_director.icinga_user_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "rb" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/users", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_template.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_template.py new file mode 100644 index 000000000..e74921104 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_template.py @@ -0,0 +1,165 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_user_template +short_description: Manage user templates in Icinga2 +description: + - Add or remove a user template to Icinga2 through the director API. +author: Lars Krahl (@mmslkr) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.0.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Name of the user template. + aliases: ['name'] + required: true + type: str + imports: + description: + - Importable templates, add as many as you want. + - Please note that order matters when importing properties from multiple templates - last one wins. + type: list + elements: str + default: [] + period: + description: + - The name of a time period which determines when notifications to this User should be triggered. Not set by default. + type: str + enable_notifications: + description: + - Whether to send notifications for this user. + type: bool + zone: + description: + - Set the zone. + type: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create user template + telekom_mms.icinga_director.icinga_user_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foousertemplate" + enable_notifications: false + period: '24/7' + zone: "foozone" + +- name: Update user template + telekom_mms.icinga_director.icinga_user_template: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foousertemplate" + enable_notifications: true + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + imports=dict(type="list", elements="str", default=[], required=False), + period=dict(required=False), + enable_notifications=dict(type="bool", required=False), + zone=dict(required=False, default=None), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "imports", + "period", + "enable_notifications", + "zone", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "template" + + icinga_object = Icinga2APIObject(module=module, path="/user", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_template_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_template_info.py new file mode 100644 index 000000000..6fa8e5e06 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_user_template_info.py @@ -0,0 +1,114 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_user_template_info +short_description: Query user templates in Icinga2 +description: + - Get a list of user template objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a user template in icinga + telekom_mms.icinga_director.icinga_user_template_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foousertemplate" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject( + module=module, path="/users/templates", data=[] + ) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + module.exit_json( + objects=object_list["data"]["objects"], + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_zone.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_zone.py new file mode 100644 index 000000000..f841675b0 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_zone.py @@ -0,0 +1,151 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_zone +short_description: Manage zones in Icinga2 +description: + - Add or remove a zone to Icinga2 through the director API. +author: Aaron Bulmahn (@arbu) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.5.0' +notes: + - This module supports check mode. +options: + state: + description: + - Apply feature state. + choices: [ "present", "absent" ] + default: present + type: str + object_name: + description: + - Icinga object name for this zone. + - This is usually a fully qualified host name but it could basically be any kind of string. + - To make things easier for your users we strongly suggest to use meaningful names for templates. + - For example "generic-zone" is ugly, "Standard Linux Server" is easier to understand. + aliases: ['name'] + required: true + type: str + is_global: + description: + - Whether configuration files for this zone should be synced to all endpoints. + default: false + type: bool + parent: + description: + - The name of the parent zone. + type: str + append: + description: + - Do not overwrite the whole object but instead append the defined properties. + - Note - Appending to existing vars, imports or any other list/dict is not possible. You have to overwrite the complete list/dict. + - Note - Variables that are set by default will also be applied, even if not set. + type: bool + choices: [true, false] + version_added: '1.25.0' +""" + +EXAMPLES = """ +- name: Create a zone in icinga + telekom_mms.icinga_director.icinga_zone: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foozone" + +- name: Update a zone in icinga + telekom_mms.icinga_director.icinga_zone: + state: present + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + object_name: "foozone" + parent: "master" + append: true +""" + +RETURN = r""" # """ + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + state=dict(default="present", choices=["absent", "present"]), + url=dict(required=True), + append=dict(type="bool", choices=[True, False]), + object_name=dict(required=True, aliases=["name"]), + is_global=dict(required=False, type="bool", default=False), + parent=dict(required=False), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + data_keys = [ + "object_name", + "is_global", + "parent", + ] + + data = {} + + if module.params["append"]: + for k in data_keys: + if module.params[k]: + data[k] = module.params[k] + else: + for k in data_keys: + data[k] = module.params[k] + + data["object_type"] = "object" + + icinga_object = Icinga2APIObject(module=module, path="/zone", data=data) + + changed, diff = icinga_object.update(module.params["state"]) + module.exit_json( + changed=changed, + diff=diff, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_zone_info.py b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_zone_info.py new file mode 100644 index 000000000..a31b542b3 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/plugins/modules/icinga_zone_info.py @@ -0,0 +1,127 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 T-Systems Multimedia Solutions GmbH +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: icinga_zone_info +short_description: Query zones in Icinga2 +description: + - Get a list of zone objects from Icinga2 through the director API. +author: Martin Schurz (@schurzi) +extends_documentation_fragment: + - ansible.builtin.url + - telekom_mms.icinga_director.common_options +version_added: '1.13.0' +notes: + - This module supports check mode. +options: + query: + description: + - Text to filter search results. + - The text is matched on object_name. + - Only objects containing this text will be returned in the resultset. + - Requires Icinga Director 1.8.0+, in earlier versions this parameter is ignored and all objects are returned. + required: false + type: str + default: "" + resolved: + description: + - Resolve all inherited object properties and omit templates in output. + type: bool + default: false + choices: [true, false] + external: + description: + - Also include external objects in output. + type: bool + default: false + choices: [true, false] +""" + +EXAMPLES = """ +- name: Query a zone in icinga + telekom_mms.icinga_director.icinga_zone_info: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + query: "foozone" +""" + +RETURN = r""" +objects: + description: + - A list of returned Director objects. + - The list contains all objects matching the query filter. + - If the filter does not match any object, the list will be empty. + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.urls import url_argument_spec +from ansible_collections.telekom_mms.icinga_director.plugins.module_utils.icinga import ( + Icinga2APIObject, +) + + +# =========================================== +# Module execution. +# +def main(): + # use the predefined argument spec for url + argument_spec = url_argument_spec() + # add our own arguments + argument_spec.update( + url=dict(required=True), + query=dict(type="str", required=False, default=""), + resolved=dict(type="bool", default=False, choices=[True, False]), + external=dict(type="bool", default=False, choices=[True, False]), + ) + + # Define the main module + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + icinga_object = Icinga2APIObject(module=module, path="/zones", data=[]) + + object_list = icinga_object.query( + query=module.params["query"], resolved=module.params["resolved"] + ) + + filtered_list = object_list["data"]["objects"] + + if not module.params["external"]: + filtered_list = [ + i for i in filtered_list if i["object_type"] != "external_object" + ] + + module.exit_json( + objects=filtered_list, + ) + + +# import module snippets +if __name__ == "__main__": + main() diff --git a/ansible_collections/telekom_mms/icinga_director/renovate.json b/ansible_collections/telekom_mms/icinga_director/renovate.json new file mode 100644 index 000000000..53669aa95 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/renovate.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "github>telekom-mms/.github:renovate-preset.json5" + ] +} diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/README.md b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/README.md new file mode 100644 index 000000000..d71b97c74 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/README.md @@ -0,0 +1,263 @@ +# Ansible Icinga + +This role is used to configure an Icinga Instance over its Icinga Director. + +## Installation + +* create a `requirements.yml`: + +```bash +--- +collections: + - name: telekom_mms.icinga_director + src: https://github.com/telekom_mms/ansible-collection-icinga-director + version: 1.2.2 +``` + +* install the collections: + +```bash +ansible-galaxy collection install -r requirements.yml -p collections/ +``` + +## Dependencies + +collections: +telekom_mms.icinga_director >= 1.2.2 + +## Role Variables + +| Variable | Required | Default | +| -------------------------------- | -------- | --------------------------- | +| **icinga** | +| url | yes | +| use_proxy | no | +| validate_certs | no | +| url_username | yes | +| url_password | yes | +| force_basic_auth | no | +| client_cert | no | +| client_key | no | +| **icinga_timeperiod** | +| icinga_timeperiods | no | [] | +| display_name | no | +| imports | no | +| ranges | no | +| **icinga_user_template** | +| icinga_user_templates | no | [] | +| imports | no | +| period | no | +| enable_notifications | no | +| **icinga_user** | +| icinga_users | no | [] | +| display_name | no | +| imports | yes | [] | +| pager | no | +| period | no | +| disabled | no | +| email | yes | null | +| **icinga_zone** | +| icinga_zones | no | [] | +| is_global | no | +| parent | no | +| **icinga_endpoint** | +| icinga_endpoints | no | [] | +| host | no | +| port | no | +| log_duration | no | +| zone | no | +| **icinga_hostgroup** | +| icinga_hostgroups | no | [] | +| display_name | no | +| assign_filter | no | `host.name="hostgroup.1-*"` | +| **icinga_host_template** | +| icinga_host_templates | no | [] | +| display_name | no | +| address | no | +| address6 | no | +| groups | no | +| check_command | no | +| check_interval | no | +| disabled | no | +| imports | no | +| zone | no | +| vars | no | +| notes | no | +| notes_url | no | +| **icinga_host** | +| icinga_hosts | no | [] | +| display_name | no | +| address | no | +| address6 | no | +| groups | no | +| disabled | no | +| imports | yes | [] | +| zone | no | +| vars | no | +| notes | no | +| notes_url | no | +| **icinga_command_template** | +| icinga_command_templates | no | [] | +| display_name | no | +| command | no | +| methods_execute | yes | PluginCheck | +| timeout | no | +| imports | no | +| disabled | no | +| zone | no | +| vars | no | +| arguments | no | +| **icinga_command** | +| icinga_commands | no | [] | +| command_type | yes | PluginCheck | +| disabled | yes | false | +| imports | no | +| zone | no | +| vars | no | +| **icinga_service** | +| icinga_services | no | [] | +| display_name | no | +| disabled | no | +| check_command | no | +| check_interval | no | +| check_period | no | +| check_timeout | no | +| enable_active_checks | no | +| enable_event_handler | no | +| enable_notifications | no | +| enable_passive_checks | no | +| enable_perfdata | no | +| groups | no | +| host | yes | +| imports | no | +| max_check_attempts | no | +| notes | no | +| notes_url | no | +| retry_interval | no | +| use_agent | no | +| vars | no | +| volatile | no | +| **icinga_service_template** | +| icinga_service_templates | no | [] | +| display_name | no | +| disabled | no | +| check_command | no | +| check_interval | no | +| check_period | no | +| check_timeout | no | +| enable_active_checks | no | +| enable_event_handler | no | +| enable_notifications | no | +| enable_passive_checks | no | +| enable_perfdata | no | +| groups | no | +| imports | no | +| max_check_attempts | no | +| notes | no | +| notes_url | no | +| retry_interval | no | +| use_agent | no | +| vars | no | +| volatile | no | +| **icinga_service_apply** | +| icinga_service_applys | no | [] | +| display_name | no | +| groups | no | +| apply_for | no | +| assign_filter | no | +| imports | no | +| vars | no | +| notes | no | +| notes_url | no | +| **icinga_servicegroup** | +| icinga_servicegroups | no | [] | +| display_name | no | +| assign_filter | no | +| **icinga_notification_template** | +| icinga_notification_templates | no | [] | +| notification_template_object | no | +| state | no | +| notification_interval | no | +| states | no | +| types | no | +| times_begin | no | +| times_end | no | +| timeperiod | no | +| users | no | +| user_groups | no | +| notification_command | no | +| imports | no | +| **icinga_notification** | +| icinga_notifications | no | [] | +| notification_interval | no | +| types | no | +| users | no | +| apply_to | no | +| assign_filter | no | +| imports | no | +| period | no | +| **icinga_scheduled_downtime** | +| icinga_scheduled_downtimes | no | [] | +| state | yes | present +| disabled | no | false +| assign_filter | no | +| apply_to | yes | +| author | yes | +| comment | yes | +| duration | no | +| fixed | yes | +| ranges | no | +| with_services | no | true + +## Example Playbook + +```bash +--- +- hosts: localhost + gather_facts: false + collections: + - telekom_mms.icinga_director + roles: + - ansible_icinga + vars: + icinga_url: "https://example.com" + icinga_user: "{{ icinga_user }}" + icinga_pass: "{{ icinga_pass }}" + icinga_timeperiods: + - timeperiod_object: + - "8x5" + ranges: + monday: "09:00-17:00" + tuesday: "09:00-17:00" + wednesday: "09:00-17:00" + thursday: "09:00-17:00" + friday: "09:00-17:00" + - timeperiod_object: + - "24x7" + ranges: + monday: "00:00-24:00" + tuesday: "00:00-24:00" + wednesday: "00:00-24:00" + thursday: "00:00-24:00" + friday: "00:00-24:00" + saturday: "00:00-24:00" + sunday: "00:00-24:00" + icinga_users: + - user_object: + - "service_abbreviation_email_24x7" + pager: "SIP/xxx" + email: "service_abbreviation@example.com" + - user_object: + - "service_abbreviation_8x5" + email: "service_abbreviation@example.com" + icinga_hostgroups: + - hostgroup_object: + - "service_abbreviation-environement" + - "service_abbreviation-environement-web" + icinga_hosts: + - host_object: + - "service_abbreviation-environement-web01" + icinga_scheduled_downtimes: + - scheduled_downtime_object: + - "service_abbreviation-environement-downtime01" +``` diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/defaults/main.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/defaults/main.yml new file mode 100644 index 000000000..9a9a68253 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/defaults/main.yml @@ -0,0 +1,58 @@ +--- +# icinga_timeperiod +icinga_timeperiods: [] + +# icinga_user_template +icinga_user_templates: [] + +# icinga_user +icinga_users: [] +icinga_user_imports: [] +icinga_user_disabled: false +icinga_user_email: null + +# icinga_endpoints +icinga_endpoints: [] + +# icinga_zone +icinga_zones: [] + +# icinga_hostgroup +icinga_hostgroups: [] + +# icinga_host_template +icinga_host_templates: [] + +# icinga_host +icinga_hosts: [] +icinga_host_imports: [] + +# icinga_command_template +icinga_command_templates: [] +icinga_command_template_command_type: PluginCheck + +# icinga_command +icinga_commands: [] +icinga_command_type: PluginCheck +icinga_command_disabled: false + +# icinga_service +icinga_services: [] + +# icinga_serviceset +icinga_servicesets: [] + +# icinga_service_template +icinga_service_templates: [] + +# icinga_service_apply +icinga_service_applies: [] + +# servicegroup +icinga_servicegroups: [] + +# icinga_notification +icinga_notifications: [] + +# icinga deploy +icinga_deploy_config: false diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/handlers/main.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/handlers/main.yml new file mode 100644 index 000000000..e83f67c03 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: Deploy the icinga config + telekom_mms.icinga_director.icinga_deploy: + url: "{{ icinga_url }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + when: icinga_deploy_config and icinga_deploy_config is defined + listen: config_deploy
\ No newline at end of file diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/meta/main.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/meta/main.yml new file mode 100644 index 000000000..a8a645323 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/meta/main.yml @@ -0,0 +1,10 @@ +--- +collections: + - telekom_mms.icinga_director +galaxy_info: + author: telekom_mms + description: icinga configuration + license: GPLv3 + min_ansible_version: 2.9 + galaxy_tags: + - icinga diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_command.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_command.yml new file mode 100644 index 000000000..23eea8e0c --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_command.yml @@ -0,0 +1,32 @@ +--- +# command.1 = command array +# command.0 = icinga_command attribute +- name: icinga_command + icinga_command: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ command.0.state | default(omit) }}" + command: "{{ command.0.command | default(omit) }}" + command_type: "{{ command.0.command_type | default(icinga_command_type) }}" + disabled: "{{ command.0.disabled | default(icinga_command_disabled) }}" + object_name: "{{ command.1 }}" + imports: "{{ command.0.imports | default(omit) }}" + timeout: "{{ command.0.timeout | default(omit) }}" + zone: "{{ command.0.zone | default(omit) }}" + vars: "{{ command.0.vars | default(omit) }}" + arguments: "{{ command.0.arguments | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_commands|subelements('command_object') }}" + loop_control: + loop_var: command + tags: command + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_command_template.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_command_template.yml new file mode 100644 index 000000000..85b2a0fae --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_command_template.yml @@ -0,0 +1,33 @@ +--- +# command_template.1 = command_template array +# command_template.0 = icinga_command_template attribute +- name: icinga_command_template + icinga_command_template: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ command_template.0.state | default(omit) }}" + object_name: "{{ command_template.1 }}" + display_name: "{{ command_template.0.display_name | default(omit) }}" + command: "{{ command_template.0.command | default(omit) }}" + command_type: "{{ command_template.0.command_type | default(icinga_command_template_command_type) }}" + timeout: "{{ command_template.0.timeout | default(omit) }}" + imports: "{{ command_template.0.imports | default(omit) }}" + disabled: "{{ command_template.0.disabled | default(omit) }}" + zone: "{{ command_template.0.zone | default(omit) }}" + vars: "{{ command_template.0.vars | default(omit) }}" + arguments: "{{ command_template.0.arguments | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_command_templates|subelements('command_template_object') }}" + loop_control: + loop_var: command_template + tags: command_template + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_endpoint.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_endpoint.yml new file mode 100644 index 000000000..7373398a0 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_endpoint.yml @@ -0,0 +1,28 @@ +--- +# endpoint.1 = endpoint array +# endpoint.0 = icinga_endpoint attribute +- name: icinga_endpoint + icinga_endpoint: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ endpoint.0.state | default(omit) }}" + object_name: "{{ endpoint.1 }}" + host: "{{ endpoint.0.host | default(omit) }}" + port: "{{ endpoint.0.port | default(omit) }}" + log_duration: "{{ endpoint.0.log_duration | default(omit) }}" + zone: "{{ endpoint.0.zone | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_endpoints|subelements('endpoint_object') }}" + loop_control: + loop_var: endpoint + tags: endpoint + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_host.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_host.yml new file mode 100644 index 000000000..8e4fb6cf8 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_host.yml @@ -0,0 +1,56 @@ +--- +# host.1 = host array +# host.0 = icinga_host attribute +- name: icinga_host + icinga_host: + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + state: "{{ host.0.state | default(omit) }}" + url_password: "{{ icinga_pass }}" + url_username: "{{ icinga_user }}" + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + accept_config: "{{ host.0.accept_config | default(omit) }}" + address: "{{ host.0.address | default(omit) }}" + address6: "{{ host.0.address6 | default(omit) }}" + check_command: "{{ host.0.check_command | default(omit) }}" + check_interval: "{{ host.0.check_interval | default(omit) }}" + check_period: "{{ host.0.check_period | default(omit) }}" + check_timeout: "{{ host.0.check_timeout | default(omit) }}" + command_endpoint: "{{ command_endpoint | default(omit) }}" + disabled: "{{ host.0.disabled | default(omit) }}" + display_name: "{{ host.0.display_name | default(omit) }}" + enable_active_checks: "{{ host.0.enable_active_checks | default(omit) }}" + enable_event_handler: "{{ host.0.enable_event_handler | default(omit) }}" + enable_flapping: "{{ host.0.enable_flapping | default(omit) }}" + enable_notifications: "{{ host.0.enable_notifications | default(omit) }}" + enable_passive_checks: "{{ host.0.enable_passive_checks | default(omit) }}" + enable_perfdata: "{{ host.0.enable_perfdata | default(omit) }}" + event_command: "{{ host.0.event_command | default(omit) }}" + flapping_threshold_high: "{{ host.0.flapping_threshold_high | default(omit) }}" + flapping_threshold_low: "{{ host.0.flapping_threshold_low | default(omit) }}" + groups: "{{ host.0.groups | default(omit) }}" + has_agent: "{{ host.0.has_agent | default(omit) }}" + icon_image_alt: "{{ host.0.icon_image_alt | default(omit) }}" + icon_image: "{{ host.0.icon_image | default(omit) }}" + imports: "{{ host.0.imports | default(icinga_host_imports) }}" + master_should_connect: "{{ host.0.master_should_connect | default(omit) }}" + max_check_attempts: "{{ host.0.max_check_attempts | default(omit) }}" + notes_url: "{{ host.0.notes_url | default(omit) }}" + notes: "{{ host.0.notes | default(omit) }}" + object_name: "{{ host.1 }}" + retry_interval: "{{ host.0.retry_interval | default(omit) }}" + vars: "{{ host.0.vars | default(omit) }}" + volatile: "{{ host.0.volatile | default(omit) }}" + zone: "{{ host.0.zone | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_hosts|subelements('host_object') }}" + loop_control: + loop_var: host + tags: host + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_host_template.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_host_template.yml new file mode 100644 index 000000000..bad32814d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_host_template.yml @@ -0,0 +1,55 @@ +--- +# host_template.1 = host_template array +# host_template.0 = icinga_host_template attribute +- name: icinga_host_template + icinga_host_template: + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + state: "{{ host.0.state | default(omit) }}" + url_password: "{{ icinga_pass }}" + url_username: "{{ icinga_user }}" + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + accept_config: "{{ host_template.0.accept_config | default(omit) }}" + address: "{{ host_template.0.address | default(omit) }}" + address6: "{{ host_template.0.address6 | default(omit) }}" + check_command: "{{ host_template.0.check_command | default(omit) }}" + check_interval: "{{ host_template.0.check_interval | default(omit) }}" + check_period: "{{ host_template.0.check_period | default(omit) }}" + check_timeout: "{{ host_template.0.check_timeout | default(omit) }}" + disabled: "{{ host_template.0.disabled | default(omit) }}" + display_name: "{{ host_template.0.display_name | default(omit) }}" + enable_active_checks: "{{ host_template.0.enable_active_checks | default(omit) }}" + enable_event_handler: "{{ host_template.0.enable_event_handler | default(omit) }}" + enable_flapping: "{{ host_template.0.enable_flapping | default(omit) }}" + enable_notifications: "{{ host_template.0.enable_notifications | default(omit) }}" + enable_passive_checks: "{{ host_template.0.enable_passive_checks | default(omit) }}" + enable_perfdata: "{{ host_template.0.enable_perfdata | default(omit) }}" + event_command: "{{ host_template.0.event_command | default(omit) }}" + flapping_threshold_high: "{{ host_template.0.flapping_threshold_high | default(omit) }}" + flapping_threshold_low: "{{ host_template.0.flapping_threshold_low | default(omit) }}" + groups: "{{ host_template.0.address | default(omit) }}" + has_agent: "{{ host_template.0.has_agent | default(omit) }}" + icon_image_alt: "{{ host_template.0.icon_image_alt | default(omit) }}" + icon_image: "{{ host_template.0.icon_image | default(omit) }}" + imports: "{{ host_template.0.imports | default(omit) }}" + master_should_connect: "{{ host_template.0.master_should_connect | default(omit) }}" + max_check_attempts: "{{ host_template.0.max_check_attempts | default(omit) }}" + notes_url: "{{ host_template.0.notes_url | default(omit) }}" + notes: "{{ host_template.0.notes | default(omit) }}" + object_name: "{{ host_template.1 }}" + retry_interval: "{{ host_template.0.retry_interval | default(omit) }}" + vars: "{{ host_template.0.vars | default(omit) }}" + volatile: "{{ host_template.0.volatile | default(omit) }}" + zone: "{{ host_template.0.zone | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_host_templates|subelements('host_template_object') }}" + loop_control: + loop_var: host_template + tags: host_template + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_hostgroup.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_hostgroup.yml new file mode 100644 index 000000000..45f825ece --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_hostgroup.yml @@ -0,0 +1,26 @@ +--- +# hostgroup.1 = hostgroup array +# hostgroup.0 = icinga_hostgroup attribute +- name: icinga_hostgroup + icinga_hostgroup: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ hostgroup.0.state | default(omit) }}" + object_name: "{{ hostgroup.1 }}" + display_name: "{{ hostgroup.0.display_name | default(omit) }}" + assign_filter: "{{ hostgroup.0.assign_filter | default('host.name=\"' + hostgroup.1 + '-*\"') }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_hostgroups|subelements('hostgroup_object') }}" + loop_control: + loop_var: hostgroup + tags: hostgroup + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_notification.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_notification.yml new file mode 100644 index 000000000..84f139907 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_notification.yml @@ -0,0 +1,34 @@ +--- +# notification.1 = notification array +# notification.0 = icinga_notification attribute +- name: icinga_notification + icinga_notification: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ notification.0.state | default(omit) }}" + object_name: "{{ notification.1 }}" + notification_interval: "{{ notification.0.notification_interval | default(omit) }}" + states: "{{ notification.0.states | default(omit) }}" + types: "{{ notification.0.types | default(omit) }}" + users: "{{ notification.0.users | default(omit) }}" + user_groups: "{{ notification.0.user_groups | default(omit) }}" + apply_to: "{{ notification.0.apply_to | default(omit) }}" + assign_filter: "{{ notification.0.assign_filter | default(omit) }}" + imports: "{{ notification.0.imports | default(omit) }}" + period: "{{ notification.0.period | default(omit) }}" + vars: "{{ notification.0.vars | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_notifications|subelements('notification_object') }}" + loop_control: + loop_var: notification + tags: notification + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_notification_template.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_notification_template.yml new file mode 100644 index 000000000..7afa26c0a --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_notification_template.yml @@ -0,0 +1,35 @@ +--- +# notification_template.1 = notification_template array +# notification_template.0 = icinga_notification_template attribute +- name: icinga_notification_template + icinga_notification_template: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + object_name: "{{ notification_template.1 }}" + state: "{{ notification_template.0.state | default(omit) }}" + notification_interval: "{{ notification_template.0.notification_interval | default(omit) }}" + states: "{{ notification_template.0.states | default(omit) }}" + types: "{{ notification_template.0.types | default(omit) }}" + times_begin: "{{ notification_template.0.times_begin | default(omit) }}" + times_end: "{{ notification_template.0.times_end | default(omit) }}" + time_period: "{{ notification_template.0.time_period | default(omit) }}" + users: "{{ notification_template.0.users | default(omit) }}" + user_groups: "{{ notification_template.0.user_groups | default(omit) }}" + notification_command: "{{ notification_template.0.notification_command | default(omit) }}" + imports: "{{ notification_template.0.imports | default(omit) }}" + zone: "{{ notification_template.0.zone | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_notification_templates|subelements('notification_template_object') }}" + loop_control: + loop_var: notification_template + tags: notification_template + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_scheduled_downtime.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_scheduled_downtime.yml new file mode 100644 index 000000000..c42f9e930 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_scheduled_downtime.yml @@ -0,0 +1,30 @@ +--- +- name: icinga_scheduled_downtime + telekom_mms.icinga_director.icinga_scheduled_downtime: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ downtime.0.state | default(omit) }}" + object_name: "{{ downtime.1 }}" + author: "{{ downtime.0.author }}" + comment: "{{ downtime.0.comment }}" + fixed: "{{ downtime.0.fixed }}" + with_services: "{{ downtime.0.with_services | default(omit) }}" + apply_to: "{{ downtime.0.apply_to }}" + assign_filter: "{{ downtime.0.assign_filter | default(omit) }}" + duration: "{{ downtime.0.duration | default(omit) }}" + ranges: "{{ downtime.0.ranges| default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_scheduled_downtimes|subelements('scheduled_downtime_object') }}" + loop_control: + loop_var: downtime + tags: downtime + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service.yml new file mode 100644 index 000000000..922bc00ce --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service.yml @@ -0,0 +1,45 @@ +--- +# service.1 = service array +# service.0 = icinga_service attribute +- name: icinga_service + icinga_service: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ service.0.state | default(omit) }}" + object_name: "{{ service.1 }}" + display_name: "{{ service.0.display_name | default(omit) }}" + disabled: "{{ service.0.disabled | default(omit) }}" + check_command: "{{ service.0.check_command | default(omit) }}" + check_interval: "{{ service.0.check_interval | default(omit) }}" + check_period: "{{ service.0.check_period | default(omit) }}" + check_timeout: "{{ service.0.check_timeout | default(omit) }}" + enable_active_checks: "{{ service.0.enable_active_checks | default(omit) }}" + enable_event_handler: "{{ service.0.enable_event_handler | default(omit) }}" + enable_notifications: "{{ service.0.enable_notifications | default(omit) }}" + enable_passive_checks: "{{ service.0.enable_passive_checks | default(omit) }}" + enable_perfdata: "{{ service.0.enable_perfdata | default(omit) }}" + groups: "{{ service.0.groups | default(omit) }}" + host: "{{ service.0.host | default(omit) }}" + imports: "{{ service.0.imports | default(omit) }}" + max_check_attempts: "{{ service.0.max_check_attempts | default(omit) }}" + notes: "{{ service.0.notes | default(omit) }}" + notes_url: "{{ service.0.notes_url | default(omit) }}" + retry_interval: "{{ service.0.retry_interval | default(omit) }}" + use_agent: "{{ service.0.use_agent | default(omit) }}" + vars: "{{ service.0.vars | default(omit) }}" + volatile: "{{ service.0.volatile | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_services|subelements('service_object') }}" + loop_control: + loop_var: service + tags: service + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service_apply.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service_apply.yml new file mode 100644 index 000000000..3437efc45 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service_apply.yml @@ -0,0 +1,45 @@ +--- +# service_apply.1 = service_apply array +# service_apply.0 = icinga_service_apply attribute +- name: icinga_service_apply + icinga_service_apply: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ service_apply.0.state | default(omit) }}" + object_name: "{{ service_apply.1 }}" + display_name: "{{ service_apply.0.display_name | default(service_apply.1) }}" + groups: "{{ service_apply.0.groups | default(omit) }}" + apply_for: "{{ service_apply.0.apply_for | default(omit) }}" + assign_filter: "{{ service_apply.0.assign_filter | default(omit) }}" + imports: "{{ service_apply.0.imports | default(omit) }}" + command_endpoint: "{{ service_apply.0.command_endpoint | default(omit) }}" + vars: "{{ service_apply.0.vars | default(omit) }}" + notes: "{{ service_apply.0.notes | default(omit) }}" + notes_url: "{{ service_apply.0.notes_url | default(omit) }}" + check_interval: "{{ service_apply.0.check_interval | default(omit) }}" + check_period: "{{ service_apply.0.check_period | default(omit) }}" + check_timeout: "{{ service_apply.0.check_timeout | default(omit) }}" + check_command: "{{ service_apply.0.check_command | default(omit) }}" + enable_active_checks: "{{ service_apply.0.enable_active_checks | default(omit) }}" + enable_event_handler: "{{ service_apply.0.enable_event_handler | default(omit) }}" + enable_notifications: "{{ service_apply.0.enable_notifications | default(omit) }}" + enable_passive_checks: "{{ service_apply.0.enable_passive_checks | default(omit) }}" + enable_perfdata: "{{ service_apply.0.enable_perfdata | default(omit) }}" + event_command: "{{ service_apply.0.event_command | default(omit) }}" + max_check_attempts: "{{ service_apply.0.max_check_attempts | default(omit) }}" + retry_interval: "{{ service_apply.0.retry_interval | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_service_applies|subelements('service_apply_object') }}" + loop_control: + loop_var: service_apply + tags: service_apply + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service_template.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service_template.yml new file mode 100644 index 000000000..0d4eae7cc --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_service_template.yml @@ -0,0 +1,46 @@ +--- +# service_template.1 = service_template array +# service_template.0 = icinga_service_template attribute +- name: icinga_service_template + icinga_service_template: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ service_template.0.state | default(omit) }}" + object_name: "{{ service_template.1 }}" + display_name: "{{ service_template.0.display_name | default(omit) }}" + disabled: "{{ service_template.0.disabled | default(omit) }}" + check_command: "{{ service_template.0.check_command | default(omit) }}" + check_interval: "{{ service_template.0.check_interval | default(omit) }}" + check_period: "{{ service_template.0.check_period | default(omit) }}" + check_timeout: "{{ service_template.0.check_timeout | default(omit) }}" + command_endpoint: "{{ service_template.0.command_endpoint | default(omit) }}" + enable_active_checks: "{{ service_template.0.enable_active_checks | default(omit) }}" + enable_event_handler: "{{ service_template.0.enable_event_handler | default(omit) }}" + enable_notifications: "{{ service_template.0.enable_notifications | default(omit) }}" + enable_passive_checks: "{{ service_template.0.enable_passive_checks | default(omit) }}" + enable_perfdata: "{{ service_template.0.enable_perfdata | default(omit) }}" + groups: "{{ service_template.0.groups | default(omit) }}" + imports: "{{ service_template.0.imports | default(omit) }}" + max_check_attempts: "{{ service_template.0.max_check_attempts | default(omit) }}" + notes: "{{ service_template.0.notes | default(omit) }}" + notes_url: "{{ service_template.0.notes_url | default(omit) }}" + retry_interval: "{{ service_template.0.retry_interval | default(omit) }}" + use_agent: "{{ service_template.0.use_agent | default(omit) }}" + vars: "{{ service_template.0.vars | default(omit) }}" + volatile: "{{ service_template.0.volatile | default(omit) }}" + event_command: "{{ service_template.0.event_command | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_service_templates|subelements('service_template_object') }}" + loop_control: + loop_var: service_template + tags: service_template + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_servicegroup.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_servicegroup.yml new file mode 100644 index 000000000..9ba5e40dc --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_servicegroup.yml @@ -0,0 +1,26 @@ +--- +# servicegroup.1 = servicegroup array +# servicegroup.0 = icinga_servicegroup attribute +- name: icinga_servicegroup + icinga_servicegroup: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ servicegroup.0.state | default(omit) }}" + object_name: "{{ servicegroup.1 }}" + display_name: "{{ servicegroup.0.display_name | default(omit) }}" + assign_filter: "{{ servicegroup.0.assign_filter | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_servicegroups|subelements('servicegroup_object') }}" + loop_control: + loop_var: servicegroup + tags: servicegroup + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_serviceset.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_serviceset.yml new file mode 100644 index 000000000..a609cca2d --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_serviceset.yml @@ -0,0 +1,26 @@ +--- +# serviceset.1 = serviceset array +# serviceset.0 = icinga_serviceset attribute +- name: icinga_serviceset + icinga_serviceset: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ service.0.state | default(omit) }}" + assign_filter: "{{ serviceset.0.assign_filter | default(omit)}}" + description: "{{ serviceset.0.description | default(omit)}}" + object_name: "{{ serviceset.1 }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_servicesets|subelements('serviceset_object') }}" + loop_control: + loop_var: serviceset + tags: serviceset + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_timeperiod.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_timeperiod.yml new file mode 100644 index 000000000..bfc702963 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_timeperiod.yml @@ -0,0 +1,27 @@ +--- +# timeperiod.1 = timeperiod array +# timeperiod.0 = icinga_timeperiod attribute +- name: icinga_timeperiod + icinga_timeperiod: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ timeperiod.0.state | default(omit) }}" + object_name: "{{ timeperiod.1 }}" + display_name: "{{ timeperiod.0.display_name | default(omit) }}" + imports: "{{ timeperiod.0.imports | default(omit) }}" + ranges: "{{ timeperiod.0.ranges | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_timeperiods|subelements('timeperiod_object') }}" + loop_control: + loop_var: timeperiod + tags: timeperiod + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_user.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_user.yml new file mode 100644 index 000000000..0d3552de9 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_user.yml @@ -0,0 +1,30 @@ +--- +# user.1 = user array +# user.0 = icinga_user attribute +- name: icinga_user + icinga_user: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ user.0.state | default(omit) }}" + object_name: "{{ user.1 }}" + display_name: "{{ user.0.display_name | default(omit) }}" + imports: "{{ user.0.imports | default(icinga_user_imports) }}" + pager: "{{ user.0.pager | default(omit) }}" + period: "{{ user.0.period | default(omit) }}" + disabled: "{{ user.0.disabled | default(omit) }}" + email: "{{ user.0.email | default(icinga_user_email) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_users|subelements('user_object') }}" + loop_control: + loop_var: user + tags: user + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_user_template.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_user_template.yml new file mode 100644 index 000000000..432472e6e --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_user_template.yml @@ -0,0 +1,28 @@ +--- +# user_template.1 = user_template array +# user_template.0 = icinga_user_template attribute +- name: icinga_user_template + icinga_user_template: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ user_template.0.state | default(omit) }}" + object_name: "{{ user_template.1 }}" + imports: "{{ user_template.0.imports | default(omit) }}" + period: "{{ user_template.0.period | default(omit) }}" + enable_notifications: "{{ user_template.0.enable_notifications | default(omit) }}" + zone: "{{ user_template.0.zone | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_user_templates|subelements('user_template_object') }}" + loop_control: + loop_var: user_template + tags: user_template + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_zone.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_zone.yml new file mode 100644 index 000000000..c907f3f87 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/icinga_zone.yml @@ -0,0 +1,26 @@ +--- +# zone.1 = zone array +# zone.0 = icinga_zone attribute +- name: icinga_zone + icinga_zone: + url: "{{ icinga_url }}" + use_proxy: "{{ icinga_use_proxy | default(omit) }}" + validate_certs: "{{ icinga_validate_certs | default(omit) }}" + url_username: "{{ icinga_user }}" + url_password: "{{ icinga_pass }}" + force_basic_auth: "{{ icinga_force_basic_auth | default(omit) }}" + client_cert: "{{ icinga_client_cert | default(omit) }}" + client_key: "{{ icinga_client_key | default(omit) }}" + state: "{{ zone.0.state | default(omit) }}" + object_name: "{{ zone.1 }}" + is_global: "{{ zone.0.is_global | default(omit) }}" + parent: "{{ zone.0.parent | default(omit) }}" + retries: 3 + delay: 3 + register: result + until: result is succeeded + loop: "{{ icinga_zones|subelements('zone_object') }}" + loop_control: + loop_var: zone + tags: zone + notify: config_deploy diff --git a/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/main.yml b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/main.yml new file mode 100644 index 000000000..24d16e370 --- /dev/null +++ b/ansible_collections/telekom_mms/icinga_director/roles/ansible_icinga/tasks/main.yml @@ -0,0 +1,90 @@ +--- +- name: icinga timeperiod configuration + include_tasks: icinga_timeperiod.yml + when: icinga_timeperiods is defined + tags: timeperiod + +- name: icinga user_template configuration + include_tasks: icinga_user_template.yml + when: icinga_user_templates is defined + tags: user_template + +- name: icinga user configuration + include_tasks: icinga_user.yml + when: icinga_users is defined + tags: user + +- name: icinga zone configuration + include_tasks: icinga_zone.yml + when: icinga_zones is defined + tags: zone + +- name: icinga endpoint configuration + include_tasks: icinga_endpoint.yml + when: icinga_endpoints is defined + tags: endpoint + +- name: icinga hostgroup configuration + include_tasks: icinga_hostgroup.yml + when: icinga_hostgroups is defined + tags: hostgroup + +- name: icinga host_template configuration + include_tasks: icinga_host_template.yml + when: icinga_host_templates is defined + tags: host_template + +- name: icinga host configuration + include_tasks: icinga_host.yml + when: icinga_hosts is defined + tags: host + +- name: icinga command_template configuration + include_tasks: icinga_command_template.yml + when: icinga_command_templates is defined + tags: command_template + +- name: icinga command configuration + include_tasks: icinga_command.yml + when: icinga_commands is defined + tags: command + +- name: icinga service_template configuration + include_tasks: icinga_service_template.yml + when: icinga_service_templates is defined + tags: service_template + +- name: icinga service_apply configuration + include_tasks: icinga_service_apply.yml + when: icinga_service_applies is defined + tags: service_apply + +- name: icinga servicegroup configuration + include_tasks: icinga_servicegroup.yml + when: icinga_servicegroups is defined + tags: servicegroup + +- name: icinga service configuration + include_tasks: icinga_service.yml + when: icinga_services is defined + tags: service + +- name: icinga serviceset configuration + include_tasks: icinga_serviceset.yml + when: icinga_servicesets is defined + tags: serviceset + +- name: icinga notification template configuration + include_tasks: icinga_notification_template.yml + when: icinga_notification_templates is defined + tags: notification_template + +- name: icinga notification configuration + include_tasks: icinga_notification.yml + when: icinga_notifications is defined + tags: notification + +- name: icinga downtime configuration + include_tasks: icinga_scheduled_downtime.yml + when: icinga_scheduled_downtimes is defined + tags: downtime |