本文介绍了变量中的 Ansible Vault 密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将保险库密码作为 Ansible 剧本中的变量访问?我正在寻找这样的东西:

Is there a way to access the vault password as a variable in an Ansible playbook? I am looking for something like this:

---

debug: var=ansible_vault_password

推荐答案

我最终通过将本地 Vault 密码文件复制到服务器来解决此问题.执行此操作的任务如下所示:

I ended up solving this by copying the local vault password file to the server. The task to do that looks like that:

- name: setup ansible vault password file
  copy:
    src: /path/to/local/vault_pass
    dest: /root/.vault_pass
    mode: 0600
    owner: root
    group: root

然后 root 用户将执行 ansible-pull 命令.

And then the root user will execute the ansible-pull command.

这篇关于变量中的 Ansible Vault 密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 18:38