Some pictures quoted in this article are from the Internet.
Ansible official website address
https://docs.ansible.com/
Chinese website ( Marge Education)
http://www.ansible.com.cn/
There are two servers
192.168.23.131
192.168.23.134
installation
rpm -Uvh http://mirrors.ustc.edu.cn/epel/epel-release-latest-7.noarch.rpm
yum install epel-release -y
yum install ansible
By default it will be in the /etc/ansible/ directory
Verification version
ansible --version
use
Create a secret key and
ssh-keygen -t rsa
press Enter all the way.
ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected]
User permissions section
visudo
Modify the
%wheel line, and then add the account [testuser] to the wheel group, and aG retains the original group
so that you don’t need to enter a password when using sudo
usermod -aG wheel testuser
This article chooses to create the /root/ansible directory,
create the host file and the roles directory,
edit the host
[group]
192.168.23.131