一、修改ansible配置文件

1、配置ansible配置文件

inventory      = /etc/ansible/hosts           #定义资源清单inventory文件的位置,一般保持默认
library        = /usr/share/my_modules/   #library指向ansible模块的目录,一般保持默认

forks          = 5                                         #设置多少个进程同时工作

sudo_user      = root                                 #设置默认执行命令的用户,也可在playbook中重新设置此参数

remote_port    = 22                                  #制定连接被管理的管理端口,默认为22
timeout        = 10                                    #设置SSH连接的超时时间间隔,单位为秒

CentOS7  2 配置 ansible

 

2、配置ansible hosts 文件

[root@mongodb05 ansible]# cat hosts
[agent]
172.16.102.11
172.16.102.12
172.16.102.13
172.16.102.14
172.16.102.16
172.16.102.17
172.16.102.18
172.16.102.19
172.16.102.20

CentOS7  2 配置 ansible

 

 3、验证ansible

ansible agent -m command -a "ls /home"

CentOS7  2 配置 ansible

 

 ansible agent -m command -a "ls /home" -vvv  (-vvv 详细输出)

CentOS7  2 配置 ansible

相关文章:

  • 2021-06-19
  • 2021-12-07
  • 2021-10-20
  • 2021-08-13
  • 2022-12-23
  • 2021-08-19
  • 2021-10-03
猜你喜欢
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2021-08-30
  • 2021-07-10
  • 2021-08-12
  • 2021-08-08
相关资源
相似解决方案