markdown 在Ansible中使用Ad-hoc库存

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 在Ansible中使用Ad-hoc库存相关的知识,希望对你有一定的参考价值。

In case you want to run `ansible` (or `ansible-playbook`) command against a set of hosts that makes sense only for one run,
you can don't bother to create one-time inventory file, but simply define a comma-separated list of hosts as argument of `--invertory` option (or its short form that's simply `-i`) as follows:

```bash
ansible --inventory=myhost1,myhost2,myhost3 all -m setup -a 'filter=*name*'
```

(note that `all` in this command line stands for the target hostname)

If you have only one host to run your playbook against, your inventory string must ends with `,`
(because otherwise Ansible would interpret it as a name of inventory file, not a hosts' list) for example:

```bash
ansible-playbook -i myhost, all -a 'uname -a'
```

以上是关于markdown 在Ansible中使用Ad-hoc库存的主要内容,如果未能解决你的问题,请参考以下文章

markdown 在Ansible中使用Ad-hoc库存

markdown 使用ansible示例进行ping操作

markdown 如何在本地运行Ansible playbook

markdown 如何安装Ansible到Windows

markdown ansible模板的基本用法

markdown ansible.cfgを探す顺番