From 04e6e16a97101efdd48d96a712a4567b4a5b5389 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Wed, 9 Nov 2022 11:55:39 +0800 Subject: [PATCH] doc: update `ansible.md` (#31) --- docs/ansible.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/ansible.md b/docs/ansible.md index 29dae0e..6cddca9 100644 --- a/docs/ansible.md +++ b/docs/ansible.md @@ -33,28 +33,40 @@ Ansible 备忘清单 #### 静态Inventory `/etc/ansible/hosts` + ```INI mail.example.com [webservers] foo.example.com bar.example.com +``` -Inventory主机组使用多个IP和域名 - [web] +### Inventory 主机组使用多个IP和域名 + +``` +[web] 172.18.12.5[1:4] [webservers] www[01:50].example.com +``` -Inventory主机组使用子主机组 +### Inventory 主机组使用子主机组 + +```ini [usa:children] southeast northeast southwest northwest +``` -给多台主机设置变量 : group variables +### 给多台主机设置变量 + +`group variables` 如果组中的所有主机共享一个变量值,则可以一次将该变量应用于整个组 + +```ini [atlanta] host1 host2