Ansible 使用指南
Ansible 概述 模块化:调用特定的模块执行特定的任务,并且支持自定义模块 并且可以使用任何编程语言编写模块 基于python语言开发 无代理机制(被管理节点只要有ssh服务即可实现被管理) 安全,基于open ssl 幂等性:一个任务执行1遍和执行n遍效果一样,不因重复执行带来意外情况 支持playbook编排任务,YAML格式,编排任务,支持丰富的数据结构 较强大的多层解决方案 role 参考文档 https://www.ansible.com/ https://github.com/ansible/ansible http://galaxy.ansible.com https://galaxy.ansible.com/explore#/ http://github.com/ http://ansible.com.cn/ https://github.com/ansible/ansible https://github.com/ansible/ansible-examples Ansible 安装 yum 安装 生产中主流安装方式(自epel源) yum -y install ansible apt 安装 xxx 编译安装 yum -y install python-jinja2 PyYAML python-paramiko python-babel python-crypto tar xf ansible-1.5.4.tar.gz cd ansible-1.5.4 python setup.py build python setup.py install mkdir /etc/ansible cp -r examples/* /etc/ansible git 安装 git clone git://github.com/ansible/ansible.git --recursive cd ./ansible source ./hacking/env-setup 验证安装 # ansible --version ansible 2.9.18 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible python version = 3.6.8 (default, Aug 24 2020, 17:57:11) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] Ansible 相关文件 /etc/ansible/ansible.cfg 主配置文件,配置ansible工作特性,但大多数配置无需修改 配置文件优先级 ...