Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use of ansible services

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Ansible introduction

Ansible is an automatic operation and maintenance tool, based on Python development, which integrates the advantages of many operation and maintenance tools (puppet, cfengine, chef, func, fabric), and realizes the functions of batch system configuration, batch program deployment, batch running commands and so on.

Characteristics of Ansible

Ansible works based on modules and does not have the ability to deploy in batches. What really has batch deployment is the module that ansible runs, and ansible only provides a framework.

Ansiblle has the following characteristics:

1. The deployment is simple. You only need to deploy the Ansible environment on the main control side, and the controlled side does not need to do anything.

2. Simple configuration, powerful function and strong expansibility

3. Written in python, the maintenance is simpler, and the ruby syntax is too complex.

Install Ansible

1. Install ansible through yum

Yum install ansible-y

2. First use ssh to generate public key and private key

Ssh-keygen-t rsa: generated by default in the root home directory .ssh directory

3. Ssh-copy-id-I public key root@192.168.124.177

Then enter the password and you won't need a password to log in next time.

Transfer IP input password

Exit can quit.

4. Configuration file

Vim etc/ansible/hosts

[webservers] # add a group name

192.168.124.177

192.168.124.178

Wq exit and save

Ansible-m ping "group name" to see if it works

Then you can operate these two machines.

Ansible webservers (group name)-u root-a (followed by parameter) "reboot"

We can also generate an authenticated key under 178 hosts.

Now that we have generated the key on the 177host, let's go to the root home directory and delete the dropped key under the ssh directory to see if we can still log in.

When the 177 host deletes the key, it cannot log in, indicating that the connection failed

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report