ansible部署
1、ansible清单
定义了Ansible管理的一批主机名单,通过执行Ansible模块,在调用过程中直接对清单中的主机进行批量管理。
修改清单文件的配置:
/etc/ansible/hosts:系统默认的静态清单文件
[root@wxy ansible]# vim ansible.cfg
[defaults]
# some basic default values...
#inventory = /etc/ansible/hosts
inventory = /etc/ansible/inventory *
[root@wxy ansible]# touch inventory
[root@wxy ansible]# cat inventory
192.168.235.139
[webservers]
192.168.235.139
[root@wxy ansible]# ansible webservers --list-hosts
hosts (1):
192.168.235.139
[root@wxy ansible]# ansible 192.168.235.139 --list-hosts
hosts (1):
192.168.235.139
2、ansible默认配置文件信息
ansible默认配置文件:/etc/ansible/ansible.cfg
[root@wxy ~]# cat /etc/ansible/ansible.cfg
[defaults] #通用默认配置
#inventory = /etc/ansible/hosts #主机列表inventory配置文件
#library = /usr/share/my_modules/ #ansible默认搜寻模块的位置
#module_utils = /usr/share/my_module_utils/
#remote_tmp = ~/.ansible/tmp #临时文件远程主机存放目录
#local_tmp = ~/.ansible/tmp #临时文件本地存放目录
#forks = 5 #默认并行进程数
#poll_interval = 15 #轮询间隔时间
#sudo_user = root