很多朋友都想知道rhce考试多少钱?下面就一起来说说吧!
rhce考试多少钱
报名费用:报名费用不是全国统一的,不同考场收费标准不一样,通常在4200元左右。补考费用:RHCE考试分RHCSA和RHCE两科,如果只通过了RHCSA考试,那么考生需缴纳2000左右的补考费,具体是多少,也要依据所预约考场的收费标准。
rhce认证考试怎么考
1、浏览器搜索红帽官网,点击第一个并进入。2、进入官网后找到并点击红帽培训。3、选择考试认证。4、选择所有考试里的红帽工程师(RHCE)考试。5、点击查找您附近的红帽培训机构。6、选择国家,找到距离最近的培训机构,再由培训机构报名参加考试。
红帽认证8.0版本RHCE考试满分通过总结
考试有6台虚拟机,其中一台是需要操作Ansible的,考试要求在greg用户下完成操作,其余5台是被控机器node1-5 所有机器密码均为123(根据考试提供进行操作)
安装和配置 Ansible按照下方所述,在控制节点 http://control.example.com 上安装和配置 Ansible:
$ sudo yum install -y ansible$ mkdir -p /home/greg/ansible/roles$ cd /home/greg/ansible$ cp /etc/ansible/ansible.cfg .$ vim /home/greg/ansible/inventory[all:vars]ansible_password=123[dev]node1[test]node2[prod]node3node4[balancers]node5[webservers:children]prod#保存,退出$ vim ansible.cfg[defaults]inventory = /home/greg/ansible/inventoryroles_path = /home/greg/ansible/roleshost_key_checking = Falseremote_user = root#保存,退出
创建和运行 Ansible 临时命令
为系统管理员,您需要在受管节点上安装软件。
照正文所述,创建一个名为 /home/greg/ansible/adhoc.sh 的 shell 脚本,该脚本将使用 Ansible 临时命令在各个受管节点上安装 yum 存储库:
储存库1:
存储库2:
vim /home/greg/ansible/adhoc.sh#!/bin/bashansible all -m yum_repository -a \'name="EX294_BASE" \description="EX294 base software" \baseurl="http://xxx.example.com.com/BaseOS" \gpgcheck=yes \gpgkey="http://xxx.example.com/RHEL/RPM-GPG-KEY-redhat-release" \enable=yes'ansible all -m yum_repository -a \'name="EX294_STREAM" \description="EX294 stream software" \baseurl="xxx.example.com/AppStream" \gpgcheck=yes \gpgkey="http://xxx.example.com/RHEL/RPM-GPG-KEY-redhat-release" \enable=yes'
安装软件包
创建一个名为 /home/greg/ansible/packages.yml 的 playbook :
vim /home/greg/ansible/packages.yml---- name: 安装软件包 hosts: dev,test,prod tasks: - name: install the latest version yum: name: "{{ item }}" state: latest loop: - php - mariadb - block: - name: install the '@RPM Development Tools' package group yum: name: "@RPM Development Tools" state: present when: "'dev' in group_names" - name: upgrade all packages yum: name: '*' state: latest when: "'dev' in group_names"ansible-playbook /home/greg/ansible/packages.yml
使用 RHEL 系统角色
安装 RHEL 系统角色软件包,并创建符合以下条件的 playbook /home/greg/ansible/timesync.yml :
$ sudo yum -y install rhel-system-roles$ vim ansible.cfg#roles_path = /home/greg/ansible/roles:/usr/share/ansible/roles$ ansible-galaxy list$ cp /usr/share/doc/rhel-system-roles/timesync/example-timesync-playbook.yml /home/greg/ansible/timesync.yml$ vim /home/greg/ansible/timesync.yml---- hosts: all vars: timesync_ntp_servers: - hostname: 172.20.20.254 iburst: yes roles: - rhel-system-roles.timesyncansible-playbook /home/greg/ansible/timesync.yml
创建和使用角色
根据下列要求,在 /home/greg/ansible/roles 中创建名为 apache 的角色:
Welcome to HOSTNAME on IPADDRESS
其中,HOSTNAME 是受管节点的完全限定域名,IPADDRESS 则是受管节点的 IP 地址。
$ cd roles/$ ansible-galaxy init apache$ cd ..$ ansible-galaxy list$ vim roles/apache/tasks/main.yml---- name: install the latest version of Apache yum: name: httpd state: latest- name: Start service httpd, if not started service: name: httpd state: started enabled: yes- firewalld: service: http permanent: yes state: enabled immediate: yes- name: Template a file template: src: index.html.j2 dest: /var/www/html/index.html$ vim roles/apache/templates/index.html.j2# Welcome to {{ ansible_fqdn }} on {{ ansible_default_ipv4.address }}vim /home/greg/ansible/apache.yml---- name: 使用角色 hosts: webservers roles: - apache$ ansible-playbook /home/greg/ansible/apache.yml
从 Ansible Galaxy 使用角色
根据下列要求,创建一个名为 /home/greg/ansible/roles.yml 的 playbook :
Welcom to http://node3.example.com on 172.24.22.8
Welcom to http://node4.example.com on 172.24.22.9
Hello PHP World from FQDN
其中,FQDN 是主机的完全限定名称。
Hello PHP World from http://node3.example.com
另外还有 PHP 配置的各种详细信息,如安装的 PHP 版本等。
Hello PHP World from
http://node4.example.com
另外还有 PHP 配置的各种详细信息,如安装的 PHP 版本等
$ vim /home/greg/ansible/roles.yml---- name: one hosts: webservers roles: - apache- name: two hosts: balancers roles: - balancer- name: san hosts: webservers roles: - phpinfo$ ansible-playbook roles.yml
创建和使用逻辑卷
创建一个名为 /home/greg/ansible/lv.yml 的 playbook ,它将在所有受管节点上运行以执行下列任务:
Could not create logical volume of that size,并且应改为使用大小 800 MiB。
Volume group done not exist。
$ vim /home/greg/ansible/lv.yml---- name: 创建和使用逻辑卷 hosts: all tasks: - block: - name: Create a logical volume of 1500m lvol: vg: research lv: data size: 1500 - name: Create a ext4 filesystem: fstype: ext4 dev: /dev/research/data rescue: - debug: msg: Could not create logical volume of that size - name: Create a logical volume of 800m lvol: vg: research lv: data size: 800 when: ansible_lvm.vgs.research is defined ignore_errors: yes - debug: msg: Volume group done not exist when: ansible_lvm.vgs.research is undefined$ ansible-playbook /home/greg/ansible/lv.yml
生成主机文件
生成主机文件
该 playbook 运行后, dev 主机组中主机上的文件 /etc/myhosts 应针对每个受管主机包含一行内容:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.242.6 http://node1.realm8.example.com node1
172.242.7 http://node2.realm8.example.com node2
172.242.8 http://node3.realm8.example.com node3
172.242.9 http://node4.realm8.example.com node4
172.242.10 http://node5.realm8.example.com node5
注:清单主机名称的显示顺序不重要。
$ wget http://materials/hosts.j2$ vim hosts.j2127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain{% for host in groups['all'] %}{{ hostvars[host]['ansible_facts']['default_ipv4']['address'] }} {{ hostvars[host]['ansible_facts']['fqdn'] }} {{ hostvars[host]['ansible_facts']['hostname'] }}{% endfor %}$ vim hosts.yml---- name: 生成主机文件 hosts: all tasks: - name: Template a file to /etc/myhosts template: src: /home/greg/ansible/hosts.j2 dest: /etc/myhosts when: '"dev" in group_names'$ ansible-playbook hosts.yml
修改文件内容
修改文件内容
按照下方所述,创建一个名为 /home/greg/ansible/issue.yml 的 playbook :
vim /home/greg/ansible/issue.yml---- name: 修改文件内容 hosts: all tasks: - name: copy using inline content1 copy: content: 'Development' dest: /etc/issue when: "inventory_hostname in groups.dev" - name: Copy using inline content2 copy: content: 'Test' dest: /etc/issue when: "inventory_hostname in groups.test" - name: Copy using inline content3 copy: content: 'Production' dest: /etc/issue when: "inventory_hostname in groups.prod"ansible-playbook /home/greg/ansible/issue.yml
创建 Web 内容目录
创建 Web 内容目录
按照下方所述,创建一个名为 /home/greg/ansible/webcontent.yml 的 playbook :
vim /home/greg/ansible/webcontent.yml---- name: 创建 Web 内容目录 hosts: dev tasks: - name: Create a directory if it does not exist file: path: /webdev state: directory group: webdev mode: '2775' - name: Create a symbolic link file: src: /webdev dest: /var/www/html/webdev state: link - name: Copy using inline content copy: content: 'Development' dest: /webdev/index.html setype: httpd_sys_content_tansible-playbook /home/greg/ansible/webcontent.yml
生成硬件报告
生成硬件报告
创建一个名为 /home/greg/ansible/hwreport.yml 的 playbook ,它将在所有受管节点上生成含有以下信息的输出文件 /root/hwreport.txt :
您的 playbook 应当:
$ vim /home/greg/ansible/hwreport.yml---- name: 生成硬件报告 hosts: all vars: hw_all: - hw_name: HOST hw_cont: "{{ inventory_hostname | default('NONE', true) }}" - hw_name: MEMERY hw_cont: "{{ ansible_memtotal_mb | default('NONE', true) }}" - hw_name: BIOS hw_cont: "{{ ansible_bios_version | default('NONE', true) }}" - hw_name: DISK_SIZE_VDA hw_cont: "{{ ansible_devices.vda.size | default('NONE', true) }}" - hw_name: DISK_SIZE_VDB hw_cont: "{{ ansible_devices.vdb.size | default('NONE', true) }}" tasks: - name: 1 get_url: url: http://materials/hwreport.empty dest: /root/hwreport.txt - name: 2 lineinfile: path: /root/hwreport.txt regexp: '^{{ item.hw_name }}=' line: "{{ item.hw_name }}={{ item.hw_cont }}" loop: "{{ hw_all }}"$ ansible-playbook /home/greg/ansible/hwreport.yml
创建密码库
按照下方所述,创建一个 Ansible 库来存储用户密码:
$ vim ansible.cfgvault_password_file = /home/greg/ansible/secret.txt #修改$ vim /home/greg/ansible/locker.yml---pw_developer: Imadevpw_manager: Imamgr$ echo qqqqqqqqqq > /home/greg/ansible/secret.txt$ ansible-vault encrypt /home/greg/ansible/locker.yml
创建用户帐户
- [ ] 在 dev 和 test 主机组中的受管节点上创建
- [ ] 从 pw_developer 变量分配密码
- [ ] 是补充组 devops 的成员
- [ ] 在 prod 主机组中的受管节点上创建
- [ ] 从 pw_manager 变量分配密码
- [ ] 是补充组 opsmgr 的成员
$ wget http://xxx.example.com.com/materials/user_list.yml -P /home/greg/ansible$ vim /home/greg/ansible/users.yml---- name: 创建用户帐户 hosts: all vars_files: - /home/greg/ansible/locker.yml - /home/greg/ansible/user_list.yml tasks: - name: Ensure group group: name: devops loop: "{{ users }}" when: item.job == 'developer' and (inventory_hostname in groups.dev or inventory_hostname in groups.test) - name: Add the user1 user: name: "{{ item.name }}" password: "{{ pw_developer | password_hash('sha512', 'mysecretsalt') }}" group: devops loop: "{{ users }}" when: item.job == 'developer' and (inventory_hostname in groups.dev or inventory_hostname in groups.test) - name: Ensure group group: name: opsmgr loop: "{{ users }}" when: item.job == 'manager' and inventory_hostname in groups.prod - name: Add the user1 user: name: "{{ item.name }}" password: "{{ pw_manager | password_hash('sha512', 'mysecretsalt') }}" group: opsmgr loop: "{{ users }}" when: item.job == 'manager' and inventory_hostname in groups.prod$ ansible-playbook /home/greg/ansible/users.yml
更新 Ansible 库的密钥
按照下方所述,更新现有 Ansible 库的密钥:
$ wget http://materls/salaries.yml$ ansible-vault rekey --ask-vault-pass salaries.ymlVault password: `111`New Vault password: `123`Confirm New Vault password: `123`$ ansible-vault view salaries.yml