在使用ansible-vault时,在vagrant up时也会询问vault密码
在使用Vagrant时,我通过ansible-vault工具来对ansible.cfg文件进行配置,并将ask_vault_pass设置为True。但是,在进行Vagrant的provisioning过程中,没有询问密码,结果导致错误发生。
[defaults]
inventory = hosts
retry_files_enabled = False
ask_vault_pass = True
[privilege_escalation]
become = True
[ssh_connection]
control_path = %(directory)s/%%h-%%r
ssh_args = -o ControlPersist=15m -F ssh_config -q
scp_if_ssh = True
如果在Vagrantfile上设置ansible.ask_vault_pass = true,它会询问您的vault密码。
config.vm.provision 'ansible' do |ansible|
ansible.playbook = 'test.yml'
ansible.inventory_path = 'hosts'
ansible.ask_vault_pass = true
ansible.limit = 'all'
end