自动化运维工具(ansible入门教程)
参考资料
- 官网:https://docs.ansible.com/
- 中文网:http://www.ansible.com.cn/
- Ansible中文权威指南 http://www.ansible.com.cn/docs/intro_installation.html
- Ansible中文权威指南 https://ansible-tran.readthedocs.io/en/latest/docs/intro_inventory.html
- Ansible 快速入门 https://blog.csdn.net/IT_ZRS/article/details/126989365 超详细ansible-playbook剧本编写 https://blog.csdn.net/weixin_49343462/article/details/112852923
- 自动化运维工具(ansible入门教程)
- Ansible 超详细教程 https://blog.csdn.net/MagnumLuke/article/details/136380942
1.Ansible简介
2.Ansible安装
方式1:通过yum安装
[root@localhost ~]# yum install epel-release
[root@localhost ~]# yum install ansible
方式2:通过pip安装
[root@localhost ~]# yum install epel-release
[root@localhost ~]# yum install python2-pip
[root@localhost ~]# pip install ansible
方式3:在运维主机上安装ansible及相关组件
# 切换到app用户
## CentOS
sudo yum install -y python3-pip sshpass
## Debian
sudo apt update
sudo apt install -y python3-pip libffi-dev
# cd /home/app 导入安装清单
cat >> requirements.txt << EOF
ansible==2.9.20
cryptography==2.8
jinja2==2.11.3
netaddr==0.7.19
pbr==5.4.4
jmespath==0.9.5
ruamel.yaml==0.16.10
MarkupSafe==1.1.1
EOF
pip3 install -r requirements.txt
## 如果安装时报权限问题执行
sudo pip3 install -r requirements.txt
sudo chmod -R 777 /usr/local/lib/python3.6
sudo chmod -R 777 /usr/lib/python3.6
# 设置主机免key检查
cat >> /home/app/.ansible.cfg << EOF
[defaults]
host_key_checking = False
EOF
查看版本:ansible –version
3.ansible使用
4.ansible-playbook
问题记录
Post Directory
扫码关注公众号:暂无公众号
发送 290992
即可立即永久解锁本站全部文章