ansible学习01
一、Ansible是什么
Ansible是一个基于Python开发的轻量级自动化运维工具,有着其他自动化运维工具如puppet、cfengine、chef、func、fabric的优点,并且不需要单独安装客户端以及启动服务,只需要通过SSH就可以快速的对大量客户端实现批量系统配置、程序部署、批量运行命令等。
二、安装Ansible
[root@localhost yum.repos.d]# yum search ansible
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
=================================================================================== N/S matched: ansible ===================================================================================
centos-release-ansible-27.noarch : Ansible 2.7 packages from the CentOS ConfigManagement SIG repository
centos-release-ansible-28.noarch : Ansible 2.8 packages from the CentOS ConfigManagement SIG repository
centos-release-ansible-29.noarch : Ansible 2.9 packages from the CentOS ConfigManagement SIG repository
centos-release-ansible26.noarch : Ansible 2.6 packages from the CentOS ConfigManagement SIG repository
Name and summary matches only, use "search all" for everything.
[root@localhost yum.repos.d]# yum install centos-release-ansible-29.noarch
安装ansible的源:CentOS-SIG-ansible-29.repo
[root@localhost yum.repos.d]# ll
total 8
drwxr-xr-x. 2 root root 220 Jul 12 23:05 bak
-rw-r--r--. 1 root root 2523 Dec 26 2020 Centos-7.repo
-rw-r--r--. 1 root root 1192 Mar 31 2020 CentOS-SIG-ansible-29.repo
[root@localhost yum.repos.d]# yum install ansible
安装完成后,查看ansible配置文件,将注释#和空行去掉
[root@localhost yum.repos.d]# egrep -v "^$|^#" /etc/ansible/ansible.cfg
[defaults]
[inventory]
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
[persistent_connection]
[accelerate]
[selinux]
[colors]
[diff]
三、Ansible版本查看
[root@localhost ~]# ansible --version
ansible 2.9.23
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Oct 14 2020, 14:45:30) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端