I have a simple ansible
Playbook called setup.yml
which looks basically like this (simplified):
- hosts: my-server-to-setup
remote_user: [REDACTED]
become: yes
#vars_prompt:
# - name: "zbxusername"
# prompt: "Zabbix Username"
# private: no
# - name: "zbxpw"
# prompt: "Zabbix Passwort"
# private: yes
roles:
- basic
# - zabbix
The zabbix
role requires a username and a password to acccess the zabbix host server. The credentials differ, every user has his own account.
If I want to install the zabbix
role, I need to uncomment the vars_prompt
section because ansible
doesn't allow prompting from within a role.
Is there a better way to do this? The current way can possibly leave important variables undefined which would result in a playbook failure.