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

相关推荐
还是奇怪5 分钟前
Linux - 安全排查 2
linux·运维·安全
tan77º2 小时前
【Linux网络编程】Socket - UDP
linux·服务器·网络·c++·udp
czhc11400756632 小时前
Linux 76 rsync
linux·运维·python
蓝易云3 小时前
Qt框架中connect()方法的ConnectionType参数使用说明 点击改变文章字体大小
linux·前端·后端
花落已飘4 小时前
多线程 vs 异步
linux·网络·系统架构
PanZonghui4 小时前
Centos项目部署之Nginx部署项目
linux·nginx
码出钞能力5 小时前
linux内核模块的查看
linux·运维·服务器
星辰云-5 小时前
# Linux Centos系统硬盘分区扩容
linux·运维·centos·磁盘扩容
聽雨2375 小时前
02每日简报20250704
linux·科技·金融·生活·社交电子·娱乐·媒体
Maki Winster6 小时前
Peek-Ubuntu上Gif录制工具-24.04LTS可装
linux·ubuntu·peek