diff options
author | Thomas Wiest <twiest@users.noreply.github.com> | 2015-06-08 10:55:20 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@users.noreply.github.com> | 2015-06-08 10:55:20 -0400 |
commit | e03efb3d8570981ab818bf1b18c01e3573977ba3 (patch) | |
tree | 86f98f293cda97848e072aa292d2d86c017caed9 | |
parent | af8b0b25f5e572ab20e3c3efdba596bae7ae7563 (diff) | |
parent | 2283750d0ad8b24a823f034ebd6172526c535943 (diff) | |
download | openshift-e03efb3d8570981ab818bf1b18c01e3573977ba3.tar.gz openshift-e03efb3d8570981ab818bf1b18c01e3573977ba3.tar.bz2 openshift-e03efb3d8570981ab818bf1b18c01e3573977ba3.tar.xz openshift-e03efb3d8570981ab818bf1b18c01e3573977ba3.zip |
Merge pull request #268 from detiber/fluentdFact
add use_fluentd to openshift_facts
-rw-r--r-- | playbooks/common/openshift-master/config.yml | 6 | ||||
-rw-r--r-- | playbooks/common/openshift-node/config.yml | 6 | ||||
-rw-r--r-- | roles/openshift_common/tasks/main.yml | 1 | ||||
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 16 |
4 files changed, 24 insertions, 5 deletions
diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 4df64e95f..a9a4e6afc 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -5,8 +5,10 @@ openshift_sdn_master_url: https://{{ openshift.common.hostname }}:4001 roles: - openshift_master - - { role: openshift_sdn_master, when: openshift.common.use_openshift_sdn | bool } - - { role: fluentd_master, when openshift.common.use_fluentd | bool } + - role: openshift_sdn_master + when: openshift.common.use_openshift_sdn | bool + - role: fluentd_master + when: openshift.common.use_fluentd | bool tasks: - name: Create group for deployment type group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }} diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml index 70711e39b..55abedfe7 100644 --- a/playbooks/common/openshift-node/config.yml +++ b/playbooks/common/openshift-node/config.yml @@ -95,8 +95,10 @@ dest: "{{ openshift_node_cert_dir }}" roles: - openshift_node - - { role: openshift_sdn_node, when: openshift.common.use_openshift_sdn | bool } - - { role: fluentd_node, when: openshift.common.use_fluentd | bool } + - role: openshift_sdn_node + when: openshift.common.use_openshift_sdn | bool + - role: fluentd_node + when: openshift.common.use_fluentd | bool tasks: - name: Create group for deployment type group_by: key=oo_nodes_deployment_type_{{ openshift.common.deployment_type }} diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index 5bd8690a7..c55677c3f 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -10,7 +10,6 @@ public_hostname: "{{ openshift_public_hostname | default(None) }}" public_ip: "{{ openshift_public_ip | default(None) }}" use_openshift_sdn: "{{ openshift_use_openshift_sdn | default(None) }}" - use_fluentd: "{{ openshift_use_fluentd | default(True) }}" deployment_type: "{{ openshift_deployment_type }}" - name: Set hostname hostname: name={{ openshift.common.hostname }} diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 9c2657ff2..aff7d723e 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -288,6 +288,21 @@ def normalize_provider_facts(provider, metadata): facts = normalize_openstack_facts(metadata, facts) return facts +def set_fluentd_facts_if_unset(facts): + """ Set fluentd facts if not already present in facts dict + + Args: + facts (dict): existing facts + Returns: + dict: the facts dict updated with the generated fluentd facts if + missing + """ + if 'common' in facts: + deployment_type = facts['common']['deployment_type'] + if 'use_fluentd' not in facts['common']: + use_fluentd = True if deployment_type == 'online' else False + facts['common']['use_fluentd'] = use_fluentd + return facts def set_url_facts_if_unset(facts): """ Set url facts if not already present in facts dict @@ -560,6 +575,7 @@ class OpenShiftFacts(object): facts = merge_facts(facts, local_facts) facts['current_config'] = get_current_config(facts) facts = set_url_facts_if_unset(facts) + facts = set_fluentd_facts_if_unset(facts) return dict(openshift=facts) def get_defaults(self, roles): |