Ansible basic environment configuration method
This article mainly introduces "ansible basic environment configuration method". In daily operation, I believe many people have doubts about ansible basic environment configuration method. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "ansible basic environment configuration method". Next, please follow the editor to study!
I. basic environmental configuration
Modify the hostname and install the epel source
[root@localhost ~] # hostnamectl set-hostname ansible [root@localhost ~] # bash [root@ansible] # curl-o / etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo[root@ansible ~] # wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo[root@ansible ~] # yum clean all & & yum makecache fast
# what I use here is Ali Source
Install ansible and configure ssh secret-free authentication
[root@ansible ~] # yum-y install ansible [root@ansible ~] # ssh-keygen-t rsa [root@ansible ~] # ssh-copy-id-I. ssh / id_rsa.pub root@10.4.7.112 [root@ansible ~] # ssh-copy-id-I. ssh / id_rsa.pub root@10.4.7.113
Declare group node members and test
[root@ansible ~] # vim / etc/ansible/hosts [web] 10.4.7.11210.4.7.113 [root@ansible ~] # ansible web-m ping
[root@ansible ~] # ansible web-a "df-Th"
At this point, the study on the "ansible basic environment configuration method" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!