Open ghost opened 7 years ago
The token can be picked up rather easily with a delegation of a shell command:
- name: Get setup token.
shell: 'icingacli setup token create | sed "s/.*token is: \(.*\)/\1/g"'
register: setup_token
delegate_to: "{{ server }}"
After this, the value can be accessed as: "{{ setup_token.stdout }}"
@Skeen thanks you for the code contribution , commit 68ff54e is based on your suggestion
I'm not convinced this issue should be closed yet, there's still the manual step which requires a web browser.
It might be better to pull the setup_token
from the /etc/icingaweb2/setup.token
file.
The steps to automate IcingaWeb2 setup are documented here. It would be nice to have a zero-touch install. However, I don't know how much work is needed to cover all possible setups.
I've managed to do it for Debian as a proof of concept. My playbook is far from 'viewable' at the moment, but it can be done. I've started to rewrite it based on that playbook. https://github.com/Icinga/ansible-playbooks/pull/101 is the first step.
The icinga2-ansible-web2-ui role is does not allow for a fully automated installation and requires manual intervention to finish the installation as indicated by the following message Now generate a token with 'icingacli setup token create' and go at http://IP//icingaweb2/setup to continue the installation