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

相关推荐
xbd_zc1 小时前
【Vagrant+VirtualBox创建自动化虚拟环境】Ansible测试Playbook
linux·ubuntu·自动化·ansible·虚拟机·vagrant·virtualbox
lsnm3 小时前
【LINUX操作系统】线程操作
linux·jvm·c++·ubuntu·centos·gnu
FREEDOM_X3 小时前
Ubuntu 20.04 安装 ROS 2 Foxy Fitzroy
linux·ubuntu·机器人
华纳云IDC服务商3 小时前
如何利用Rust提升Linux服务器效率(详细操作指南)
linux·服务器·rust
桦04 小时前
【Linux】g++安装教程
linux·运维·服务器
Once_day5 小时前
Linux之netlink(2)libnl使用介绍(1)
linux·netlink·libnl3
Hfc.5 小时前
rabbitmq-集群部署
linux·运维·服务器
Dr_Zobot7 小时前
SLAM学习系列——ORB-SLAM3安装(Ubuntu20-ROS/Noetic)
学习·ubuntu·软件安装
Python少年班7 小时前
vim粘贴代码格式错乱 排版错乱 缩进错乱 解决方案
linux·编辑器·vim·排版错乱·缩进错乱·格式错乱·换行错乱
一眼青苔7 小时前
如何知道Ubuntu的端口是否被占用,被那个进程占用?如何终止进程
linux·运维·ubuntu