安装
[root@localhost ~]# yum install rhel-system-roles.noarch
时间同步角色
[root@localhost ~]# tree date/
date/
├── ansible.cfg
├── inventory
├── main.yml
└── timesync
├── ansible_pytest_extra_requirements.txt
├── COPYING
├── custom_requirements.txt
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── library
│ └── timesync_provider.sh
├── meta
│ └── main.yml
├── molecule_extra_requirements.txt
├── pylint_extra_requirements.txt
├── pylintrc
├── pytest_extra_requirements.txt
├── README.html
├── README.md
├── tasks
│ ├── main.yml
│ └── set_vars.yml
├── templates
│ ├── chrony.conf.j2
│ ├── chronyd.sysconfig.j2
│ ├── ntp.conf.j2
│ ├── ntpd.sysconfig.j2
│ ├── phc2sys.sysconfig.j2
│ ├── ptp4l.conf.j2
│ ├── ptp4l.sysconfig.j2
│ └── timemaster.conf.j2
├── tests
│ ├── inventory.yaml.j2
│ ├── provision.fmf
│ ├── roles
│ ├── setup-snapshot.yml
│ ├── tests_chrony.yml
│ ├── tests_default_vars.yml
│ ├── tests_default_wrapper.yml
│ ├── tests_default.yml
│ ├── tests_ntp_provider1.yml
│ ├── tests_ntp_provider2.yml
│ ├── tests_ntp_provider3.yml
│ ├── tests_ntp_provider4.yml
│ ├── tests_ntp_provider5.yml
│ ├── tests_ntp_provider6.yml
│ ├── tests_ntp_ptp.yml
│ ├── tests_ntp.yml
│ ├── tests_ptp_multi.yml
│ └── tests_ptp_single.yml
├── tox.ini
└── vars
├── CentOS_6.yml
├── CentOS_9.yml
├── Debian.yml
├── default.yml
├── Fedora_33.yml
├── main.yml
├── RedHat_6.yml
└── RedHat_9.yml
时间同步角色示例
创建date目录用于存放playbook和角色目录
[root@localhost ~]# mkdir date
#将timeync的目录复制一份到当前目录并改名为timeync
[root@localhost date