在RHCE环境中完成以下题目
1、使用RHEL系统角色
安装 RHEL 系统角色软件包,并创建符合以下条件的playbook /home/student/ansible/timesync.yml:
在所有受管节点上运行
使用 timesync 角色
配置该角色,以使用当前有效的 NTP 提供商
配置该角色,以使用时间服务器 classroom.example.com
配置该角色,以启用 iburst 参数
[student@ansible ansible]$ sudo dnf -y install rhel-system-roles-1.7.3-2.el8.noarch
[student@ansible ansible]$ cp -r /usr/share/ansible/roles/rhel-system-roles.timesync/ /home/student/ansible/roles/timesync
[student@ansible ansible]$ vim timesync.yml
---
- name: test
hosts: all
vars:
timesync_ntp_servers:
- hostname: classroom.example.com
iburst: yes
roles:
- timesync
[student@ansible ansible]$ ansible-playbook timesync.yml
PLAY [test] ********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [node1]
ok: [node3]
ok: [node2]
TASK [timesync : Set version specific variables] *******************************
ok: [node3]
ok: [node1]
ok: [node2]
TASK [timesync : Populate service facts] ***************************************
ok: [node3]
ok: [node2]
ok: [node1]
TASK [Set variable `timesync_services` with filtered uniq service names] *******
ok: [node1]
ok: [node2]
ok: [node3]
TASK [Check that variable 'timesync_services' is defined] **********************
ok: [node1] => {
"changed": false,
"msg": "All assertions passed"
}
ok: [node2] => {
"changed": false,
"msg": "All assertions passed"
}
ok: [node3] => {
"changed": false,
"msg": "All assertions passed"
}
TASK [timesync : Check if only NTP is needed] **********************************
ok: [node1]
ok: [node2]
ok: [node3]
TASK [timesync : Check if single PTP is needed] ********************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Check if both NTP and PTP are needed] *************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Determine current NTP provider] *******************************
ok: [node1]
ok: [node3]
ok: [node2]
TASK [timesync : Select NTP provider] ******************************************
ok: [node1]
ok: [node2]
ok: [node3]
TASK [timesync : Install chrony] ***********************************************
ok: [node3]
ok: [node2]
ok: [node1]
TASK [timesync : Install ntp] **************************************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Install linuxptp] *********************************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Gather package facts] *****************************************
ok: [node1]
ok: [node3]
ok: [node2]
TASK [timesync : Run phc_ctl on PTP interface] *********************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Check if PTP interface supports HW timestamping] **************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Generate chrony.conf file] ************************************
changed: [node2]
changed: [node1]
changed: [node3]
TASK [timesync : Generate chronyd sysconfig file] ******************************
changed: [node1]
changed: [node2]
changed: [node3]
TASK [timesync : Generate ntp.conf file] ***************************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Generate ntpd sysconfig file] *********************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Generate ptp4l.conf file] *************************************
skipping: [node1]
skipping: [node2]
skipping: [node3]
TASK [timesync : Generate ptp4l sysconfig file] **************