3

I try to write an Ansible yml that reads the root-passwords from an encrypted vault-file and then pass it to become_pass:


    - hosts: sirius
      remote_user: ansusr
      become: yes
      vars_files:
         - vault_vars.yml
      become_pass: "{{ root_pass_sirius }}"
        

But this fails: ERROR! 'become_pass' is not a valid attribute for a Play

But why ? - According to the Ansible documentation this is a valid command.

may24x
  • 97
  • 1
  • 4
  • 9

1 Answers1

10

According to the Ansible documentation this is a valid command.

Wrong. become_pass is not a valid attribute (and it is not a command after all) for a Play.

Please see List of Behavioral Inventory Parameters. There is ansible_become_pass variable.

So you need to set a variable:

- hosts: sirius
  remote_user: ansusr
  become: yes
  vars_files:
    - vault_vars.yml
  vars:
    ansible_become_pass: "{{ root_pass_sirius }}"
Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193