diff options
13 files changed, 65 insertions, 1 deletions
diff --git a/playbooks/adhoc/openshift_hosted_logging_efk.yaml b/playbooks/adhoc/openshift_hosted_logging_efk.yaml index def1d24e0..0b30a221d 100644 --- a/playbooks/adhoc/openshift_hosted_logging_efk.yaml +++ b/playbooks/adhoc/openshift_hosted_logging_efk.yaml @@ -3,3 +3,14 @@ roles: - role: openshift_hosted_logging openshift_hosted_logging_cleanup: no + +- name: Update master-config for publicLoggingURL + hosts: masters:!masters[0] + pre_tasks: + - set_fact: + logging_hostname: "{{ openshift_hosted_logging_hostname | default('kibana.' ~ (openshift_master_default_subdomain | default('router.default.svc.cluster.local', true))) }}" + tasks: + - include_role: + name: openshift_hosted_logging + tasks_from: update_master_config + when: openshift_hosted_logging_deploy | default(false) | bool diff --git a/playbooks/common/openshift-cluster/openshift_hosted.yml b/playbooks/common/openshift-cluster/openshift_hosted.yml index ec5b18389..021d19dad 100644 --- a/playbooks/common/openshift-cluster/openshift_hosted.yml +++ b/playbooks/common/openshift-cluster/openshift_hosted.yml @@ -45,3 +45,14 @@ - role: cockpit-ui when: ( openshift.common.version_gte_3_3_or_1_3 | bool ) and ( openshift_hosted_manage_registry | default(true) | bool ) and not (openshift.docker.hosted_registry_insecure | default(false) | bool) + +- name: Update master-config for publicLoggingURL + hosts: masters:!oo_first_master + pre_tasks: + - set_fact: + logging_hostname: "{{ openshift_hosted_logging_hostname | default('kibana.' ~ (openshift_master_default_subdomain | default('router.default.svc.cluster.local', true))) }}" + tasks: + - include_role: + name: openshift_hosted_logging + tasks_from: update_master_config + when: openshift_hosted_logging_deploy | default(false) | boola diff --git a/playbooks/common/openshift-cluster/openshift_logging.yml b/playbooks/common/openshift-cluster/openshift_logging.yml index 6347cbc26..82f18f5e1 100644 --- a/playbooks/common/openshift-cluster/openshift_logging.yml +++ b/playbooks/common/openshift-cluster/openshift_logging.yml @@ -3,3 +3,11 @@ hosts: oo_first_master roles: - openshift_logging + +- name: Update Master configs + hosts: masters:!oo_first_master + tasks: + - include_role: + name: openshift_logging + tasks_from: update_master_config + when: openshift_logging_install_logging | default(false) | bool diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index c7282d23d..60c564e5b 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1022,7 +1022,7 @@ def set_nodename(facts): if 'cloudprovider' in facts and facts['cloudprovider']['kind'] == 'openstack': facts['node']['nodename'] = facts['provider']['metadata']['hostname'].replace('.novalocal', '') elif 'cloudprovider' in facts and facts['cloudprovider']['kind'] == 'gce': - facts['node']['nodename'] = '.'.split(facts['provider']['metadata']['hostname'])[0] + facts['node']['nodename'] = facts['provider']['metadata']['instance']['hostname'].split('.')[0] else: facts['node']['nodename'] = facts['common']['hostname'].lower() return facts diff --git a/roles/openshift_hosted_logging/handlers/main.yml b/roles/openshift_hosted_logging/handlers/main.yml new file mode 100644 index 000000000..ad79e62ae --- /dev/null +++ b/roles/openshift_hosted_logging/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart master + systemd: name={{ openshift.common.service_type }}-master state=restarted + when: (openshift.master.ha is not defined or not openshift.master.ha | bool) and (not (master_service_status_changed | default(false) | bool)) + notify: Verify API Server diff --git a/roles/openshift_hosted_logging/meta/main.yaml b/roles/openshift_hosted_logging/meta/main.yaml index b695bde87..044c8043c 100644 --- a/roles/openshift_hosted_logging/meta/main.yaml +++ b/roles/openshift_hosted_logging/meta/main.yaml @@ -1,3 +1,4 @@ --- dependencies: - { role: openshift_common } + - { role: openshift_master_facts } diff --git a/roles/openshift_hosted_logging/tasks/deploy_logging.yaml b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml index 513a74c69..afd82766f 100644 --- a/roles/openshift_hosted_logging/tasks/deploy_logging.yaml +++ b/roles/openshift_hosted_logging/tasks/deploy_logging.yaml @@ -165,6 +165,8 @@ retries: 20 delay: 15 +- include: update_master_config.yaml + - debug: msg: "Logging components deployed. Note persistent volume for elasticsearch must be setup manually" diff --git a/roles/openshift_hosted_logging/tasks/update_master_config.yaml b/roles/openshift_hosted_logging/tasks/update_master_config.yaml new file mode 100644 index 000000000..1122e059c --- /dev/null +++ b/roles/openshift_hosted_logging/tasks/update_master_config.yaml @@ -0,0 +1,7 @@ +--- +- name: Adding Kibana route information to loggingPublicURL + modify_yaml: + dest: "{{ openshift.common.config_base }}/master/master-config.yaml" + yaml_key: assetConfig.loggingPublicURL + yaml_value: "https://{{ logging_hostname }}" + notify: restart master diff --git a/roles/openshift_logging/handlers/main.yml b/roles/openshift_logging/handlers/main.yml new file mode 100644 index 000000000..ad79e62ae --- /dev/null +++ b/roles/openshift_logging/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart master + systemd: name={{ openshift.common.service_type }}-master state=restarted + when: (openshift.master.ha is not defined or not openshift.master.ha | bool) and (not (master_service_status_changed | default(false) | bool)) + notify: Verify API Server diff --git a/roles/openshift_logging/meta/main.yaml b/roles/openshift_logging/meta/main.yaml index 9c480f73a..bc45dcdab 100644 --- a/roles/openshift_logging/meta/main.yaml +++ b/roles/openshift_logging/meta/main.yaml @@ -14,3 +14,4 @@ galaxy_info: dependencies: - role: lib_openshift - role: openshift_facts +- role: openshift_master_facts diff --git a/roles/openshift_logging/tasks/install_logging.yaml b/roles/openshift_logging/tasks/install_logging.yaml index 8a33498cd..00c79ee5e 100644 --- a/roles/openshift_logging/tasks/install_logging.yaml +++ b/roles/openshift_logging/tasks/install_logging.yaml @@ -48,6 +48,8 @@ loop_var: file when: not ansible_check_mode +- include: update_master_config.yaml + - name: Printing out objects to create debug: msg={{file.content | b64decode }} with_items: "{{ object_defs.results }}" diff --git a/roles/openshift_logging/tasks/main.yaml b/roles/openshift_logging/tasks/main.yaml index 4c718805e..36fb827c3 100644 --- a/roles/openshift_logging/tasks/main.yaml +++ b/roles/openshift_logging/tasks/main.yaml @@ -12,6 +12,10 @@ - debug: msg="Created temp dir {{mktemp.stdout}}" +- name: Ensuring ruamel.yaml package is on target + command: yum install -y ruamel.yaml + check_mode: no + - name: Copy the admin client config(s) command: > cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig diff --git a/roles/openshift_logging/tasks/update_master_config.yaml b/roles/openshift_logging/tasks/update_master_config.yaml new file mode 100644 index 000000000..af303c47c --- /dev/null +++ b/roles/openshift_logging/tasks/update_master_config.yaml @@ -0,0 +1,7 @@ +--- +- name: Adding Kibana route information to loggingPublicURL + modify_yaml: + dest: "{{ openshift.common.config_base }}/master/master-config.yaml" + yaml_key: assetConfig.loggingPublicURL + yaml_value: "https://{{ openshift_logging_kibana_hostname }}" + notify: restart master |