From 1bdc5d565596d8666417099695978b1c57ea3f65 Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Fri, 31 Dec 2021 08:27:37 +0530 Subject: [PATCH 1/7] Added changes to enable installation on Ubuntu2004. --- ansible/roles/common/tasks/main.yml | 15 ++++- .../scenarios/container.yml | 16 ++--- .../scenarios/clean_gelato_ha.yml | 8 +-- ansible/roles/ha-ip-update/tasks/main.yml | 2 +- ansible/roles/osdsdb/scenarios/etcd.yml | 66 ++++++++++++++----- .../osdsdock/scenarios/cinder_standalone.yml | 15 ++++- ansible/script/keystone.sh | 8 +-- ansible/script/ministone.py | 47 ++++++------- 8 files changed, 120 insertions(+), 57 deletions(-) diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index d71cd9339..432cc9701 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -27,7 +27,7 @@ become: yes - name: run the equivalent of "apt-get update" as a separate step - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=20) apt: update_cache: yes @@ -42,6 +42,17 @@ - open-iscsi when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) +- name: install system packages on Ubuntu-20.04 + package: + name: "{{ item }}" + state: present + with_items: + - make + - gcc + - python3-pip + - open-iscsi + when: ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 + - name: Install system packages on CentoS or RHEL when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version >= "8" @@ -63,7 +74,7 @@ with_items: - librados-dev - librbd-dev - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=20) - name: create opensds work directory if it doesn't exist file: diff --git a/ansible/roles/dashboard-installer/scenarios/container.yml b/ansible/roles/dashboard-installer/scenarios/container.yml index 423843eab..13229e350 100644 --- a/ansible/roles/dashboard-installer/scenarios/container.yml +++ b/ansible/roles/dashboard-installer/scenarios/container.yml @@ -33,10 +33,10 @@ OPENSDS_S3_URL: "http://{{ host_ip }}:8090" OPENSDS_S3_HOST: "{{ host_ip }}" OPENSDS_S3_PORT: "8090" - SODA_PROMETHEUS_PORT: "{{ prometheus_port }}" - SODA_ALERTMANAGER_PORT: "{{ alertmanager_port }}" - SODA_GRAFANA_PORT: "{{ grafana_port }}" - STORAGE_SERVICE_PLAN_ENABLED: "{{ enable_storage_service_plans }}" + SODA_PROMETHEUS_PORT: "{{ prometheus_port|quote }}" + SODA_ALERTMANAGER_PORT: "{{ alertmanager_port|quote }}" + SODA_GRAFANA_PORT: "{{ grafana_port|quote }}" + STORAGE_SERVICE_PLAN_ENABLED: "{{ enable_storage_service_plans|string }}" SODA_ALERTMANAGER_URL: "http://{{ host_ip }}:{{ alertmanager_port }}" when: gelato_ha != true @@ -56,9 +56,9 @@ OPENSDS_S3_URL: "http://{{ gelato_ha_s3_ip }}:{{ gelato_ha_s3_port }}" OPENSDS_S3_HOST: "{{ gelato_ha_s3_ip }}" OPENSDS_S3_PORT: "{{ gelato_ha_s3_port }}" - SODA_PROMETHEUS_PORT: "{{ prometheus_port }}" - SODA_ALERTMANAGER_PORT: "{{ alertmanager_port }}" - SODA_GRAFANA_PORT: "{{ grafana_port }}" - STORAGE_SERVICE_PLAN_ENABLED: "{{ enable_storage_service_plans }}" + SODA_PROMETHEUS_PORT: "{{ prometheus_port|quote }}" + SODA_ALERTMANAGER_PORT: "{{ alertmanager_port|quote}}" + SODA_GRAFANA_PORT: "{{ grafana_port|quote}}" + STORAGE_SERVICE_PLAN_ENABLED: "{{ enable_storage_service_plans|string }}" SODA_ALERTMANAGER_URL: "http://{{ host_ip }}:{{ alertmanager_port }}" when: gelato_ha == true diff --git a/ansible/roles/gelato-ha-uninstaller/scenarios/clean_gelato_ha.yml b/ansible/roles/gelato-ha-uninstaller/scenarios/clean_gelato_ha.yml index cef188262..4af40b439 100644 --- a/ansible/roles/gelato-ha-uninstaller/scenarios/clean_gelato_ha.yml +++ b/ansible/roles/gelato-ha-uninstaller/scenarios/clean_gelato_ha.yml @@ -32,9 +32,9 @@ shell: "{{ item }}" become_user: "{{ k8s_user }}" with_items: - - "kubectl patch pvc mongo-0-pv-claim -p '\''{{patch_param }}'\'' --type=merge -n soda-multi-cloud" - - "kubectl patch pvc mongo-1-pv-claim -p '\''{{patch_param }}'\'' --type=merge -n soda-multi-cloud" - - "kubectl patch pvc mongo-2-pv-claim -p '\''{{patch_param }}'\'' --type=merge -n soda-multi-cloud" + - 'kubectl patch pvc mongo-0-pv-claim -p "\""{{patch_param }}"\"" --type=merge -n soda-multi-cloud' + - 'kubectl patch pvc mongo-1-pv-claim -p "\""{{patch_param }}"\"" --type=merge -n soda-multi-cloud' + - 'kubectl patch pvc mongo-2-pv-claim -p "\""{{patch_param }}"\"" --type=merge -n soda-multi-cloud' ignore_errors: yes - name: Pause for 2 seconds @@ -92,6 +92,6 @@ file: state: absent path: "{{ gelato_work_dir }}/multi-cloud/" - ignore_error: yes + ignore_error: yes become: yes diff --git a/ansible/roles/ha-ip-update/tasks/main.yml b/ansible/roles/ha-ip-update/tasks/main.yml index 271de160d..a05042f63 100644 --- a/ansible/roles/ha-ip-update/tasks/main.yml +++ b/ansible/roles/ha-ip-update/tasks/main.yml @@ -22,7 +22,7 @@ # Same IP is used for both the services. Only Port is different (predefined) - name: replace the gelato_ha_api_ip and gelato_ha_s3_ip in the gelato-ha.yml - hosts: controllers + # hosts: controllers replace: path: "{{ role_path }}/../../group_vars/gelato-ha.yml" regexp: "{{ item.regexp }}" diff --git a/ansible/roles/osdsdb/scenarios/etcd.yml b/ansible/roles/osdsdb/scenarios/etcd.yml index b0f113cbe..45158c78a 100644 --- a/ansible/roles/osdsdb/scenarios/etcd.yml +++ b/ansible/roles/osdsdb/scenarios/etcd.yml @@ -29,38 +29,39 @@ get_url: url={{ etcd_download_url }} dest=/opt/{{ etcd_tarball }} - when: - - service_etcd_status.rc != 0 - - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false + when: service_etcd_status.rc != 0 and (etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false) - name: extract the etcd tarball unarchive: src=/opt/{{ etcd_tarball }} dest=/opt/ - when: - - service_etcd_status.rc != 0 - - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false + when: service_etcd_status.rc != 0 and (etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false) # Enable etcd as a process +# FixMe: On Ubuntu20.04 etcd fails to come up as a systemd process. Bring up etcd as a daemon on Ubuntu20.04 for now. - name: run etcd daemon service shell: nohup ./etcd --data-dir {{ etcd_data_dir }} --advertise-client-urls http://{{ etcd_host }}:{{ etcd_port }} --listen-client-urls http://{{ etcd_host }}:{{ etcd_port }} --listen-peer-urls http://{{ etcd_host }}:{{ etcd_peer_port }} &>>etcd.log & become: true args: chdir: "{{ etcd_dir }}" - when: install_as_systemd == false and service_etcd_status.rc != 0 + when: (install_as_systemd == false and service_etcd_status.rc != 0) or ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 # Enable etcd service as systemd process - name: check for etcd service source file existed stat: path: "{{ etcd_dir }}/soda-etcd.service" register: etcd_service_source_exists - when: install_as_systemd == true + when: + - install_as_systemd == true + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) - name: Check if etcd service source file exists debug: var: etcd_service_source_exists verbosity: 2 - when: install_as_systemd == true + when: + - install_as_systemd == true + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) - name: Create the etcd service file copy: @@ -81,21 +82,26 @@ [Install] WantedBy=multi-user.target - when: - - install_as_systemd == true and ( service_etcd_status.rc != 0 and etcd_service_source_exists.stat.exists is undefined or etcd_service_source_exists.stat.exists == false ) + when: + - install_as_systemd == true and service_etcd_status.rc != 0 and (etcd_service_source_exists.stat.exists is undefined or etcd_service_source_exists.stat.exists == false) + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) become: true - name: check for etcd service file existed stat: path: "/etc/systemd/system/soda-etcd.service" register: etcd_service_exists - when: install_as_systemd == true + when: + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - install_as_systemd == true - name: Check if etcd service file exists at systemd debug: var: etcd_service_exists verbosity: 2 - when: install_as_systemd == true + when: + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - install_as_systemd == true - name: Copy etcd service file to systemd copy: @@ -106,9 +112,39 @@ notify: - Reload daemon - Start etcd service - when: - - install_as_systemd == true and ( service_etcd_status.rc != 0 and etcd_service_source_exists.stat.exists is undefined or etcd_service_source_exists.stat.exists == false ) + when: + - install_as_systemd == true and service_etcd_status.rc != 0 and (etcd_service_exists.stat.exists is undefined or etcd_service_exists.stat.exists == false) + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + + become: true + +- name: sleep for 5 seconds and wait for etcd to come up + wait_for: + host: "{{ etcd_host }}" + port: "{{ etcd_port }}" + state: started + delay: 5 + timeout: 120 + + +- name: check status of soda-etcd service + shell: "{{ item }}" + with_items: + - systemctl status soda-etcd become: true + ignore_errors: true + register: sodaEtcdServiceResult + when: + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - install_as_systemd == true + +- name: Display service facts + debug: + var: sodaEtcdServiceResult + verbosity: 4 + when: + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - install_as_systemd == true - name: check etcd cluster health shell: ./etcdctl --endpoints http://{{ etcd_host }}:{{ etcd_port }} cluster-health diff --git a/ansible/roles/osdsdock/scenarios/cinder_standalone.yml b/ansible/roles/osdsdock/scenarios/cinder_standalone.yml index f80bcaed5..1876d4925 100644 --- a/ansible/roles/osdsdock/scenarios/cinder_standalone.yml +++ b/ansible/roles/osdsdock/scenarios/cinder_standalone.yml @@ -18,11 +18,24 @@ name: "{{ item }}" state: present with_items: - - python-pip + - python3-pip - lvm2 - thin-provisioning-tools - libffi-dev - docker-compose + when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + +- name: install python-pip, lvm2, thin-provisioning-tools and docker-compose + apt: + name: "{{ item }}" + state: present + with_items: + - python3-pip + - lvm2 + - thin-provisioning-tools + - libffi-dev + - docker-compose + when: ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 - name: configure cinder section in opensds global info if specify cinder backend shell: | diff --git a/ansible/script/keystone.sh b/ansible/script/keystone.sh index 59132e918..6352cd7a4 100755 --- a/ansible/script/keystone.sh +++ b/ansible/script/keystone.sh @@ -116,7 +116,7 @@ wait_for_keystone () { do # get a token to check if keystone is working correctly or not. # keystone credentials such as OS_USERNAME must be set before. - python ${TOP_DIR}/ministone.py token_issue + python3 ${TOP_DIR}/ministone.py token_issue if [ "$?" == "0" ]; then return fi @@ -188,7 +188,7 @@ install(){ docker cp "$TOP_DIR/../../conf/keystone.policy.json" opensds-authchecker:/etc/keystone/policy.json keystone_credentials wait_for_keystone - python ${TOP_DIR}/ministone.py endpoint_bulk_update keystone "http://${HOST_IP}/identity" + python3 ${TOP_DIR}/ministone.py endpoint_bulk_update keystone "http://${HOST_IP}/identity" else create_user download_code @@ -227,7 +227,7 @@ config_hotpot() { create_user_and_endpoint_for_hotpot else keystone_credentials - python ${TOP_DIR}/ministone.py endpoint_bulk_update "opensds$OPENSDS_VERSION" "http://${HOST_IP}:50040/$OPENSDS_VERSION/%(tenant_id)s" + python3 ${TOP_DIR}/ministone.py endpoint_bulk_update "opensds$OPENSDS_VERSION" "http://${HOST_IP}:50040/$OPENSDS_VERSION/%(tenant_id)s" fi } @@ -237,7 +237,7 @@ config_gelato() { create_user_and_endpoint_for_gelato else keystone_credentials - python ${TOP_DIR}/ministone.py endpoint_bulk_update "multicloud$MULTICLOUD_VERSION" "http://${HOST_IP}:8089/v1beta/%(tenant_id)s" + python3 ${TOP_DIR}/ministone.py endpoint_bulk_update "multicloud$MULTICLOUD_VERSION" "http://${HOST_IP}:8089/v1beta/%(tenant_id)s" fi } diff --git a/ansible/script/ministone.py b/ansible/script/ministone.py index b0bb9c7bc..e02d5f5ca 100755 --- a/ansible/script/ministone.py +++ b/ansible/script/ministone.py @@ -20,22 +20,23 @@ import pprint import json + def token_issue(): body = { 'auth': { - 'identity': { 'methods': ['password'], - 'password': { - 'user': { - 'name': OS_USERNAME, - 'domain': { 'name': OS_USER_DOMAIN_NAME }, - 'password': OS_PASSWORD - } - } - }, + 'identity': {'methods': ['password'], + 'password': { + 'user': { + 'name': OS_USERNAME, + 'domain': {'name': OS_USER_DOMAIN_NAME}, + 'password': OS_PASSWORD + } + } + }, 'scope': { 'project': { 'name': OS_PROJECT_NAME, - 'domain': { 'name': OS_USER_DOMAIN_NAME } + 'domain': {'name': OS_USER_DOMAIN_NAME} } } } @@ -95,7 +96,7 @@ def endpoint_list(token, service): print('DEBUG: GET /v3/endpoints - status_code = %s' % (r_get.status_code)) except: - return None + return None if r_get.status_code != 200: return None @@ -113,6 +114,7 @@ def endpoint_list(token, service): return ep_list + def endpoint_bulk_update(token, service, url): headers = { 'Content-Type': 'application/json', @@ -127,7 +129,7 @@ def endpoint_bulk_update(token, service, url): print("DEBUG: ep_list: %s %s" % (ep_list, url)) for ep in ep_list: - body = {"endpoint": { "url": url }} + body = {"endpoint": {"url": url}} endpoint_id = ep[0] if debug: print("DEBUG: %s / %s" % @@ -147,6 +149,7 @@ def endpoint_bulk_update(token, service, url): print('DEBUG: PATCH /endpoints/XXXX - status_code = %s' % (r_patch.status_code)) + # # ministone.py - A simple stupid keystone client with almost no dependencies. # @@ -164,13 +167,13 @@ def endpoint_bulk_update(token, service, url): debug = False - OS_AUTH_URL=os.environ['OS_AUTH_URL'] - OS_PASSWORD=os.environ['OS_PASSWORD'] - OS_PROJECT_DOMAIN_NAME=os.environ['OS_PROJECT_DOMAIN_NAME'] - OS_PROJECT_NAME=os.environ['OS_PROJECT_NAME'] - OS_USERNAME=os.environ['OS_USERNAME'] - OS_USER_DOMAIN_NAME=os.environ['OS_USER_DOMAIN_NAME'] - #OS_USER_DOMAIN_ID=os.environ['OS_USER_DOMAIN_ID'] + OS_AUTH_URL = os.environ['OS_AUTH_URL'] + OS_PASSWORD = os.environ['OS_PASSWORD'] + OS_PROJECT_DOMAIN_NAME = os.environ['OS_PROJECT_DOMAIN_NAME'] + OS_PROJECT_NAME = os.environ['OS_PROJECT_NAME'] + OS_USERNAME = os.environ['OS_USERNAME'] + OS_USER_DOMAIN_NAME = os.environ['OS_USER_DOMAIN_NAME'] + # OS_USER_DOMAIN_ID=os.environ['OS_USER_DOMAIN_ID'] # token_issue # used for keystone process start up check. @@ -178,15 +181,15 @@ def endpoint_bulk_update(token, service, url): if len(sys.argv) == 2 and sys.argv[1] == 'token_issue': token = token_issue() if not token: - sys.exit(1) + sys.exit(1) else: - sys.exit(0) + sys.exit(0) # endpoint_bulk_update # used for overwriting keystone endpoints if not ((len(sys.argv) == 4) and (sys.argv[1] == 'endpoint_bulk_update')): print('Specify service_name and url for bulk update. Exiting...') - sys.exit(1) + sys.exit(1) token = token_issue() if not token: From cd1d4400e52113a7bac273b274fd7d07b4ca5eb4 Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Fri, 31 Dec 2021 08:56:55 +0530 Subject: [PATCH 2/7] Updated the etcd cleaner scripts for Ubuntu20. Some cleanup --- ansible/roles/cleaner/handlers/main.yml | 4 ++++ ansible/roles/cleaner/tasks/main.yml | 4 ++-- ansible/roles/ha-ip-update/tasks/main.yml | 1 - ansible/script/ministone.py | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ansible/roles/cleaner/handlers/main.yml b/ansible/roles/cleaner/handlers/main.yml index 16abd5fca..a9f60c19e 100644 --- a/ansible/roles/cleaner/handlers/main.yml +++ b/ansible/roles/cleaner/handlers/main.yml @@ -50,11 +50,13 @@ systemd: name: soda-etcd state: stopped + when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) - name: Disable etcd service systemd: name: soda-etcd enabled: no + when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) - name: Remove systemd service files file: @@ -68,6 +70,7 @@ - "/etc/systemd/system/soda-etcd.service" ignore_errors: yes become: true + when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) - name: Remove etcd data dir file: @@ -78,3 +81,4 @@ become: true when: - database_purge == true + - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) diff --git a/ansible/roles/cleaner/tasks/main.yml b/ansible/roles/cleaner/tasks/main.yml index d28add895..46fa3aa43 100644 --- a/ansible/roles/cleaner/tasks/main.yml +++ b/ansible/roles/cleaner/tasks/main.yml @@ -24,7 +24,7 @@ # Kill all the systemd processes and disable services - name: kill osdslet and osdsdock and osdsapiserver etcd daemon service shell: killall osdslet osdsdock osdsapiserver etcd - when: install_from != "container" and install_as_systemd == false + when: (install_from != "container" and install_as_systemd == false) or ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 ignore_errors: true become: true tags: hotpot @@ -88,7 +88,7 @@ state: absent force: yes ignore_errors: yes - when: install_as_systemd == false and ( database_purge is undefined or database_purge == true ) + when: ( install_as_systemd == false or ( ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 )) and ( database_purge is undefined or database_purge == true ) tags: hotpot - name: stop all gelato services diff --git a/ansible/roles/ha-ip-update/tasks/main.yml b/ansible/roles/ha-ip-update/tasks/main.yml index a05042f63..314fe9800 100644 --- a/ansible/roles/ha-ip-update/tasks/main.yml +++ b/ansible/roles/ha-ip-update/tasks/main.yml @@ -22,7 +22,6 @@ # Same IP is used for both the services. Only Port is different (predefined) - name: replace the gelato_ha_api_ip and gelato_ha_s3_ip in the gelato-ha.yml - # hosts: controllers replace: path: "{{ role_path }}/../../group_vars/gelato-ha.yml" regexp: "{{ item.regexp }}" diff --git a/ansible/script/ministone.py b/ansible/script/ministone.py index e02d5f5ca..02c2f0269 100755 --- a/ansible/script/ministone.py +++ b/ansible/script/ministone.py @@ -60,6 +60,7 @@ def token_issue(): else: return None + def service_list(token): headers = { 'Content-Type': 'application/json', @@ -77,12 +78,13 @@ def service_list(token): result_list = json.loads(r_get.text)['services'] for s in result_list: - result_dict[s['name']] = s['id'] + result_dict[s['name']] = s['id'] except: return None return result_dict + def endpoint_list(token, service): headers = { From 25248aae5e0745a33e6a8d8327821ae6f91b1e9e Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Fri, 31 Dec 2021 11:27:01 +0530 Subject: [PATCH 3/7] Added conditional statements in keystone.sh for ubuntu2004. Updated CI --- .github/workflows/ci_pull_request.yml | 2 +- .github/workflows/ci_push.yml | 2 +- ansible/roles/osdsdb/scenarios/etcd.yml | 1 + ansible/script/keystone.sh | 49 +++++++++++++++++++++++-- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_pull_request.yml b/.github/workflows/ci_pull_request.yml index c86e03636..c3d83ab77 100644 --- a/.github/workflows/ci_pull_request.yml +++ b/.github/workflows/ci_pull_request.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: go-version: [1.13.x] - os: [ubuntu-18.04] + os: [ubuntu-18.04, ubuntu-20.04] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/ci_push.yml b/.github/workflows/ci_push.yml index e543c7bc5..4c6253613 100644 --- a/.github/workflows/ci_push.yml +++ b/.github/workflows/ci_push.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: go-version: [1.13.x] - os: [ubuntu-18.04] + os: [ubuntu-18.04, ubuntu-20.04] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/ansible/roles/osdsdb/scenarios/etcd.yml b/ansible/roles/osdsdb/scenarios/etcd.yml index 45158c78a..8757201c0 100644 --- a/ansible/roles/osdsdb/scenarios/etcd.yml +++ b/ansible/roles/osdsdb/scenarios/etcd.yml @@ -125,6 +125,7 @@ state: started delay: 5 timeout: 120 + when: ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 - name: check status of soda-etcd service diff --git a/ansible/script/keystone.sh b/ansible/script/keystone.sh index 6352cd7a4..0f436713a 100755 --- a/ansible/script/keystone.sh +++ b/ansible/script/keystone.sh @@ -116,7 +116,14 @@ wait_for_keystone () { do # get a token to check if keystone is working correctly or not. # keystone credentials such as OS_USERNAME must be set before. - python3 ${TOP_DIR}/ministone.py token_issue + if [ "$UBUNTU_VERSION" >= 20.04 ]; then + python3 ${TOP_DIR}/ministone.py token_issue + return + fi + if [ "$UBUNTU_VERSION" <= 18.04 ]; then + python ${TOP_DIR}/ministone.py token_issue + return + fi if [ "$?" == "0" ]; then return fi @@ -188,7 +195,15 @@ install(){ docker cp "$TOP_DIR/../../conf/keystone.policy.json" opensds-authchecker:/etc/keystone/policy.json keystone_credentials wait_for_keystone - python3 ${TOP_DIR}/ministone.py endpoint_bulk_update keystone "http://${HOST_IP}/identity" + + if [ "$UBUNTU_VERSION" >= 20.04 ]; then + python3 ${TOP_DIR}/ministone.py endpoint_bulk_update keystone "http://${HOST_IP}/identity" + return + fi + if [ "$UBUNTU_VERSION" <= 18.04 ]; then + python ${TOP_DIR}/ministone.py endpoint_bulk_update keystone "http://${HOST_IP}/identity" + return + fi else create_user download_code @@ -227,7 +242,15 @@ config_hotpot() { create_user_and_endpoint_for_hotpot else keystone_credentials - python3 ${TOP_DIR}/ministone.py endpoint_bulk_update "opensds$OPENSDS_VERSION" "http://${HOST_IP}:50040/$OPENSDS_VERSION/%(tenant_id)s" + + if [ "$UBUNTU_VERSION" >= 20.04 ]; then + python3 ${TOP_DIR}/ministone.py endpoint_bulk_update "opensds$OPENSDS_VERSION" "http://${HOST_IP}:50040/$OPENSDS_VERSION/%(tenant_id)s" + return + fi + if [ "$UBUNTU_VERSION" <= 18.04 ]; then + python ${TOP_DIR}/ministone.py endpoint_bulk_update "opensds$OPENSDS_VERSION" "http://${HOST_IP}:50040/$OPENSDS_VERSION/%(tenant_id)s" + return + fi fi } @@ -237,10 +260,24 @@ config_gelato() { create_user_and_endpoint_for_gelato else keystone_credentials - python3 ${TOP_DIR}/ministone.py endpoint_bulk_update "multicloud$MULTICLOUD_VERSION" "http://${HOST_IP}:8089/v1beta/%(tenant_id)s" + + if [ "$UBUNTU_VERSION" >= 20.04 ]; then + python3 ${TOP_DIR}/ministone.py endpoint_bulk_update "multicloud$MULTICLOUD_VERSION" "http://${HOST_IP}:8089/v1beta/%(tenant_id)s" + return + fi + if [ "$UBUNTU_VERSION" <= 18.04 ]; then + python ${TOP_DIR}/ministone.py endpoint_bulk_update "multicloud$MULTICLOUD_VERSION" "http://${HOST_IP}:8089/v1beta/%(tenant_id)s" + return + fi fi } +# Get the Ubuntu OS Version +get_ubuntu_version() { + Version=$(lsb_release -r) + UBUNTU_VERSION=$(cut -f2 <<< "$Version") +} + # *************************** TOP_DIR=$(cd $(dirname "$0") && pwd) @@ -257,19 +294,23 @@ source "$TOP_DIR/sdsrc" case "$# $1" in "2 install") echo "Starting install keystone..." + get_ubuntu_version install $2 ;; "2 uninstall") echo "Starting uninstall keystone..." + get_ubuntu_version uninstall $2 ;; "3 config") [[ X$2 != Xhotpot && X$2 != Xgelato ]] && echo "config type must be hotpot or gelato" && exit 1 echo "Starting config $2 ..." + get_ubuntu_version config_$2 $3 ;; "1 uninstall_purge") echo "Starting uninstall purge keystone..." + get_ubuntu_version uninstall_purge ;; *) From 85ca1f741e26f97a8e99b1e527f6072f3c338ead Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Fri, 31 Dec 2021 11:55:50 +0530 Subject: [PATCH 4/7] Updated the CI to remove Ubuntu18 specific ansible changes. --- .github/workflows/ci_pull_request.yml | 10 +++++----- .github/workflows/ci_push.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci_pull_request.yml b/.github/workflows/ci_pull_request.yml index c3d83ab77..2e2f94a19 100644 --- a/.github/workflows/ci_pull_request.yml +++ b/.github/workflows/ci_pull_request.yml @@ -37,11 +37,11 @@ jobs: echo "Installed Ansible Version in Runtime: " ansible --version - - name: Remove latest ansible on Ubuntu 18.04 - run: | - echo "uninstall with pipx" - pipx uninstall ansible-core - if: ${{ matrix.os == 'ubuntu-18.04' }} + #- name: Remove latest ansible on Ubuntu 18.04 + # run: | + # echo "uninstall with pipx" + # pipx uninstall ansible-core + # if: ${{ matrix.os == 'ubuntu-18.04' }} # Change the permissions of the ansible installer - name: 'Make ansible installer executable and run install ansible on OS: ${{ matrix.os }}' diff --git a/.github/workflows/ci_push.yml b/.github/workflows/ci_push.yml index 4c6253613..5d52cc189 100644 --- a/.github/workflows/ci_push.yml +++ b/.github/workflows/ci_push.yml @@ -37,11 +37,11 @@ jobs: echo "Installed Ansible Version in Runtime: " ansible --version - - name: Remove latest ansible on Ubuntu 18.04 - run: | - echo "uninstall with pipx" - pipx uninstall ansible-core - if: ${{ matrix.os == 'ubuntu-18.04'}} + #- name: Remove latest ansible on Ubuntu 18.04 + # run: | + # echo "uninstall with pipx" + # pipx uninstall ansible-core + # if: ${{ matrix.os == 'ubuntu-18.04'}} # Change the permissions of the ansible installer - name: 'Make ansible installer executable and run install ansible on OS: ${{ matrix.os }}' From 9ffb41b9473dd13d81ccf2f88add8decffff1898 Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Fri, 31 Dec 2021 12:48:27 +0530 Subject: [PATCH 5/7] Updated syntax of conditional variables for latest ansible --- ansible/roles/cleaner/handlers/main.yml | 8 ++++---- ansible/roles/cleaner/tasks/main.yml | 4 ++-- ansible/roles/common/tasks/main.yml | 8 ++++---- ansible/roles/osdsdb/scenarios/etcd.yml | 20 +++++++++---------- .../osdsdock/scenarios/cinder_standalone.yml | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ansible/roles/cleaner/handlers/main.yml b/ansible/roles/cleaner/handlers/main.yml index a9f60c19e..5c088ba87 100644 --- a/ansible/roles/cleaner/handlers/main.yml +++ b/ansible/roles/cleaner/handlers/main.yml @@ -50,13 +50,13 @@ systemd: name: soda-etcd state: stopped - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - name: Disable etcd service systemd: name: soda-etcd enabled: no - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - name: Remove systemd service files file: @@ -70,7 +70,7 @@ - "/etc/systemd/system/soda-etcd.service" ignore_errors: yes become: true - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - name: Remove etcd data dir file: @@ -81,4 +81,4 @@ become: true when: - database_purge == true - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) diff --git a/ansible/roles/cleaner/tasks/main.yml b/ansible/roles/cleaner/tasks/main.yml index 46fa3aa43..82be9947c 100644 --- a/ansible/roles/cleaner/tasks/main.yml +++ b/ansible/roles/cleaner/tasks/main.yml @@ -24,7 +24,7 @@ # Kill all the systemd processes and disable services - name: kill osdslet and osdsdock and osdsapiserver etcd daemon service shell: killall osdslet osdsdock osdsapiserver etcd - when: (install_from != "container" and install_as_systemd == false) or ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 + when: (install_from != "container" and install_as_systemd == false) or ansible_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20 ignore_errors: true become: true tags: hotpot @@ -88,7 +88,7 @@ state: absent force: yes ignore_errors: yes - when: ( install_as_systemd == false or ( ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 )) and ( database_purge is undefined or database_purge == true ) + when: ( install_as_systemd == false or ( ansible_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20 )) and ( database_purge is undefined or database_purge == true ) tags: hotpot - name: stop all gelato services diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index 432cc9701..e6412278f 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -27,7 +27,7 @@ become: yes - name: run the equivalent of "apt-get update" as a separate step - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=20) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_lsb.major_release|int <=20) apt: update_cache: yes @@ -40,7 +40,7 @@ - gcc - python-pip - open-iscsi - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - name: install system packages on Ubuntu-20.04 package: @@ -51,7 +51,7 @@ - gcc - python3-pip - open-iscsi - when: ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 + when: ansible_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20 - name: Install system packages on CentoS or RHEL when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") @@ -74,7 +74,7 @@ with_items: - librados-dev - librbd-dev - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=20) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_lsb.major_release|int <=20) - name: create opensds work directory if it doesn't exist file: diff --git a/ansible/roles/osdsdb/scenarios/etcd.yml b/ansible/roles/osdsdb/scenarios/etcd.yml index 8757201c0..2b4e3758b 100644 --- a/ansible/roles/osdsdb/scenarios/etcd.yml +++ b/ansible/roles/osdsdb/scenarios/etcd.yml @@ -44,7 +44,7 @@ become: true args: chdir: "{{ etcd_dir }}" - when: (install_as_systemd == false and service_etcd_status.rc != 0) or ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 + when: (install_as_systemd == false and service_etcd_status.rc != 0) or ansible_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20 # Enable etcd service as systemd process - name: check for etcd service source file existed @@ -53,7 +53,7 @@ register: etcd_service_source_exists when: - install_as_systemd == true - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - name: Check if etcd service source file exists debug: @@ -61,7 +61,7 @@ verbosity: 2 when: - install_as_systemd == true - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - name: Create the etcd service file copy: @@ -84,7 +84,7 @@ WantedBy=multi-user.target when: - install_as_systemd == true and service_etcd_status.rc != 0 and (etcd_service_source_exists.stat.exists is undefined or etcd_service_source_exists.stat.exists == false) - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) become: true - name: check for etcd service file existed @@ -92,7 +92,7 @@ path: "/etc/systemd/system/soda-etcd.service" register: etcd_service_exists when: - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - install_as_systemd == true - name: Check if etcd service file exists at systemd @@ -100,7 +100,7 @@ var: etcd_service_exists verbosity: 2 when: - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - install_as_systemd == true - name: Copy etcd service file to systemd @@ -114,7 +114,7 @@ - Start etcd service when: - install_as_systemd == true and service_etcd_status.rc != 0 and (etcd_service_exists.stat.exists is undefined or etcd_service_exists.stat.exists == false) - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) become: true @@ -125,7 +125,7 @@ state: started delay: 5 timeout: 120 - when: ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 + when: ansible_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20 - name: check status of soda-etcd service @@ -136,7 +136,7 @@ ignore_errors: true register: sodaEtcdServiceResult when: - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - install_as_systemd == true - name: Display service facts @@ -144,7 +144,7 @@ var: sodaEtcdServiceResult verbosity: 4 when: - - ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - install_as_systemd == true - name: check etcd cluster health diff --git a/ansible/roles/osdsdock/scenarios/cinder_standalone.yml b/ansible/roles/osdsdock/scenarios/cinder_standalone.yml index 1876d4925..d245e02c4 100644 --- a/ansible/roles/osdsdock/scenarios/cinder_standalone.yml +++ b/ansible/roles/osdsdock/scenarios/cinder_standalone.yml @@ -23,7 +23,7 @@ - thin-provisioning-tools - libffi-dev - docker-compose - when: ansible_distribution == "Ubuntu" and (ansible_lsb.major_release|int >=16 and ansible_lsb.major_release|int <=18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) - name: install python-pip, lvm2, thin-provisioning-tools and docker-compose apt: @@ -35,7 +35,7 @@ - thin-provisioning-tools - libffi-dev - docker-compose - when: ansible_distribution == "Ubuntu" and ansible_lsb.major_release|int >=20 + when: ansible_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20 - name: configure cinder section in opensds global info if specify cinder backend shell: | From 97254ec9acbf79236f01addf147be6a27068cfb3 Mon Sep 17 00:00:00 2001 From: Anvith KS Date: Fri, 31 Dec 2021 13:00:51 +0530 Subject: [PATCH 6/7] Updated syntax of conditional variables for latest ansible --- ansible/roles/cleaner/handlers/main.yml | 8 ++++---- ansible/roles/common/tasks/main.yml | 6 +++--- ansible/roles/osdsdb/scenarios/etcd.yml | 16 ++++++++-------- .../osdsdock/scenarios/cinder_standalone.yml | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ansible/roles/cleaner/handlers/main.yml b/ansible/roles/cleaner/handlers/main.yml index 5c088ba87..bacb10d27 100644 --- a/ansible/roles/cleaner/handlers/main.yml +++ b/ansible/roles/cleaner/handlers/main.yml @@ -50,13 +50,13 @@ systemd: name: soda-etcd state: stopped - when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - name: Disable etcd service systemd: name: soda-etcd enabled: no - when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - name: Remove systemd service files file: @@ -70,7 +70,7 @@ - "/etc/systemd/system/soda-etcd.service" ignore_errors: yes become: true - when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - name: Remove etcd data dir file: @@ -81,4 +81,4 @@ become: true when: - database_purge == true - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index e6412278f..d5f2c9d81 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -27,7 +27,7 @@ become: yes - name: run the equivalent of "apt-get update" as a separate step - when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_lsb.major_release|int <=20) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_lsb.major_release|int <=20) apt: update_cache: yes @@ -40,7 +40,7 @@ - gcc - python-pip - open-iscsi - when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - name: install system packages on Ubuntu-20.04 package: @@ -74,7 +74,7 @@ with_items: - librados-dev - librbd-dev - when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_lsb.major_release|int <=20) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_lsb.major_release|int <=20) - name: create opensds work directory if it doesn't exist file: diff --git a/ansible/roles/osdsdb/scenarios/etcd.yml b/ansible/roles/osdsdb/scenarios/etcd.yml index 2b4e3758b..95fa9a06f 100644 --- a/ansible/roles/osdsdb/scenarios/etcd.yml +++ b/ansible/roles/osdsdb/scenarios/etcd.yml @@ -53,7 +53,7 @@ register: etcd_service_source_exists when: - install_as_systemd == true - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - name: Check if etcd service source file exists debug: @@ -61,7 +61,7 @@ verbosity: 2 when: - install_as_systemd == true - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - name: Create the etcd service file copy: @@ -84,7 +84,7 @@ WantedBy=multi-user.target when: - install_as_systemd == true and service_etcd_status.rc != 0 and (etcd_service_source_exists.stat.exists is undefined or etcd_service_source_exists.stat.exists == false) - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) become: true - name: check for etcd service file existed @@ -92,7 +92,7 @@ path: "/etc/systemd/system/soda-etcd.service" register: etcd_service_exists when: - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - install_as_systemd == true - name: Check if etcd service file exists at systemd @@ -100,7 +100,7 @@ var: etcd_service_exists verbosity: 2 when: - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - install_as_systemd == true - name: Copy etcd service file to systemd @@ -114,7 +114,7 @@ - Start etcd service when: - install_as_systemd == true and service_etcd_status.rc != 0 and (etcd_service_exists.stat.exists is undefined or etcd_service_exists.stat.exists == false) - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) become: true @@ -136,7 +136,7 @@ ignore_errors: true register: sodaEtcdServiceResult when: - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - install_as_systemd == true - name: Display service facts @@ -144,7 +144,7 @@ var: sodaEtcdServiceResult verbosity: 4 when: - - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + - ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - install_as_systemd == true - name: check etcd cluster health diff --git a/ansible/roles/osdsdock/scenarios/cinder_standalone.yml b/ansible/roles/osdsdock/scenarios/cinder_standalone.yml index d245e02c4..ce069f9b5 100644 --- a/ansible/roles/osdsdock/scenarios/cinder_standalone.yml +++ b/ansible/roles/osdsdock/scenarios/cinder_standalone.yml @@ -23,7 +23,7 @@ - thin-provisioning-tools - libffi-dev - docker-compose - when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version'] >= 16 and ansible_facts['distribution_major_version'] <= 18) + when: ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18) - name: install python-pip, lvm2, thin-provisioning-tools and docker-compose apt: From 6dd4369be12649079c5ac83525a5710971e5a191 Mon Sep 17 00:00:00 2001 From: anvithks Date: Fri, 31 Dec 2021 15:33:43 +0530 Subject: [PATCH 7/7] Reverted the conditions in etcd tarball extraction. --- ansible/roles/osdsdb/scenarios/etcd.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ansible/roles/osdsdb/scenarios/etcd.yml b/ansible/roles/osdsdb/scenarios/etcd.yml index 95fa9a06f..477710a03 100644 --- a/ansible/roles/osdsdb/scenarios/etcd.yml +++ b/ansible/roles/osdsdb/scenarios/etcd.yml @@ -29,13 +29,17 @@ get_url: url={{ etcd_download_url }} dest=/opt/{{ etcd_tarball }} - when: service_etcd_status.rc != 0 and (etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false) + when: + - service_etcd_status.rc != 0 + - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false - name: extract the etcd tarball unarchive: src=/opt/{{ etcd_tarball }} dest=/opt/ - when: service_etcd_status.rc != 0 and (etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false) + when: + - service_etcd_status.rc != 0 + - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false # Enable etcd as a process # FixMe: On Ubuntu20.04 etcd fails to come up as a systemd process. Bring up etcd as a daemon on Ubuntu20.04 for now.