Using a variable as a default value in vars_prompt in Ansible

后端 未结 1 933
小鲜肉
小鲜肉 2020-12-07 04:21

I was trying to use vars_prompt in Ansible with default values taken from facts (or otherwise a previously defined variable). The playbook is intended be used a

相关标签:
1条回答
  • 2020-12-07 05:11

    This can be implemented using the pause module:

    ---
    - hosts: server01
      gather_facts: True
      tasks:
        - pause:
            prompt: please enter the name for the target [{{ ansible_hostname }}]
          register: prompt
    
        - debug:
            msg: "{{ prompt.user_input if prompt.user_input else ansible_hostname }}"
    
    0 讨论(0)
提交回复
热议问题