From a7bd843d566f1777a2705fc6e7ad7e4d397619e8 Mon Sep 17 00:00:00 2001 From: Jeremiah Stuever Date: Fri, 18 Mar 2016 16:45:47 -0400 Subject: Allow clock role in openshift_facts --- roles/openshift_facts/library/openshift_facts.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index b13343776..6daaf6822 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1549,6 +1549,7 @@ class OpenShiftFacts(object): OpenShiftFactsUnsupportedRoleError: """ known_roles = ['builddefaults', + 'clock', 'cloudprovider', 'common', 'docker', @@ -1719,6 +1720,16 @@ class OpenShiftFacts(object): docker['version'] = version_info['version'] defaults['docker'] = docker + if 'clock' in roles: + exit_code, _, _ = module.run_command(['rpm', '-q', 'chrony']) + if exit_code == 0: + chrony_installed = True + else: + chrony_installed = False + defaults['clock'] = dict( + enabled=True, + chrony_installed=chrony_installed) + if 'cloudprovider' in roles: defaults['cloudprovider'] = dict(kind=None) -- cgit v1.2.3 From 8341cd6bed765d0a8a180290a67ed5e62e7e003b Mon Sep 17 00:00:00 2001 From: Jeremiah Stuever Date: Fri, 18 Mar 2016 18:45:19 -0400 Subject: Add openshift_clock role to manage system clocks --- roles/openshift_clock/meta/main.yml | 15 +++++++++++++++ roles/openshift_clock/tasks/main.yaml | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 roles/openshift_clock/meta/main.yml create mode 100644 roles/openshift_clock/tasks/main.yaml diff --git a/roles/openshift_clock/meta/main.yml b/roles/openshift_clock/meta/main.yml new file mode 100644 index 000000000..3e175beb0 --- /dev/null +++ b/roles/openshift_clock/meta/main.yml @@ -0,0 +1,15 @@ +--- +galaxy_info: + author: Jeremiah Stuever + description: OpenShift Clock + company: Red Hat, Inc. + license: Apache License, Version 2.0 + min_ansible_version: 1.9 + platforms: + - name: EL + versions: + - 7 + categories: + - cloud +dependencies: +- { role: openshift_facts } diff --git a/roles/openshift_clock/tasks/main.yaml b/roles/openshift_clock/tasks/main.yaml new file mode 100644 index 000000000..5a8403f68 --- /dev/null +++ b/roles/openshift_clock/tasks/main.yaml @@ -0,0 +1,14 @@ +--- +- name: Set clock facts + openshift_facts: + role: clock + local_facts: + enabled: "{{ openshift_clock_enabled | default(None) }}" + +- name: Install ntp package + action: "{{ ansible_pkg_mgr }} name=ntp state=present" + when: openshift.clock.enabled | bool and not openshift.clock.chrony_installed | bool + +- name: Start and enable ntpd/chronyd + shell: timedatectl set-ntp true + when: openshift.clock.enabled | bool -- cgit v1.2.3 From 4e26dbf34ecd2c115beb097de34b22b91e365231 Mon Sep 17 00:00:00 2001 From: Jeremiah Stuever Date: Fri, 18 Mar 2016 18:46:32 -0400 Subject: Enable openshift_clock role for openshift_master, openshift_node, and openshift_etcd --- roles/openshift_etcd/meta/main.yml | 1 + roles/openshift_master/meta/main.yml | 1 + roles/openshift_node/meta/main.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/roles/openshift_etcd/meta/main.yml b/roles/openshift_etcd/meta/main.yml index 7cc548f69..de36b201b 100644 --- a/roles/openshift_etcd/meta/main.yml +++ b/roles/openshift_etcd/meta/main.yml @@ -13,6 +13,7 @@ galaxy_info: - cloud dependencies: - role: openshift_etcd_facts +- role: openshift_clock - role: openshift_docker when: openshift.common.is_containerized | bool - role: etcd diff --git a/roles/openshift_master/meta/main.yml b/roles/openshift_master/meta/main.yml index d8834d27f..0a69b3eef 100644 --- a/roles/openshift_master/meta/main.yml +++ b/roles/openshift_master/meta/main.yml @@ -12,6 +12,7 @@ galaxy_info: categories: - cloud dependencies: +- role: openshift_clock - role: openshift_docker - role: openshift_cli - role: openshift_cloud_provider diff --git a/roles/openshift_node/meta/main.yml b/roles/openshift_node/meta/main.yml index db1776632..31547b846 100644 --- a/roles/openshift_node/meta/main.yml +++ b/roles/openshift_node/meta/main.yml @@ -12,6 +12,7 @@ galaxy_info: categories: - cloud dependencies: +- role: openshift_clock - role: openshift_docker - role: openshift_cloud_provider - role: openshift_common -- cgit v1.2.3 From 2eadb105d5d55c0c283bec33cd2c33bca1b5361a Mon Sep 17 00:00:00 2001 From: Jeremiah Stuever Date: Mon, 21 Mar 2016 17:10:13 -0400 Subject: Adding openshift_clock parameters to example inventory files --- inventory/byo/hosts.aep.example | 2 ++ inventory/byo/hosts.origin.example | 3 +++ inventory/byo/hosts.ose.example | 3 +++ 3 files changed, 8 insertions(+) diff --git a/inventory/byo/hosts.aep.example b/inventory/byo/hosts.aep.example index c31d39d59..634d043f7 100644 --- a/inventory/byo/hosts.aep.example +++ b/inventory/byo/hosts.aep.example @@ -408,6 +408,8 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', # masterConfig.volumeConfig.dynamicProvisioningEnabled, configurable as of 1.2/3.2, enabled by default #openshift_master_dynamic_provisioning_enabled=False +# Configure usage of openshift_clock role. +#openshift_clock_enabled=true # host group for masters [masters] diff --git a/inventory/byo/hosts.origin.example b/inventory/byo/hosts.origin.example index 3a7842a33..bea6de7cd 100644 --- a/inventory/byo/hosts.origin.example +++ b/inventory/byo/hosts.origin.example @@ -413,6 +413,9 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', # masterConfig.volumeConfig.dynamicProvisioningEnabled, configurable as of 1.2/3.2, enabled by default #openshift_master_dynamic_provisioning_enabled=False +# Configure usage of openshift_clock role. +#openshift_clock_enabled=true + # host group for masters [masters] ose3-master[1:3]-ansible.test.example.com diff --git a/inventory/byo/hosts.ose.example b/inventory/byo/hosts.ose.example index cb46c352e..4ab8fa988 100644 --- a/inventory/byo/hosts.ose.example +++ b/inventory/byo/hosts.ose.example @@ -409,6 +409,9 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', # masterConfig.volumeConfig.dynamicProvisioningEnabled, configurable as of 1.2/3.2, enabled by default #openshift_master_dynamic_provisioning_enabled=False +# Configure usage of openshift_clock role. +#openshift_clock_enabled=true + # host group for masters [masters] ose3-master[1:3]-ansible.test.example.com -- cgit v1.2.3