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

相关推荐
黄交大彭于晏4 分钟前
发送文件脚本源码版本
java·linux·windows
搞Linux的杰仔30 分钟前
Ubuntu20.04基础配置安装——系统安装(一)
linux·嵌入式开发
Kaede63 小时前
如何应对Linux云服务器磁盘空间不足的情况
linux·运维·服务器
云攀登者-望正茂4 小时前
使用 Ansible 在 Windows 服务器上安装 SSL 证书
ansible
草上爬5 小时前
OpenWrt:使用ALSA实现边录边播
ubuntu·openwrt·record·alsa·play
apocelipes8 小时前
Linux c 运行时获取动态库所在路径
linux·c语言·linux编程
努力学习的小廉9 小时前
深入了解linux系统—— 进程池
linux·运维·服务器
秃头菜狗10 小时前
各个主要目录的功能 / Linux 常见指令
linux·运维·服务器
2301_7931024910 小时前
Linux——MySql数据库
linux·数据库
jiunian_cn11 小时前
【Linux】centos软件安装
linux·运维·centos