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

相关推荐
石像鬼₧魂石11 小时前
内网渗透靶场实操清单(基于 Vulhub+Metasploitable 2)
linux·windows·学习·ubuntu
橘子真甜~12 小时前
C/C++ Linux网络编程15 - 网络层IP协议
linux·网络·c++·网络协议·tcp/ip·计算机网络·网络层
拾贰_C13 小时前
【Linux | Windows | Terminal Command】 Linux---grep | Windows--- findstr
linux·运维·服务器
阿华hhh14 小时前
Linux系统编程(标准io)
linux·开发语言·c++
石像鬼₧魂石14 小时前
Kali Linux 网络端口深度扫描
linux·运维·网络
alengan14 小时前
linux上面写python3日志服务器
linux·运维·服务器
Rose sait15 小时前
【环境配置】Linux配置虚拟环境pytorch
linux·人工智能·python
叶之香16 小时前
CentOS/RHEL 7、8安装exfat和ntfs文件系统
linux·运维·centos
一世琉璃白_Y16 小时前
pg配置国内数据源安装
linux·python·postgresql·centos