运维工具Ansible安装部署

http://blog.51cto.com/liqingbiao/1875921

centos7安装部署ansible

https://www.cnblogs.com/bky185392793/p/7349541.html

 https://linux.cn/article-6347-1.html

*****************************************************************************

ansible常用模块

https://www.cnblogs.com/happy-king/p/9013312.html


命令的使用:

1、查看节点的空间

[root@smc ~]# ansible 'webservers' -m command -a 'df -h'
192.168.33.71 | SUCCESS | rc=0 >>
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/cl-root 117G 20G 98G 18% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 16K 2.0G 1% /dev/shm
tmpfs 2.0G 13M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 1014M 235M 780M 24% /boot
tmpfs 394M 36K 394M 1% /run/user/0
tmpfs 394M 4.0K 394M 1% /run/user/42
/dev/sr0 4.1G 4.1G 0 100% /run/media/root/CentOS 7 x86_64

2、ping 节点

[root@smc ~]# ansible -m ping 'webservers'

 3、查看显示主机列表  
(https://www.cnblogs.com/qiuhom-1874/p/11832561.html)

[root@localhost ~]# ansible all --list
  hosts (3):
    192.168.0.99
    192.168.0.218
    192.168.0.128
[root@localhost ~]# ansible websers --list
  hosts (1):
    192.168.0.99
[root@localhost ~]# ansible appsers --list
  hosts (2):
    192.168.0.218
    192.168.0.128
[root@localhost ~]#

原文地址:https://www.cnblogs.com/yaok430/p/9714128.html