From bead2f0e3b5f2b26814f91c6b136f3db525fb5c7 Mon Sep 17 00:00:00 2001 From: hweining Date: Wed, 9 Nov 2022 11:44:17 +0800 Subject: [PATCH] doc: update `ansible.md` (#31) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update ansible inventory静态分组用法 * Update ansible.md --- docs/ansible.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/ansible.md b/docs/ansible.md index ce6bea8..29dae0e 100644 --- a/docs/ansible.md +++ b/docs/ansible.md @@ -39,6 +39,30 @@ mail.example.com [webservers] foo.example.com bar.example.com + +Inventory主机组使用多个IP和域名 + [web] +172.18.12.5[1:4] +[webservers] +www[01:50].example.com + +Inventory主机组使用子主机组 +[usa:children] +southeast +northeast +southwest +northwest + +给多台主机设置变量 : group variables +如果组中的所有主机共享一个变量值,则可以一次将该变量应用于整个组 +[atlanta] +host1 +host2 + +[atlanta:vars] +ntp_server=ntp.atlanta.example.com +proxy=proxy.atlanta.example.com + ``` ## 命令行(ad-hoc) @@ -364,4 +388,4 @@ $ ansible-pull -U [options] --- [Getting started with Ansible](https://docs.ansible.com/ansible/latest/getting_started/index.html) [Introduction to ad hoc commands](https://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html) -[Ansible cheatsheet](https://github.com/luckylittle/ansible-cheatsheet/blob/master/ansible-cheatsheet.txt) \ No newline at end of file +[Ansible cheatsheet](https://github.com/luckylittle/ansible-cheatsheet/blob/master/ansible-cheatsheet.txt)