add ntp playbook and roles
This commit is contained in:
parent
ba22846931
commit
26f6adb53b
|
@ -42,6 +42,11 @@
|
|||
name: config-server-type
|
||||
tags: config-server-type_config
|
||||
|
||||
- name: "[CONFIG NTP] Install and configure ntp"
|
||||
import_role:
|
||||
name: config-ntp
|
||||
tags: config-ntp_config
|
||||
|
||||
#handlers:
|
||||
# - include_tasks: roles/{{ item }}/handlers/main.yaml
|
||||
# with_items:
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
|
||||
- hosts: "{{ ip_addr }}"
|
||||
become: yes
|
||||
become_method: sudo
|
||||
gather_facts: yes
|
||||
|
||||
tasks:
|
||||
|
||||
- name: "[CONFIG NTP] Install and configure ntp"
|
||||
import_role:
|
||||
name: config-ntp
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
# PLS do NOT delete timesyncing from VM virtuals
|
||||
# it is necessary for critical cluster services
|
||||
# nada
|
||||
|
||||
test -x /usr/sbin/ntpdate || exit 0
|
||||
/usr/sbin/ntpdate time1.verdnatura.es
|
||||
/usr/sbin/ntpdate time2.verdnatura.es
|
|
@ -0,0 +1,5 @@
|
|||
# restart crontab service to apply changes
|
||||
- name: restart crontab hourly
|
||||
service:
|
||||
name: "{{ cron_daemon }}"
|
||||
state: restarted
|
|
@ -0,0 +1,24 @@
|
|||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# Install and configure NTP
|
||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# paso1
|
||||
# install package ntpdate
|
||||
- name: install package ntpdate
|
||||
apt:
|
||||
name: "{{ ntpdate_package }}"
|
||||
state: present
|
||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# paso2
|
||||
# copy timesync file to crontab.hourly
|
||||
- name: copy file nslcd.conf
|
||||
copy:
|
||||
src: timesync
|
||||
dest: "{{ timesync_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: yes
|
||||
notify: restart crontab hourly
|
||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@ -0,0 +1,4 @@
|
|||
# vars file
|
||||
ntpdate_package: ntpdate
|
||||
timesync_path: /etc/cron.hourly/timesync
|
||||
cron_daemon: cron
|
Loading…
Reference in New Issue