File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ - hosts : all
3+ gather_facts : no
4+
5+ roles :
6+ - { role: package_ntp, tags "ntp" }
Original file line number Diff line number Diff line change 1+ ---
2+ - hosts : all
3+ gather_facts : no
4+ tasks :
5+
6+ # pl test on test box
7+ - name : Froce ntp update
8+ sudo : yes
9+ shell :
10+ " service ntp stop && /usr/sbin/ntpdate pool.ntp.org && service ntp start"
Original file line number Diff line number Diff line change 1+ ---
2+ - hosts : all
3+ gather_facts : no
4+ tasks :
5+ - fail : msg="`name` needs to be defined for this role"
6+ when : name is not defined
7+
8+ - name : restart {{ name }}
9+ sudo : yes
10+ service :
11+ name={{ name }}
12+ state=restarted
Original file line number Diff line number Diff line change 1+ ---
2+ ntp_servers :
3+ - 0.north-america.pool.ntp.org
4+ - 1.north-america.pool.ntp.org
5+ - 2.north-america.pool.ntp.org
6+ - 3.north-america.pool.ntp.org
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Start and Enable ntp
3+ sudo : yes
4+ service :
5+ name=ntp
6+ state=started
7+ enabled=yes
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Install ntp package
3+ sudo : yes
4+ apt :
5+ name=ntp
6+ state=present
7+ force=yes
8+ update_cache=yes
9+ cache_valid_time=604800
10+
11+ - name : Copy the ntp.conf template file
12+ sudo : yes
13+ template :
14+ src=ntp.conf.j2
15+ dest=/etc/ntp.conf
16+ mode=0644
17+ notify : Start and Enable ntp
18+
Original file line number Diff line number Diff line change 1+ # {{ ansible_managed }}
2+
3+ driftfile /var/lib/ntp/ntp.drift
4+
5+ statsdir /var/log/ntpstats/
6+ statistics loopstats peerstats clockstats
7+ filegen loopstats file loopstats type day enable
8+ filegen peerstats file peerstats type day enable
9+ filegen clockstats file clockstats type day enable
10+
11+ restrict -4 default kdo notrap nomodify nopeer noquery
12+ restrict -6 default kdo notrap nomodify nopeer noquery
13+
14+ restrict 127.0.0.1
15+ restrict ::1
16+
17+ {% for server in ntp_servers %}
18+ server {{ server }} iburst
19+ {% endfor %}
You can’t perform that action at this time.
0 commit comments