RHCE8 练习题:更新Ansible库的密钥
按照下方所述,更新现有 Ansible库的密钥:
- 从
http://materials.example.com/cd/exam_rhce8/salaries.yml下载Ansible库到/home/student/ansible目录 - 当前的库密码为
retent - 新的库密码为
redhat - 库使用新密码保持
加密状态
Answer
ansible-vault view salaries.yml |
验证
ansible-vault view salaries.yml |
文章作者: Hao
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
相关推荐

2022-05-18
生成主机文件
RHCE8 练习题:生成主机文件 将一个初始模板文件从 http://materials.example.com/cd/exam_rhce8/hosts.j2 下载到 /home/student/ansible 以便使用该模板文件生成以下文件: 针对每个清单主机包含一行内容,其格式与 /etc/hosts 相同 创建名为 /home/student/ansible/hosts.yml 的playbook ,它将使用此模板在 dev 主机组中的主机上生成文件 /etc/myhosts 该playbook运行后,dev 主机组中的主机上的文件 /etc/myhosts 应针对每个受管主机 包含一行内容 address fqdn hostname Answer下载模板并编辑 wget -O /home/student/ansible/hosts.j2 http://materials.exmaple.com/cd/exam_rhc8/hosts.j2 vim /home/student/ansible/hosts.j2 **********{% for h...

2022-05-31
使用系统角色selinux
使用系统角色selinux 使用rhel系统角色 selinux 安装rhel系统角色软件包,并创建符合以下条件的playbook /home/studnet/ansible/selinux.yml 在所有节点上运行,使用 selinux 且配置被管节点的 selinux 为 enforcing 提示: rhel-system-roles Answer: yum -y install rhel-system-rolescp -a /usr/share/ansible/roles/rhel-system-roles.selinux /home/student/ansible/roles/selinuxcp /usr/share/doc/rhel-system-roles/selinux/example-selinux-playbook.yml /home/student/ansible/mv example-selinux-playbook.yml selinux.yml vim selinux.yml 对内容进行删减,留下面即可 ---- hosts: all va...

2022-05-19
创建web内容目录
RHCE8 练习题:创建web内容目录按照下方所述,创建一个名为 /home/student/ansible/webcontent.yml 的 playbook: 该 playbook 在 dev 主机组中的受管节点上运行 创建符合下列要求的目录 /webdev 所有者为 webdev 组 具有常规权限: owner = read + write + execute group = read + write + execute other = read + execute 具有特殊权限: 设置组ID 用符号链接将 /var/www/html/webdev 链接到 /webdev 创建文件 /webdev/index.html 其中包含如下所示的单行文件: Development 在 dev 主机组中主机上浏览此目录(例如:http://servera.lab.example.com/webdev/ 将生成以下输出: Development Answervim /home/student/ansible/webcontent.yml ---- name: h...

2022-05-19
创建密码库
RHCE8 练习题:创建密码库按照下方所述,创建一个Ansible库来存储用户密码: 库名为 /home/student/ansible/locker.yml 库中含有两个变量,名称如下: pw_developer , 值为 Imadev pw_manager , 值为 Imamgr 用于加密和解密该库的密码为 retent 密码存储在文件 /home/student/ansible/secret.txt 中 Answerecho retent> /home/student/ansible/secret.txt vim /home/student/ansible/locker.yml ---pw_developer: Imadevpw_Manager: Imangr ansible-vault encrypt --vault-password-file=/home/student/ansible/secret.txt /home/student/ansible/locker.ym...

2022-05-18
Andsible 创建和使用角色
RHCE8 练习题:创建和使用角色根据下列要求在 /home/student/ansible/roles 中创建名为 apache 的角色: httpd 软件包已安装,设为在系统启动时**自动启动** 防火墙已启用并正在运行,并使用 允许访问 web服务器 的规则 模板文件 index.html.j2 用于创建 /var/www/html/index.html 具有以下输出内容: Welcome to HOSTNAME on IPADDRESS HOSTNAME 是受管节点的完全限定域名, IPADDRESS 是受管节点的IP地址 按照下方所属,创建一个使用此角色的playbook,/home/student/ansible/newrole.yml 该playbook 在 webservers 主机组中 的主机上运行 Answer创建apache角色并编辑 cd /home/student/ansible/rolesansible-galaxy init apache vim apache/tasks/main.yml ---- name: install ap...

2022-05-31
cron创建计划任务
创建计划任务 在 所有主机 上创建一个名为 /home/student/ansible/cron.yml 的playbook, 配置cron任务,每隔 2 分钟运行, 并 执行以下命令 logger "ex200 in progress" 以 natasha 身份运行 提示: 模块 user , cron Answer: vim /home/student/ansible/cron.yml ---- name: cron job hosts: all tasks: - name: create user user: name: natasha state: persent - name: create cron job cron: name: "job , 2 minute /per" minute: '*/2' user: natasha job: logger "ex2...
评论
公告
站点进行了迁移, 如需帮助, 请发邮件到 [email protected]


