跳到主要内容

基础

python 安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --user



python3 -m pip install --user ansible


方法二
yum install epel-release -y
yum install ansible –y


python3 -m pip install --user ansible-core==2.12.3

python3 -m pip install --upgrade --user ansible


/etc/ansible

ansible-config init --disabled -t all > ansible.cfg


/etc/ansible/hosts

mail.example.com
jumper ansible_ssh_port=5555 ansible_ssh_host=192.168.1.50

[web]
192.168.70.201
bar.example.com

[db]
92.168.70.2[01:12]
one.example.com
two.example.com ansible_connection=ssh ansible_ssh_user=mdehaan
three.example.com

[atlanta]
host1 http_port=80 maxRequestsPerChild=808
host2 http_port=303 maxRequestsPerChild=909

[atlanta]
host1
host2

[atlanta:vars]
ntp_server=ntp.atlanta.example.com
proxy=proxy.atlanta.example.com

[southeast:children]
atlanta