At the time of running the playbook, ansible should be able to source the key from Azure Key Vault and use that key to log in to the hosts.
With managed keys in KV it is possible to capture the key at the run time, but how do I pass that as an ansible_ssh_private_key
- hosts: tested1
tasks:- name: Install Apache and PHP
vars:
url: ‘https://demkeyvault.vault.azure.net/’
secretname: ‘adminPassword’
ansible_ssh_private_key: “{{lookup(‘azure_keyvault_secret’,secretname,vault_url=url, client_id=client_id, secret=secret, tenant_id=tenant)}}”
yum: name=httpd,php state=installed
- name: Install Apache and PHP
Ansible version is 2.9