Why I cannot prompt for a variable that will be shared by multiple plays (ansible 1.6.5)

后端 未结 3 784
逝去的感伤
逝去的感伤 2021-02-01 06:05

I have distilled a playbook that has three plays. The goal is to collect the database password from a prompt in one play and then use the same password in the other two plays.

3条回答
  •  别那么骄傲
    2021-02-01 06:46

    I ended up taking user3037143 answer for my localhost sudo password problem:

    ---
    - hosts: localhost
      tags:
        - always
      vars_prompt:
        - name: sudo_password
          prompt: "Sudo password for localhost ONLY"
      tasks:
        - set_fact: ansible_become_password={{ sudo_password }}
          no_log: true
    

    Now it's shared between every include playbooks I have.

    I'm on ansible > 2.

提交回复
热议问题