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驱动:(22)中断节点和中断函数
linux·运维·服务器
4647的码农历程6 分钟前
Linux网络编程 -- 网络基础
linux·运维·网络
C++忠实粉丝1 小时前
Linux环境基础开发工具使用(2)
linux·运维·服务器
康熙38bdc2 小时前
Linux 环境变量
linux·运维·服务器
hakesashou3 小时前
python如何比较字符串
linux·开发语言·python
Ljubim.te3 小时前
Linux基于CentOS学习【进程状态】【进程优先级】【调度与切换】【进程挂起】【进程饥饿】
linux·学习·centos
cooldream20093 小时前
Linux性能调优技巧
linux
一切皆文件linux3 小时前
网站集群批量管理-密钥认证与Ansible模块
ansible
QMCY_jason4 小时前
Ubuntu 安装RUST
linux·ubuntu·rust
慕雪华年4 小时前
【WSL】wsl中ubuntu无法通过useradd添加用户
linux·ubuntu·elasticsearch