一、创建inventory文件
mkdir /home/greg/ansible
vim /home/greg/ansible/inventory
inventory文件内容
node1
node2
node3
node4
node5
[dev]
node1
[test]
node2
[prod]
node3
node4
[balancers]
node5
[webservers:children]
prod
二、ansible的配置文件ansible.cfg
vim /home/greg/ansible/ansible.cfg
[defaults]
inventory = /home/greg/ansible/inventory
roles_path = /home/greg/ansible/roles
remote_user = greg
ask_pass = false
[privilege_escalation]
become = true
become_method = sudo
become_user = root
become_ask_pass = false
三、如果没有免密登录
在inventory所在目录穿件文件夹
mkdir group_vars
vim all
#
ansible_ssh_pass: redhat
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)