Skip to content

Instantly share code, notes, and snippets.

@AlexisDucastel
Created July 6, 2023 18:53
Show Gist options
  • Save AlexisDucastel/94e0e7e7f5c00e1574d3e6442721abec to your computer and use it in GitHub Desktop.
Save AlexisDucastel/94e0e7e7f5c00e1574d3e6442721abec to your computer and use it in GitHub Desktop.
Test ansible pull
- hosts: all
become: yes
tasks:
# Install specified packages
- name: Install specified packages
ansible.builtin.package:
name: "{{ item }}"
state: present
loop:
- htop
- ntop
- iftop
- nvme-cli
- apparmor
- ntp
- name: Stop and disable systemd timesyncd service
ansible.builtin.systemd:
name: systemd-timesyncd
state: stopped
enabled: no
- name: Configure NTP servers
ansible.builtin.blockinfile:
path: /etc/ntp.conf
block: |
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server time1.google.com iburst
server time2.google.com iburst
server time3.google.com iburst
server time4.google.com iburst
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery
- name: Start and enable NTP
ansible.builtin.systemd:
name: ntp
state: started
enabled: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment