CentOS系统:自动化运维工具Ansible的安装与配置

news/2024/7/6 1:12:17

一、Ansible工具简介

ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置批量程序部署批量运行命令等功能。

二、Ansible的安装

1、因为是对Ansible的简单测试,所以使用CentOS 7.4服务器进行一系列协同操作。

image

2、首先新增epel-release第三方套件来源

yum install -y epel-release

image

3、使用yum安装Ansible

yum install -y ansible

image

三、Ansible的配置

1、在所有节点上安装YUMSSHpython

yum install -y openssh-server python
管理端安装配置

image

被管理端1安装配置

image

被管理端2安装配置

image

2、在管理界面上执行:ssh-keygen,一路按回车即可

ssh-keygen

image

3、在管理节点上执行,替换为你自己的IP地址

ssh-copy-id 192.168.139.133
ssh-copy-id 192.168.139.134

image

4、修改配置文件ansible.cfg

vi /etc/ansible/ansible.cfg
添加以下内容:
inventory      = /etc/ansible/hosts
forks = 5
become = root
remote_port    = 22
host_key_checking = False
timeout = 10
log_path = /var/log/ansible.log
private_key_file = /root/.ssh/id_ras

5、最后查看结果

cat /etc/ansible/hosts

http://www.niftyadmin.cn/n/3649580.html

相关文章

flutter 状态管理_管理Flutter中的状态

flutter 状态管理Most non-trivial apps will have some sort of state change going on and over time managing that complexity becomes increasingly difficult. Flutter apps are no different, but luckily for us, the Provider package is a perfect solution for most…

我的“普鲁斯特问卷”

普鲁斯特因著作《追忆逝水年华》而闻名,当他十三岁及二十岁时,分别回答过一份涉及被提问者的生活、思想、价值观及人生经验的问卷,而这份问卷亦因为他特别的答案而受到世人的关注,后人还将这份问卷命名为“Proust Questionnaire&a…

华为认证HCIA-Kunpeng Application Developer单选习题总结

最近参加了华为HCIA-Kunpeng Application Developer的认证考试。所以分享一下在培训和备考过程中做的一些习题。 ▣ 考试总共90分钟,有60个题。分别有单选、多选和判断。总分1000分,600分过。 单选练习题 1.TaiShan服务器支持哪个中标麒麟版本&#xf…

Activity 详解(一)

activity类处于android.app包中,继承体系如下: 1.java.lang.Object 2.android.content.Context 3.android.app.ApplicationContext 4.android.app.Activity activity是单独的,用于处理用户操作。几乎所有的activity都要和用户打交道&#xff…

[SMSWAP]实例讲解制作OTA短信来自动配置手机WAP书签[附源码]

[SMS&WAP]实例讲解制作OTA短信来自动配置手机WAP书签编写者日期关键词郑昀ultrapower2005-9-5Sms wap ota 书签 空中下载 手机上网设置 WDP WSP WBXML源代码:http://www.cnblogs.com/Files/zhengyun_ustc/otasms.rar空中下载(OTA)的概念OTA,即Over T…

华为认证HCIA-Kunpeng Application Developer多选习题总结

最近参加了华为HCIA-Kunpeng Application Developer的认证考试。所以分享一下在培训和备考过程中做的一些习题。 ▣ 考试总共90分钟,有60个题。分别有单选、多选和判断。总分1000分,600分过。 多选练习题 1.TaiShan 200机架服务器包含哪些型号&#xf…

华为认证HCIA-Kunpeng Application Developer判断题总结

最近参加了华为HCIA-Kunpeng Application Developer的认证考试。所以分享一下在培训和备考过程中做的一些习题。 ▣ 考试总共90分钟,有60个题。分别有单选、多选和判断。总分1000分,600分过。 判断练习题 1.TaiShan 100是基于kunpeng 916处理器&#x…

react上下文_使用React上下文管理用户登录

react上下文It’s common in React for data to flow from top to bottom through props (parent component to children components), but this is not ideal all the time. 在React中,数据通过道具(父组件到子组件)从上到下流动是很常见的,但这并不总是…