Browse Source

Remove meta depends from clock

This role removes openshift_fact meta depends from clock role.
Michael Gugino 7 years ago
parent
commit
6dde91d934

+ 2 - 0
roles/openshift_clock/defaults/main.yml

@@ -0,0 +1,2 @@
+---
+openshift_clock_enabled: True

+ 1 - 2
roles/openshift_clock/meta/main.yml

@@ -11,5 +11,4 @@ galaxy_info:
     - 7
   categories:
   - cloud
-dependencies:
-- { role: openshift_facts }
+dependencies: []

+ 9 - 8
roles/openshift_clock/tasks/main.yaml

@@ -1,14 +1,15 @@
 ---
-- name: Set clock facts
-  openshift_facts:
-    role: clock
-    local_facts:
-      enabled: "{{ openshift_clock_enabled | default(None) }}"
+- name: Determine if chrony is installed
+  command: rpm -q chrony
+  failed_when: false
+  register: chrony_installed
 
 - name: Install ntp package
   package: name=ntp state=present
-  when: openshift.clock.enabled | bool and not openshift.clock.chrony_installed | bool
+  when:
+    - openshift_clock_enabled | bool
+    - chrony_installed.rc != 0
 
 - name: Start and enable ntpd/chronyd
-  shell: timedatectl set-ntp true
-  when: openshift.clock.enabled | bool
+  command: timedatectl set-ntp true
+  when: openshift_clock_enabled | bool

+ 0 - 8
roles/openshift_facts/library/openshift_facts.py

@@ -1909,7 +1909,6 @@ class OpenShiftFacts(object):
     """
     known_roles = ['builddefaults',
                    'buildoverrides',
-                   'clock',
                    'cloudprovider',
                    'common',
                    'docker',
@@ -2099,13 +2098,6 @@ class OpenShiftFacts(object):
             docker['service_name'] = 'docker'
             defaults['docker'] = docker
 
-        if 'clock' in roles:
-            exit_code, _, _ = module.run_command(['rpm', '-q', 'chrony'])  # noqa: F405
-            chrony_installed = bool(exit_code == 0)
-            defaults['clock'] = dict(
-                enabled=True,
-                chrony_installed=chrony_installed)
-
         if 'cloudprovider' in roles:
             defaults['cloudprovider'] = dict(kind=None)