Hi all,
I’m new to Ansible and use it to add servers deployed using vRealize Automation 8 to AD domain. When the user deploys a new server they select which domain the server belongs to. Based on the domain selected I need to select the correct ad credential to join the server to the domain.
I’ve created a vault that contains the passwords for the account with permission to add the server to the domain:
vault_domain1.com: password1
vault_domain2.com: password2
If I in the playbook specifies one of the vault secrets it works for that domain:
domain_admin_password: “{{ vault_domain1.com }}”
But I need that the vault secret used in the playbook is dependent on the domain the user selects. If the user selects domain2.com, the vault secret used in the playbook should be “vault_domain2.com”.
In the vRA blueprint I’ve added a host variable that sets the vault secret based on the domain that the user selects:
domain_join_password: vault_${input.domain}
I’ve verified that the value for domain_join_password is vault_domain1.com or vault_domain2.com depending on what the user selects. The problem I’ve not been able to solve is how to get this in the playbook as a variable. I’ve tried the following that doesn’t work.
domain_admin_password: “{{ domain_join_password }}”
domain_admin_password: “{{ {{ domain_join_password }} }}”
I’ve searched for a solution to this but my search skills are failing me. Is it possible to achieve what I’m trying to do? Any help will be greatly appreciated.
Thanks.