My needs: Write a playbook which can install apache if the user wants to, while the playbook is running by typing yes or no.
hosts: slaves vars_prompt: - name: install_apache prompt: "Do yo want to install apache? (yes/no)?" tasks: - name: if 'yes' include_tasks: apache.yml when: install_apache == 'yes'
--- - name: apache install apt: name: apache2 state: present
These playbooks are integrated in a role folder "apache"
--- - import_tasks: apache_prompt.yml
My main playbook, which I use for installing some stuffs thanks to roles:
- hosts: slaves roles: - ntp - nmap - tcpdump - unattended-upgrades - apache
I only have trouble with the apache role.
I've got syntax error since I wrote my question. I tried to modify the
until now and i got this error: ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
--- - hosts: slaves vars_prompt: - name: "install_apache" prompt: "Do yo want to install apache? (yes/no)?" tasks: - include_tasks: apache.yml when: install_apache == 'yes'