I am working on Ansible automation for Cumulus-Linux (whitebox) networking. I am using Ansible Vault to encrypt the passwords in my playbooks for local accounts I want built out on the new Cumulus switch. However, when I run the playbook, it seems ansible is able to read the username variables from my vault-encrypted file, but not the password variables I defined. There is no way to check what Ansible is setting these password to; of course the passwords are encrypted even in the -vvvv Ansible output.
Per every Ansible Vault example I have seen, my variables are defined as such (an unencrypted variable referencing an encrypted one):
- "user" gets its value from "vault_user", which resides in my vault-encrypted variables file.
- "password" gets its value from "vault_password", which also resides in my vault-encrypted file.
My current playbook structure:
root
--> ansible.cfg
--> hosts
--> main.yml (main playbook)
--> group_vars
--> all
--> main.yml (where unencrypted "user" and "password" declared)
--> vault.yml (encrypted, has values for "vault_user" and "vault_password")
The actual part of my playbook where the account is created/modified:
- name: create_admin_account
user:
name={{ user }}
shell=/bin/bash
password={{ password }}
groups=sudo
append=yes
The variable definitions from /group_vars/all/main.yml
user: "{{ vault_user }}"
password: "{{ vault_password }}"
And then, in the vault-encrypted file, /group_vars/all/vault.yml (not sharing actual account info):
vault_user: 'xxxx'
vault_password: 'yyyy'
The encryption password is stored in a separate file and I point Ansible at the file via jenkins automation/Github (instead of defining the vault password file in ansible.cfg).
THE PROBLEM:
When I run this playbook, it completes successfully, and it does in fact read my vault file and creates the 'xxxx' user account. However, it does not appear to be setting the account password to the values I defined as I am not able to log in using those credentials afterwards. I verified the account gets created properly and is present afterwards in the sudoers group.
If ansible can read the vaulted "user" variable, why would it not be reading the "password" variable the same?
I have even tried running it with the vault file unencrypted and in plain text-- ansible STILL does not read my "password" variable correctly.
Does anybody know of a hack or way to see what plain text value Ansible is inserting into this variable when it runs (might be a silly question, as this would be a huge security risk!)?