ansible 安装 ntp

---
- 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

 

posted @ 2023-01-10 15:22  大川哥  阅读(98)  评论(0编辑  收藏  举报