ansible-playbook

pause ansible playbook for user confirmation, whether to run rest tasks

岁酱吖の 提交于 2020-08-03 12:18:07
问题 I am running an ansible-playbook which have many tasks listed. All of them use to get run one by one, but I want to pause the playbook after a particular tasks to asks the user if he wants to continue running the rest of the tasks or exit. I have seen the pause module of ansible but couldn't see any example which asks users for yes or no which in turn continue or exit the ansible-playbook accordingly. 回答1: The pause module actually does exactly that. But it does not give you an option to

How to escape double and single quotes in YAML within the same string

房东的猫 提交于 2020-07-17 03:25:26
问题 I need to properly escape single and double quotes in an ansible playbook in order to set the environment variable. None of this works: - name: Set environment variable command: > export EXTRA_CONFIG=“'”{"client": {"subscriptions": ["DIND-Worker"], "cluster": "internal"}}“'” - name: Set environment variable command: > export EXTRA_CONFIG=''{"client": {"subscriptions": ["DIND-Worker"], "cluster": "internal"}}'' - name: Set environment variable command: > export EXTRA_CONFIG=''{\"client\": {\

Ansible - Using user input to chose a variable

时间秒杀一切 提交于 2020-07-07 04:35:20
问题 I would like to select a specific variable based on user input in an Ansible playbook. Specifically, I would like to ask for user input on a location of a server, and then execute a specific action based on the input. This is the current ansible playbook: - hosts: all remote_user: root gather_facts: True vars: loc1: "10.13.1.140" loc2: "10.13.1.141" loc3: "10.13.1.142" vars_prompt: - name: location prompt: "Location of server? Input options: loc1/loc2/loc3" private: no tasks: - name: Test