Hi everyone, first time post here! I've setup the VMware inventory plugin for Ansible, and have had success in retrieving inventory results both with plaintext credentials in the .vmware.yml file and with the file fully encrypted with ansible-vault.
Unfortunately storing the credentials in plain text is not viable, neither is encrypting the whole file. After confirming that both the username and password fields in this inventory configuration file can be encrypted using ansible-vault, I attempted to do so - but I have been unable to get it to work. Is there a particular trick to this? The process I have followed so far is this: 1. encrypt the password string: `ansible-vault encrypt_string` 2. Paste the output of this into the .vmware.yml inventory file: plugin: vmware_vm_inventory strict: False hostname: vcenter.fqdn.com username: [email protected] password: !vault | $ANSIBLE_VAULT;1.1;AES256 5 lines of digits... validate_certs: False with_tags: True properties: - 'config.name' - 'config.guestId' - 'guest.ipAddress' - 'guest.hostName' - 'guest.toolsStatus' - 'summary.runtime.powerState' hostnames: - 'config.name' filters: - 'summary.runtime.powerState == 'poweredOn' - 'guest.guestId == 'rhel8_64Guest' or 'config.guestId == 'rhel9_64Guest' or config.guestId == 'ubuntu64Guest' 3. Run ansible-inventory to test: ansible-inventory --list -i inventory.vmware.yml --ask-vault-pass The command fails with an error "Unable to logon to vCenter or ESXi API at xxxx.xxx.xxx:43 as xxxx: Cannot complete login due to an incorrect user name or password". If I change the encrypted password value to plaintext it works. If I encrypt the entire file it works. Can anyone see anything that I am doing wrong? Thank you! Adam -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8223ac66-57c8-4cbe-b924-85d0091ea830n%40googlegroups.com.
