From 9802775b6642d4257b4b2cd9a4e27a4a86bf01d8 Mon Sep 17 00:00:00 2001 From: Matt Woodson Date: Mon, 18 Jan 2016 15:21:04 -0500 Subject: added chrony --- roles/chrony/README.md | 31 ++++++++++++++++++++++++ roles/chrony/defaults/main.yml | 2 ++ roles/chrony/handlers/main.yml | 5 ++++ roles/chrony/meta/main.yml | 18 ++++++++++++++ roles/chrony/tasks/main.yml | 30 +++++++++++++++++++++++ roles/chrony/templates/chrony.conf.j2 | 45 +++++++++++++++++++++++++++++++++++ roles/chrony/vars/main.yml | 2 ++ 7 files changed, 133 insertions(+) create mode 100644 roles/chrony/README.md create mode 100644 roles/chrony/defaults/main.yml create mode 100644 roles/chrony/handlers/main.yml create mode 100644 roles/chrony/meta/main.yml create mode 100644 roles/chrony/tasks/main.yml create mode 100644 roles/chrony/templates/chrony.conf.j2 create mode 100644 roles/chrony/vars/main.yml (limited to 'roles/chrony') diff --git a/roles/chrony/README.md b/roles/chrony/README.md new file mode 100644 index 000000000..688bec86a --- /dev/null +++ b/roles/chrony/README.md @@ -0,0 +1,31 @@ +Role Name +========= + +A role to configure chrony as the ntp client + +Requirements +------------ + + +Role Variables +-------------- + +opschrony_ntp_servers: a list of ntp servers to use the chrony.conf file + +Dependencies +------------ + +ops_roles/lib_timedatectl + +Example Playbook +---------------- + +License +------- + +Apache 2.0 + +Author Information +------------------ + +Openshift Operations diff --git a/roles/chrony/defaults/main.yml b/roles/chrony/defaults/main.yml new file mode 100644 index 000000000..95576e666 --- /dev/null +++ b/roles/chrony/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for chrony diff --git a/roles/chrony/handlers/main.yml b/roles/chrony/handlers/main.yml new file mode 100644 index 000000000..1973c79e2 --- /dev/null +++ b/roles/chrony/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart chronyd + service: + name: chronyd + state: restarted diff --git a/roles/chrony/meta/main.yml b/roles/chrony/meta/main.yml new file mode 100644 index 000000000..2c61018ad --- /dev/null +++ b/roles/chrony/meta/main.yml @@ -0,0 +1,18 @@ +--- +galaxy_info: + author: Openshift Operations + description: Configure chrony as an ntp server + company: Red Hat + license: Apache 2.0 + min_ansible_version: 1.9.2 + platforms: + - name: EL + versions: + - 7 + - name: Fedora + versions: + - all + categories: + - system +dependencies: +- ops_roles/lib_timedatectl diff --git a/roles/chrony/tasks/main.yml b/roles/chrony/tasks/main.yml new file mode 100644 index 000000000..fae6d8e4c --- /dev/null +++ b/roles/chrony/tasks/main.yml @@ -0,0 +1,30 @@ +--- +- name: remove ntp package + yum: + name: ntp + state: absent + +- name: ensure chrony package is installed + yum: + name: chrony + state: installed + +- name: Install /etc/chrony.conf + template: + src: chrony.conf.j2 + dest: /etc/chrony.conf + owner: root + group: root + mode: 0644 + notify: + - Restart chronyd + +- name: enabled timedatectl set-ntp yes + timedatectl: + ntp: True + +- name: + service: + name: chronyd + state: started + enabled: yes diff --git a/roles/chrony/templates/chrony.conf.j2 b/roles/chrony/templates/chrony.conf.j2 new file mode 100644 index 000000000..ab50ce1b1 --- /dev/null +++ b/roles/chrony/templates/chrony.conf.j2 @@ -0,0 +1,45 @@ +# Use public servers from the pool.ntp.org project. +# Please consider joining the pool (http://www.pool.ntp.org/join.html). +{% for server in opschrony_ntp_servers %} +server {{ server }} iburst +{% endfor %} + +# Ignore stratum in source selection. +stratumweight 0 + +# Record the rate at which the system clock gains/losses time. +driftfile /var/lib/chrony/drift + +# Enable kernel RTC synchronization. +rtcsync + +# In first three updates step the system clock instead of slew +# if the adjustment is larger than 10 seconds. +makestep 10 3 + +# Allow NTP client access from local network. +#allow 192.168/16 + +# Listen for commands only on localhost. +bindcmdaddress 127.0.0.1 +bindcmdaddress ::1 + +# Serve time even if not synchronized to any NTP server. +#local stratum 10 + +keyfile /etc/chrony.keys + +# Specify the key used as password for chronyc. +commandkey 1 + +# Generate command key if missing. +generatecommandkey + +# Disable logging of client accesses. +noclientlog + +# Send a message to syslog if a clock adjustment is larger than 0.5 seconds. +logchange 0.5 + +logdir /var/log/chrony +#log measurements statistics tracking diff --git a/roles/chrony/vars/main.yml b/roles/chrony/vars/main.yml new file mode 100644 index 000000000..061a21547 --- /dev/null +++ b/roles/chrony/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for chrony -- cgit v1.2.3 From a1c9b13d81d8c94c7764524809f5419a5d3ff73d Mon Sep 17 00:00:00 2001 From: Matt Woodson Date: Mon, 18 Jan 2016 15:24:28 -0500 Subject: added the lib_timedate role --- roles/chrony/README.md | 4 ++-- roles/chrony/meta/main.yml | 2 +- roles/chrony/templates/chrony.conf.j2 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'roles/chrony') diff --git a/roles/chrony/README.md b/roles/chrony/README.md index 688bec86a..bf15d9669 100644 --- a/roles/chrony/README.md +++ b/roles/chrony/README.md @@ -10,12 +10,12 @@ Requirements Role Variables -------------- -opschrony_ntp_servers: a list of ntp servers to use the chrony.conf file +chrony_ntp_servers: a list of ntp servers to use the chrony.conf file Dependencies ------------ -ops_roles/lib_timedatectl +roles/lib_timedatectl Example Playbook ---------------- diff --git a/roles/chrony/meta/main.yml b/roles/chrony/meta/main.yml index 2c61018ad..85595d7c3 100644 --- a/roles/chrony/meta/main.yml +++ b/roles/chrony/meta/main.yml @@ -15,4 +15,4 @@ galaxy_info: categories: - system dependencies: -- ops_roles/lib_timedatectl +- roles/lib_timedatectl diff --git a/roles/chrony/templates/chrony.conf.j2 b/roles/chrony/templates/chrony.conf.j2 index ab50ce1b1..de43b6364 100644 --- a/roles/chrony/templates/chrony.conf.j2 +++ b/roles/chrony/templates/chrony.conf.j2 @@ -1,6 +1,6 @@ # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). -{% for server in opschrony_ntp_servers %} +{% for server in chrony_ntp_servers %} server {{ server }} iburst {% endfor %} -- cgit v1.2.3