暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
红帽RedHat RHCE8认证学习笔记含解题
1229
12页
24次
2021-08-02
免费下载
更多 IT 认证课程请访问 美河学习在线 www.eimhe.com
RHCE8PM
练习环境默认没有虚拟机,需要 reset 生成虚拟机(虚拟机会自动启动
[root@server1 ~]# rht-vmctl reset control
[root@server1 ~]# rht-vmctl reset node1
[root@server1 ~]# rht-vmctl reset node2
[root@server1 ~]# rht-vmctl reset node3
[root@server1 ~]# rht-vmctl reset node4
[root@server1 ~]# rht-vmctl reset node5
模拟环境的所有虚拟机,可以通过 virt-manager 管理
真正考试,所有虚拟机都已经准备 OK,不需要 reset,可以直接使用虚拟
===================================================================
考试共计 15 题,4 个小时!
第一题:
真机 ssh 远程 control 虚拟机(使用域名或 IP 地址):
[root@server1 ~]# ssh alice@control
备注:control 主机的 yum 源是提前配置 OK
[alice@control ~]$ sudo yum -y install ansible #安装软件包
[alice@control ~]$ pwd #确认自己的位置
/home/alice
[alice@control ~]$ mkdir -p /home/alice/ansible/roles
[alice@control ~]$ cd /home/alice/ansible/
写主配置文件,参考/etc/ansible/ansible.cfg
[alice@control ansible]$ vim ansible.cfg #创建主配置文件
[defaults]
inventory = /home/alice/ansible/inventory
roles_path = /home/alice/ansible/roles
remote_user = alice
[privilege_escalation]
become=True
become_method=sudo
become_user=root
become_ask_pass=False
[alice@control ansible]$ vim inventory #创建主机清单文件
[test01]
node1
[test02]
node2
[web]
node3
node4
[test05]
更多 IT 认证课程请访问 美河学习在线 www.eimhe.com
node5
[webtest:children]
web
[alice@control ansible]$ ansible all -m ping #测试一下环境
=============================================================
第二题:
参考 ansible-doc yum_repositoryEXAMPLES
[alice@control ansible]$ vim adhoc.sh
#!/bin/bash
ansible all -m yum_repository -a 'name=BASE description="software base"
baseurl="http://study.lab0.example.com/rhel8/BaseOS" gpgcheck=yes
gpgkey="http://study.lab0.example.com/rhel8/RPM-GPG-KEY-redhat-release"
enabled=yes'
ansible all -m yum_repository -a 'name=STREAM description="software stream"
baseurl="http://study.lab0.example.com/rhel8/AppStream" gpgcheck=yes
gpgkey="http://study.lab0.example.com/rhel8/RPM-GPG-KEY-redhat-release"
enabled=yes'
[alice@control ansible]$ chmod +x adhoc.sh
[alice@control ansible]$ ./adhoc.sh
测试:可以去 node1-node5 任意安装一个软件包测试
=============================================================
第三题:
参考 ansible-doc yumEXAMPLES
[alice@control ansible]$ vi tools.yml
---
- hosts: test01,test02,web
tasks:
- name: Install a list of packages
yum:
name:
- php
- tftp
state: present
- hosts: test01
tasks:
- name: groups
yum:
name: "@RPM Development Tools"
state: present
- name: update
yum:
name: '*'
of 12
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜