首先登录workstation.
[kiosk@foundation0 ~]$ ssh student@workstation
Warning: Permanently added 'workstation,172.25.250.9' (ECDSA) to the list of known hosts.
Activate the web console with: systemctl enable --now cockpit.socket
在workstation 上,运行 lab playbook-review start 命令。此功能将确保受管主机serverb.lab.example.com 可在网络上访问。它也将确保控制节点上安装正确的ansible 配置文件和清单文件。
[student@workstation ~]$ lab playbook-review start
Starting the lab on :
· Verifying Ansible installation.............................. SUCCESS
· Creating working directory.................................. SUCCESS
· Deploying Ansible inventory................................. SUCCESS
· Deploying ansible.cfg....................................... SUCCESS
workstation 上已经为ansible 项目创建了工作目录 /home/student/playbook-review 。该目录已填充了ansible.cfg 配置文件和inventory 文件。此清单文件中已经定义了受管主机 serverb.lab.example.com
1、新建一个playbook /home/student/playbook-review/internet.yml,再添加所需要的条目,一开始名为Enable internet services 的第一个play ,并指定它适用的受管主机 serverb.lab.exmple.com. 添加一个条目来启用特权升级,再添加一个条目来启动任务列表。
[student@workstation playbook-review]$ vim internet.yml
添加:
---
- name: Enable internet services
hosts: serverb.lab.example.com
become: yes
tasks:
- name: latest version of all required packages installed
yum:
name:
- fir