我自己在 ansible 中的库存

我自己在 ansible 中的库存

我创建了自己的清单并添加了 3 个 IP 地址中的 2 个 IP 地址,但是在运行下面的命令时出现错误,请告知?

ansible all -i myinventory -m command -a 'Free'

错误 :

[DEPRECATION WARNING]: Distribution Ubuntu 18.04 on host 172.31.35.222 should use /usr/bin/python3, but is using /usr/bin/python for
backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this
host. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. This feature will be
removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
172.31.35.222 | FAILED | rc=2 >>
[Errno 2] No such file or directory
[DEPRECATION WARNING]: Distribution Ubuntu 18.04 on host 172.31.37.140 should use /usr/bin/python3, but is using /usr/bin/python for
backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this
host. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. This feature will be
removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
172.31.37.140 | FAILED | rc=2 >>
[Errno 2] No such file or directory

我尝试更改 ansile.cfg 中的 deprecation_warnings 设置,但仍然收到此错误

答案1

Free不是有效命令,但free确实有效。简单的错字!

尝试这个:

ansible all -i myinventory -m command -a 'free'

您甚至不需要指定命令模块(对于 Linux):

ansible all -i myinventory -a 'free'

相关内容