How to run playbook api in Ansible with vault

后端 未结 1 366
无人共我
无人共我 2021-01-16 22:54

I have a playbook with vault, and I can run it through:

ansible-playbook info.yml --ask-vault-pass

Now, I want to run my playbook api in An

相关标签:
1条回答
  • 2021-01-16 23:46

    Use VaultSecret class instead of string password:

    from ansible.module_utils._text import to_bytes
    from ansible.parsing.vault import VaultSecret
    
    loader.set_vault_secrets([('default',VaultSecret(_bytes=to_bytes('123456')))])
    
    0 讨论(0)
提交回复
热议问题