Icinga / ansible-icinga2

Ansible Role for Icinga 2
Apache License 2.0
50 stars 23 forks source link

Work in progress towards a more complete icinga2 ansible role #36

Closed kwisatz closed 5 years ago

kwisatz commented 5 years ago

This is not meant as a serious pull request, rather as a work in progress and base for discussion. It's vast (I can probably break it down into smaller chunks once we're talking) and it doesn't have any tests yet, but I'd like to see with you guys whether there are parts here that go into an acceptable direction and which parts you'd absolutely change (and suggestions on how to). Sometimes it's easier to criticize someone else's work than to get started oneself, so here's our chance ;)

What this can do so far is, on top of what it could do before:

I'll definitely need your help with jinja2 vertical and horizontal spacing. I've been pulling my hair out over that without coming to any really satisfying results.

Looking forward to your feedback.

kwisatz commented 5 years ago

As you can see, I changed a lot of things. Tests and documentation are still missing, and I have several ideas for improvements myself, but I think this could be a base for discussion.

kwisatz commented 5 years ago

I can't figure out how to get flake8 to run on my machine. How would I be able to figure out what goes wrong here ?

RUNNING HANDLER [ansible-icinga2 : start icinga2] ******************************
    fatal: [ubuntu16]: FAILED! => {"changed": false, "msg": "Unable to start service icinga2: Job for icinga2.service failed because the control process exited with error code. See \"systemctl status icinga2.service\" and \"journalctl -xe\" for details.\n"}
    fatal: [centos7]: FAILED! => {"changed": false, "msg": "Unable to start service icinga2: Job for icinga2.service failed because the control process exited with error code. See \"systemctl status icinga2.service\" and \"journalctl -xe\" for details.\n"}
kwisatz commented 5 years ago

I got molecule to work, I'll look into the failing tests.

kwisatz commented 5 years ago

The tests should pass now, but that's when I get idempotence failures. Even on the parts I haven't touched (e.g. setting constants):

ERROR: Idempotence test failed because of the following tasks:
* [centos7] => ansible-icinga2 : Manage Icinga 2 constants
* [ubuntu16] => ansible-icinga2 : Manage Icinga 2 constants
* [centos7] => ansible-icinga2 : Icinga 2 master - Create Api-Users config file
* [ubuntu16] => ansible-icinga2 : Icinga 2 master - Create Api-Users config file

I would greatly appreciate the help of someone more experienced with molecule/ansible. I don't see why these two task wouldn't be idempotent and molecule isn't outrageously verbose about it either.

kwisatz commented 5 years ago

I don't want to annoy everyone with frequent updates, so I'm going to close this and re-open once I have something that is complete (meaning including tests, docs and above all something that is passing tests).

Thanks for all the reviews so far!

P.S. Don't ask me why the travis job suddenly passes when I haven't changed anything about the idempotence issues…