ansible练习题1

安装并配置ansible

在控制节点上安装并配置Ansible,要求如下: |

安装所需的软件包:

创建静态inventory文件/home/student/ansible/inventory ,要求如下:

servera属于dev主机组

serverb属于test和balancers主机组

serverc和serverd属于prod主机组

prod主机组属于webservers机组

创建ansible配置文件/home/student/ansible/ansible.cfg ,要求如下:

使用/home/student/ansible/inventory清单文件

角色存放在/home/student/ansible/roles/目录

1.安装ansible

yum install ansible

2.创建清单目录

mkdir /home/student/ansible

3.创建清单文件

vim /home/student/ansible/inventory

4.添加清单内容

dev

servera

test

serverb

balancers

serverb

prod

serverc

serverd

webservers:children

prod

5.将ansible.cfg 拷贝到用户目录下

cp /etc/ansible/ansible.cfg /home/student/ansible/

6.更改参数配置

cd ansible

vim ansible.cfg

defaults

inventory = /home/student/ansible/inventory

roles_path = /home/student/ansible/roles/

privilege_escalation

become=True

become_method=sudo

become_user=root

become_ask_pass=False

相关推荐
赵民勇10 分钟前
systemd-cgtop命令详解
linux·运维
hhwyqwqhhwy1 小时前
Ubuntu22.04 安装vitis
linux
刚入门的大一新生1 小时前
Linux-Linux第一个系统程序-进度条
linux·运维·服务器
wuminyu2 小时前
JDK21解决虚拟线程IO阻塞原理剖析
java·linux·c语言·jvm·c++
茫忙然2 小时前
Linux提权辅助查询工具——BinLens的安装和使用
linux·提权·binlens
FlightYe2 小时前
linux系统编程(八):阻塞与非阻塞IO对比
android·linux·运维·服务器·github·vim
淮北4943 小时前
ubuntu22 默认输入法调整频率
运维·服务器·git·ubuntu·elasticsearch
雾时之林3 小时前
Linux---计算机网络常见面试题
linux·运维·计算机网络
10mAh4 小时前
【Linux】error while loading shared libraries 怎么解决?——ldd、RPATH 与动态链接排错
java·linux·前端
楷哥爱开发4 小时前
如何在 Windows、macOS 和 Linux 上安装 scikit-learn (sklearn)
linux·windows·macos