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

相关推荐
feng_you_ying_li7 分钟前
Linux 线程之 pthread 库的介绍和每个线程独立空间的说明
linux·运维
来点抹茶吗7 分钟前
U-Boot、内核移植与根文件系统构建(BeagleBone Green Gateway&AM335X)
linux·嵌入式硬件·ubuntu·debian
Linux运维老纪9 分钟前
nginx 打造高性能 API 网关(‌Building a High-Performance API Gateway with Nginx)
linux·运维·mysql·nginx·云计算·运维开发
YXXY3138 小时前
线程的介绍(四)
linux
kTR2hD1qb10 小时前
从 Responses API 到 Chat Completions:一个模型网关的设计复盘
linux·前端
姓刘的哦11 小时前
大模型祛魅
linux
hj28625112 小时前
linux下一步学习内容
linux·运维
xier_ran13 小时前
【infra之路】Linux基础命令与系统排查
linux·运维·服务器
zh路西法13 小时前
【Linux 串口通信】基于 C++ 多线程的同步/异步串口实现
linux·运维·c++·python
c2385613 小时前
linux基础2
linux·运维·服务器