ansible配置
1、安装阿里云epel源
2、yum install ansible
3、默认的inventory文件/etc/ansible/hosts
3.1 hosts文件格式
[group1] 10.1.1.1 10.1.1.1:1008
10.1.1.[1:10]
server01 ansible_host=10.1.1.1 ansible_port=49159 ansible_user=root ansible_ssh_pass=123456
[parent:children]
child1
child2
[child1]
[child2]
3.2 yaml语法
all: children: group1: host: 10.1.1.1: 10.1.1.2:
test01:
ansible_ssh_pass: 123
4、ansible命令 ansible <host-pattern> [options]
4.1 <host-pattern>
ip地址或别名 组名 all * #支持正则和统配符,更多参考http://www.ansible.com.cn/docs/intro_patterns.html
4.2 [options]
4.2.1 ansible-doc -s 模块名 #查看模块帮助信息
4.2.1 -m调用模块
ping
fetch # 如果本地存在了同名文件,会比对文件hash,不一样则覆盖,一样则不会操作。
copy
file

浙公网安备 33010602011771号