标签:node shell will below Ansible master node1 configuration Provision
- Environment preparation
Get ready with 2 CentOS virtual machine, and configure the network to able connect internet and internal communication.
Please reference to below posts for VM provision and configuration with Hyper-V on Windows 10
1 - Enable and launch Hyper-V
2 - Provision Virtual machine with Hyper-V
3 - Install CentOS with Virtual Machine
4 - Configure network connectivity for Virtual machine
One more step before we go further, need to configure these two node to recognize each other, execute below command for both nodes:
[root@shell-master ~]# cat >> /etc/hosts << _EOF_ > 192.168.137.163 shell-master > 192.168.137.164 shell-node1 > _EOF_
Once done Virtual machine setup, we'll have below CentOS machine ready to go:
Node System Comments shell-master CentOS 7 Managing maching, will install Ansible here to manage other machines shell-node1 CentOS 7 Managed maching, will be managed by shell-master
Note: For the whole practice post, we will be using root user for all the activities/operations. - epel yum repository installation
Since Ansible is belong to epel (Extra Packages for Enterprise Linux ) repository, so we need to have epel repo first, otherwise CentOS won't find the package for installation.
Running below command to get epel repo, once done the installation, you will find the epel repo configure file been introduced to the system:
yum install epel-release -y yum repolist
ls /etc/yum.repos.d - Ansible will be installed only for managing node shell-master. running below command on shell-master node:
yum install ansible -y
If everything goes well, you will get Ansible installed successfully, congratulations !
-
Setup Authentication between master and node
Ansible manage nodes via SSH, it's not required to install any agent to managed node. However we need to setup Authentication from master to node, to enable SSH authorization.
Run below command to generate RSA key pairs (Private and Public key) from shell-master:ssh-keygen -t rsa -P ''
- Publish RSA public key to managed node
Now we can publish the authenticate public key to our managed node shell-node1, by running below command from shell-master:
ssh-copy-id -i ~/.ssh/id_rsa.pub shell-node1
Now we've published the authenticated key to shell-node1, you can try login into shell-node1 from shell-master by running below command, you will find there is a file authorized_keys introduced on shell-node1:
- Alright, all good to GO now, we've master and node connected, they able to do the communicate !
Next let's play with Ansible
标签:node,shell,will,below,Ansible,master,node1,configuration,Provision 来源: https://www.cnblogs.com/waynewei/p/15111030.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。