Skip to content

Instantly share code, notes, and snippets.

@jkilpatr
Created January 22, 2018 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkilpatr/55e01bfbf15c736e0cde0b7c4cf8fe7c to your computer and use it in GitHub Desktop.
Save jkilpatr/55e01bfbf15c736e0cde0b7c4cf8fe7c to your computer and use it in GitHub Desktop.
---
- name: Update ntp
hosts: controller:cephstorage
tasks:
- name: Disable ntp
service:
name: ntpd
state: stopped
become: true
- name: Change out the server
lineinfile:
state: absent
path: /etc/ntp.conf
line: "server {{old_ntp}}"
become: true
- name: Add new server
lineinfile:
state: present
path: /etc/ntp.conf
line: "server {{new_ntp}}"
become: true
- name: Manually update ntp
shell: "ntpdate -u {{new_ntp}}"
become: true
- name: enable ntp
service:
name: ntpd
state: started
become: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment