--- - hosts: cns tasks: - name: Install required kernel modules on CNS nodes import_role: name: openshift_storage_glusterfs tasks_from: kernel_modules.yml - name: Restart dnsmasq to make our custom configs take effect hosts: allnodes tasks: - service: name: dnsmasq state: restarted - hosts: single_master tasks: - name: Perform actions on master node which are required to install CNS import_role: name: openshift_storage_glusterfs vars: openshift_storage_glusterfs_name: 'storage' openshift_storage_glusterfs_namespace: 'storage' openshift_storage_glusterfs_is_native: true openshift_storage_glusterfs_storageclass: true openshift_storage_glusterfs_block_storageclass: true openshift_storage_glusterfs_s3_deploy: false openshift_storage_glusterfs_heketi_admin_key: "{{ (dp_tool_heketi_admin_key.strip() != '') | ternary(dp_tool_heketi_admin_key.strip(), omit) }}" openshift_storage_glusterfs_heketi_user_key: "{{ (dp_tool_heketi_user_key.strip() != '') | ternary(dp_tool_heketi_user_key.strip(), omit) }}" openshift_storage_glusterfs_heketi_topology_load: true - name: Allow to expand PVCs using 'glusterfs' storageclass. oc_edit: kind: sc name: glusterfs-{{ glusterfs_name }} content: allowVolumeExpansion: true when: openshift_vers not in ['v3_6', 'v3_7'] - name: Get IP address of the node with router hosts: single_master tasks: - command: "oc get endpoints router -o=custom-columns=:.subsets[*].addresses[0].ip -n default" register: router_get - set_fact: router_ip: "{{ router_get.stdout_lines[1].strip() }}" delegate_to: "{{ item }}" delegate_facts: True with_items: "{{ groups['allnodes'] }}" - name: Update dnsmasq config with custom domain zone for apps hosts: allnodes tasks: - lineinfile: path: /etc/dnsmasq.conf line: "address=/.{{ app_dns_prefix }}.{{ dns_zone }}/{{ router_ip }}" - service: name: dnsmasq state: restarted - hosts: single_master tasks: - name: Get IPv4 address of the main master node command: "python -c \"import yaml ; config = yaml.load(open('/etc/origin/master/master-config.yaml', 'r')); print(config['kubernetesMasterConfig']['masterIP']) \"" register: master_ipv4 - set_fact: master_ipv4: "{{ master_ipv4.stdout_lines[0] }}" - name: Read Heketi dc name shell: "oc get dc -n storage | grep heketi | awk '{ print $1}'" register: heketi_dc_name_raw - name: Read Heketi svc name shell: "oc get svc -n storage | grep -e heketi | grep -v heketi-db | awk '{ print $1}'" register: heketi_svc_name_raw - name: Save Heketi DC and SVC names in separate vars set_fact: heketi_dc_name: "{{ heketi_dc_name_raw.stdout.strip() }}" heketi_svc_name: "{{ heketi_svc_name_raw.stdout.strip() }}" - command: "oc patch svc {{ heketi_svc_name }} --namespace storage -p '{\"spec\":{\"externalIPs\":[\"{{ master_ipv4 }}\"]}}'" run_once: true # Following updates config file # which is required for automated tests from 'cns-automation' repo - name: Update 'cns-automation' config file hosts: localhost tasks: - set_fact: master_ipv4: "{{ hostvars[groups['single_master'][0]].master_ipv4 }}" - yedit: src: "{{ cns_automation_config_file_path }}" state: present edits: - key: openshift.storage_project_name value: "storage" - key: openshift.heketi_config.heketi_dc_name value: "{{ hostvars[groups['single_master'][0]].heketi_dc_name }}" - key: openshift.heketi_config.heketi_service_name value: "{{ hostvars[groups['single_master'][0]].heketi_svc_name }}" - key: openshift.heketi_config.heketi_client_node value: "{{ master_ipv4 }}" - key: openshift.heketi_config.heketi_server_url value: "http://{{ master_ipv4 }}:8080" - key: openshift.heketi_config.heketi_cli_user value: 'admin' - key: openshift.heketi_config.heketi_cli_key value: "{{ dp_tool_heketi_admin_key }}" - key: openshift.dynamic_provisioning.storage_classes value: file_storage_class: provisioner: "kubernetes.io/glusterfs" resturl: "http://{{ master_ipv4 }}:8080" restuser: "admin" secretnamespace: "storage" volumenameprefix: "autotests-file" block_storage_class: provisioner: "gluster.org/glusterblock" resturl: "http://{{ master_ipv4 }}:8080" restuser: "admin" restsecretnamespace: "storage" volumenameprefix: "autotests-block" hacount: "3" chapauthenabled: "true" when: cns_automation_config_file_path | length > 0 run_once: true - name: Install 'heketi-client' package on all the master nodes hosts: master gather_facts: no tasks: - name: Get Heketi POD name on master node command: "oc get pods -l glusterfs=heketi-storage-pod --no-headers {{ '' }}-o=custom-columns=:.metadata.name --namespace storage" register: heketi_pod_name - name: Read heketi-client package version from Heketi POD shell: "oc exec --namespace storage {{ heketi_pod_name.stdout_lines[0] }} -- rpm -q heketi-client --queryformat{{ '' }} '%{version}-%{release}\n' | cut -d '.' -f 1,2,3" register: heketi_client_version - name: Enable Gluster 3 repo on master node import_role: name: enable-gluster-repo - name: Remove existing heketi client from master node if present package: name: "heketi-client" state: absent retries: 5 delay: 5 register: result until: result is succeeded - name: Install heketi client on master node for CNS and CRS needs package: name: "heketi-client-{{heketi_client_version.stdout_lines[0].strip() }}*" state: present retries: 5 delay: 5 register: result until: result is succeeded