天天看点

ansible

概念 iaas paas saas

查看配置文件列表

主机配置

ansible-doc -l 列出模块

ansible-doc ping 查看模块帮助

查看模块简介

[```

root@localhost ~]# ansible-doc ping -s

name: try to connect to host, verify a usable python and return <code>pong' on success&lt;br/&gt;ping:&lt;br/&gt;data: # data to return for the</code>ping' return value. if this parameter is set to `crash', the module will cause an exception.

ansible host -m -a -m模块名称 -a 参数

列出所有主机清单

基于key的验证

ssh加速

远程创建目录

commend模块

带参数的命令用shell模块

script 模块

copy模块

fetch抓取模块

file文件处理模块

创建文件

--删除文件

hostname管理主机名

cron计划任务

创建计划任务

注释计划任务

yum安装包

user 管理用户

ansible-galaxy

ansible-galaxy install geerlingguy.nginx 下载

ansible-playbook

yaml语言简介

https://yaml.org/

检查脚本

ansible-playbook -c hello.yml

失败也继续执行

还可以调用host文件中的变量

获取主机变量

变量优先级

命令行&gt;paybook&gt;hosts配置文件 、

查看系统版本号

迭代循环

~

搭建nginx

继续阅读