ansible Notes (1): ansible basic concepts

First, the basic concept

  What 1.ansible that?

    ansible is a configuration management tool is an automated operation and maintenance tools.

  What 2.ansible do?

    It can complete a set of batch tasks, or often repetitive tasks. For example:. A service nginx installed on the server 100, and start them b after installing a file is copied to the disposable 100 servers.

 ansible other different configuration management tools, can only rely ssh normal service, without installing the control by the host agent, i.e., as long as connected to a host via ssh, can be used to manage the host ansible.

Second, the command entry

With a simple command for a start: ansible ping 192.168.232.100 -m      # indicates that the call ping module ping192.168.232.100 this host

  To ensure that the above command is executed successfully, the following two conditions be met:. A ansible installation hosts can connect to the managed host via ssh. b. IP address and other information has been added to the host controlled the ansible "inventory management" (Iventory) in.

  2.1 change management inventory information Iventory

    The IP address information is written in / etc / ansible / hosts in: 192.168.232.100 ansible_port = 22 ansible_user = root ansible_ssh_pass = 123456

ansible_port: ssh for configuring the service port number corresponding to the controlled host

ansible_user: a connection configuration corresponding to the user name used by the host controlled

ansible_ssh_pass: user to configure the corresponding password using

  2.2 Use the "Alias" management controlled host

The IP address information is written in / etc / ansible / hosts in: alias_100 ansible_host = 192.168.232.100 ansible_port = 22 ansible_user = root ansible_ssh_pass = 123456

【注意】在使用“别名”的时候,配置文件里的IP地址需要这样写:ansible_host=192.168.232.100,否则ansible无法正确识别对应的主机。

 

Guess you like

Origin www.cnblogs.com/python-wen/p/11227258.html