Ansible 可解集方法

Ansible 可解集方法,ansible,ansible-inventory,Ansible,Ansible Inventory,我正在创建一个清单文件,我也想成为root用户,但要做到这一点,我需要在节点上使用这个确切的命令: sudo rootsh -i -u root 有办法吗 稍后,我想将该清单用于此命令或类似命令: ansible -i inventory_file -m setup -a 'filter=ansible_virtualization_role' -o -b all 谢谢。要在清单文件中提到的节点上运行任何“sudo”命令,您必须通过添加以下内容来升级“ansible.cfg”文件中的权限:

我正在创建一个清单文件,我也想成为root用户,但要做到这一点,我需要在节点上使用这个确切的命令:

sudo rootsh -i -u root
有办法吗

稍后,我想将该清单用于此命令或类似命令:

ansible -i inventory_file -m setup -a 'filter=ansible_virtualization_role' -o -b all

谢谢。

要在清单文件中提到的节点上运行任何“sudo”命令,您必须通过添加以下内容来升级“ansible.cfg”文件中的权限:

“变成真的”

您可以从中阅读有关Ansible权限升级设置的更多信息

或者,您也可以在ansible playbook任务中明确提到它,如下所示:

- name: execute this command
  command: "rootsh -i -u root"
  become: true

不是解决方案,只是关闭这个


我无法找到一个解决方案,把它放在库存文件和其他问题已经出现了关于使用

如果你能找到这个问题的答案,请原谅,我无法找到一个解决我的问题的方法,不管我是怎么尝试的。(还有一个关于这个用法的问题,它可能会锁定用户,所以我放弃了这个)