--- - name: sync time hosts: lichuan gather_facts: false tasks: - name: SELINUX=disabled selinux: state=disabled - name: iptables stop shell: systemctl stop firewalld && systemctl disable firewalld - name: add dns copy: src=/etc/ansible/roles/files/resolv.conf dest=/etc/resolv.conf owner=root group=root mode=0644 - name: install and sync time block: - name: install ntpdate yum: name: ntpdate state: present - name: ntpdate to sync time shell: | ntpdate ntp1.aliyun.com hwclock -w
标签:name,ntp,time,sync,resolv,ansible,ntpdate,安装 From: https://www.cnblogs.com/litzhiai/p/17040447.html