diff options
author | ewolinetz <ewolinet@redhat.com> | 2017-04-27 13:52:39 -0500 |
---|---|---|
committer | ewolinetz <ewolinet@redhat.com> | 2017-04-27 13:52:39 -0500 |
commit | 5a0d8dc1cc637f78c0d1321d86f51af2184a9e07 (patch) | |
tree | 6268d4a2c48ee4dd05708e102b922e6cc6852bec /roles/openshift_logging | |
parent | 38e832422a92124bd17a97f4cf65f4bec55cb516 (diff) | |
download | openshift-5a0d8dc1cc637f78c0d1321d86f51af2184a9e07.tar.gz openshift-5a0d8dc1cc637f78c0d1321d86f51af2184a9e07.tar.bz2 openshift-5a0d8dc1cc637f78c0d1321d86f51af2184a9e07.tar.xz openshift-5a0d8dc1cc637f78c0d1321d86f51af2184a9e07.zip |
Adding way to add labels and nodeselectors to logging project
Diffstat (limited to 'roles/openshift_logging')
-rw-r--r-- | roles/openshift_logging/defaults/main.yml | 4 | ||||
-rw-r--r-- | roles/openshift_logging/tasks/install_support.yaml | 41 |
2 files changed, 34 insertions, 11 deletions
diff --git a/roles/openshift_logging/defaults/main.yml b/roles/openshift_logging/defaults/main.yml index 5ee8d1e2a..dbf5b4d3d 100644 --- a/roles/openshift_logging/defaults/main.yml +++ b/roles/openshift_logging/defaults/main.yml @@ -3,6 +3,10 @@ openshift_logging_use_ops: "{{ openshift_hosted_logging_enable_ops_cluster | def openshift_logging_master_url: "https://kubernetes.default.svc.{{ openshift.common.dns_domain }}" openshift_logging_master_public_url: "{{ openshift_hosted_logging_master_public_url | default('https://' + openshift.common.public_hostname + ':' ~ (openshift_master_api_port | default('8443', true))) }}" openshift_logging_namespace: logging +openshift_logging_nodeselector: null +openshift_logging_labels: {} +openshift_logging_label_key: "" +openshift_logging_label_value: "" openshift_logging_install_logging: True openshift_logging_image_pull_secret: "{{ openshift_hosted_logging_image_pull_secret | default('') }}" diff --git a/roles/openshift_logging/tasks/install_support.yaml b/roles/openshift_logging/tasks/install_support.yaml index da0bbb627..877ce3149 100644 --- a/roles/openshift_logging/tasks/install_support.yaml +++ b/roles/openshift_logging/tasks/install_support.yaml @@ -1,17 +1,36 @@ --- # This is the base configuration for installing the other components -- name: Check for logging project already exists - command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get project {{openshift_logging_namespace}} --no-headers - register: logging_project_result - ignore_errors: yes - when: not ansible_check_mode - changed_when: no +- name: Set logging project + oc_project: + state: present + name: "{{ openshift_logging_namespace }}" + node_selector: "{{ openshift_logging_nodeselector | default(null) }}" + +- name: Labelling logging project + oc_label: + state: present + kind: namespace + name: "{{ openshift_logging_namespace }}" + labels: + - key: "{{ item.key }}" + value: "{{ item.value }}" + with_dict: "{{ openshift_logging_labels | default({}) }}" + when: + - openshift_logging_labels is defined + - openshift_logging_labels is dict -- name: "Create logging project" - command: > - {{ openshift.common.admin_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig new-project {{openshift_logging_namespace}} - when: not ansible_check_mode and "not found" in logging_project_result.stderr +- name: Labelling logging project + oc_label: + state: present + kind: namespace + name: "{{ openshift_logging_namespace }}" + labels: + - key: "{{ openshift_logging_label_key }}" + value: "{{ openshift_logging_label_value }}" + when: + - openshift_logging_label_key is defined + - openshift_logging_label_key != "" + - openshift_logging_label_value is defined - name: Create logging cert directory file: path={{openshift.common.config_base}}/logging state=directory mode=0755 |