Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Added changes to support and enable installation of SODA on Ubuntu20.04 #486

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
12 changes: 6 additions & 6 deletions .github/workflows/ci_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}'
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/cleaner/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@
systemd:
name: soda-etcd
state: stopped
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']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18)

- name: Remove systemd service files
file:
Expand All @@ -68,6 +70,7 @@
- "/etc/systemd/system/soda-etcd.service"
ignore_errors: yes
become: true
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:
Expand All @@ -78,3 +81,4 @@
become: true
when:
- database_purge == true
- ansible_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|int <= 18)
4 changes: 2 additions & 2 deletions ansible/roles/cleaner/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20
ignore_errors: true
become: true
tags: hotpot
Expand Down Expand Up @@ -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_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
Expand Down
17 changes: 14 additions & 3 deletions ansible/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_lsb.major_release|int <=20)
apt:
update_cache: yes

Expand All @@ -40,7 +40,18 @@
- 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']|int >= 16 and ansible_facts['distribution_major_version']|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_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")
Expand All @@ -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_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:
Expand Down
16 changes: 8 additions & 8 deletions ansible/roles/dashboard-installer/scenarios/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -92,6 +92,6 @@
file:
state: absent
path: "{{ gelato_work_dir }}/multi-cloud/"
ignore_error: yes
ignore_error: yes
become: yes

1 change: 0 additions & 1 deletion ansible/roles/ha-ip-update/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
63 changes: 52 additions & 11 deletions ansible/roles/osdsdb/scenarios/etcd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,43 @@
get_url:
url={{ etcd_download_url }}
dest=/opt/{{ etcd_tarball }}
when:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for changing these ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These got changed by mistake. Essentially the same thing but written in one line. I have reverted it in a commit.

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:
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.
- 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_facts['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_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:
var: etcd_service_source_exists
verbosity: 2
when: install_as_systemd == true
when:
- install_as_systemd == true
- 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:
Expand All @@ -81,21 +86,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_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
stat:
path: "/etc/systemd/system/soda-etcd.service"
register: etcd_service_exists
when: install_as_systemd == true
when:
- 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
debug:
var: etcd_service_exists
verbosity: 2
when: install_as_systemd == true
when:
- 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
copy:
Expand All @@ -106,9 +116,40 @@
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_facts['distribution'] == 'Ubuntu' and (ansible_facts['distribution_major_version']|int >= 16 and ansible_facts['distribution_major_version']|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
when: ansible_facts['distribution'] == 'Ubuntu' and ansible_lsb.major_release|int >=20


- name: check status of soda-etcd service
shell: "{{ item }}"
with_items:
- systemctl status soda-etcd
become: true
ignore_errors: true
register: sodaEtcdServiceResult
when:
- 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
debug:
var: sodaEtcdServiceResult
verbosity: 4
when:
- 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
shell: ./etcdctl --endpoints http://{{ etcd_host }}:{{ etcd_port }} cluster-health
Expand Down
15 changes: 14 additions & 1 deletion ansible/roles/osdsdock/scenarios/cinder_standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@
name: "{{ item }}"
state: present
with_items:
- python-pip
- python3-pip
- lvm2
- thin-provisioning-tools
- libffi-dev
- docker-compose
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:
name: "{{ item }}"
state: present
with_items:
- python3-pip
- lvm2
- thin-provisioning-tools
- libffi-dev
- docker-compose
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: |
Expand Down
Loading