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

相关推荐
lllsure2 小时前
Linux 实用指令
linux·物联网
努力的小T2 小时前
使用 Docker 部署 Apache Spark 集群教程
linux·运维·服务器·docker·容器·spark·云计算
Nerd Nirvana3 小时前
OpenSSL crt & key (生成一套用于TLS双向认证的证书密钥)
linux·ssl·shell·认证·加密·tls·oepnssl
letisgo53 小时前
记录一次部署PC端网址全过程
linux·阿里云·服务器运维
猫猫的小茶馆4 小时前
【网络编程】UDP协议
linux·服务器·网络·网络协议·ubuntu·udp
尚墨11114 小时前
linux 安装启动zookeeper全过程及遇到的坑
linux·zookeeper
鱼嘻4 小时前
Linux自学day23-进程和线程
linux·服务器·c语言·进程和线程
AuGuSt_814 小时前
在windows下安装windows+Ubuntu16.04双系统(下)
linux·ubuntu·双系统
old_power4 小时前
Linux(Ubuntu24.04)源码编译安装OpenCV4.6.0
linux·opencv
爆更小小刘4 小时前
Linux下基本指令(4)
linux·运维·服务器