From 93c242c1bedb4446b093efad3e11ab9ecda860bf Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 3 Aug 2020 15:16:58 +0300 Subject: [PATCH] Install required modules for utility env Since we delegate image uplaod to the utility venv, we also need to have selinux package, otherwise file download and some of the operations may fail Also this installs python mysql binding as we're about to delegate db_setup tasks to the utility venv. Change-Id: Id219ccb227485ffaf4b2cad36e8100672137c1d7 Needed-By: https://review.opendev.org/739646 Needed-By: https://review.opendev.org/733443 --- inventory/group_vars/utility_all.yml | 4 ++++ playbooks/defaults/distro_install.yml | 4 ++++ playbooks/defaults/source_install.yml | 6 ++++- playbooks/utility-install.yml | 34 +++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/inventory/group_vars/utility_all.yml b/inventory/group_vars/utility_all.yml index b1e02a2720..fe9580ec21 100644 --- a/inventory/group_vars/utility_all.yml +++ b/inventory/group_vars/utility_all.yml @@ -37,6 +37,7 @@ _utility_devel_distro_packages_debian: _utility_devel_distro_packages_redhat: - gcc + - libselinux-python3 - "{{ ansible_distribution_major_version is version('8', '<') | ternary('python-devel', 'python36-devel') }}" # Distribution packages needed for the utility pip package wheel build @@ -60,12 +61,15 @@ _utility_distro_openstack_clients_packages: - python3-novaclient - python3-cinderclient - python3-openstackclient + - "{{ (ansible_os_family | lower == 'redhat') | ternary('python3-PyMySQL', 'python3-pymysql') }}" # Python packages to be installed into the utility container utility_pip_packages: - cryptography - pip + - PyMySQL - python-memcached + - selinux - setuptools - wheel - openstacksdk diff --git a/playbooks/defaults/distro_install.yml b/playbooks/defaults/distro_install.yml index a8d1491def..de6186e765 100644 --- a/playbooks/defaults/distro_install.yml +++ b/playbooks/defaults/distro_install.yml @@ -67,3 +67,7 @@ trove_install_method: distro watcher_install_method: distro zaqar_install_method: distro zun_install_method: distro + +## Delegate all database setup tasks to the utility host, and use the utility venv python interpreter +openstack_db_setup_host: "{{ groups['utility_all'][0] }}" +openstack_db_setup_python_interpreter: "{{ ansible_python['executable'] }}" diff --git a/playbooks/defaults/source_install.yml b/playbooks/defaults/source_install.yml index 79de357e20..dc6a064145 100644 --- a/playbooks/defaults/source_install.yml +++ b/playbooks/defaults/source_install.yml @@ -29,4 +29,8 @@ openstack_repo_git_url: "git://{{ internal_lb_vip_address }}" ## Delegate all service setup tasks to the utility host, and use the utility venv python interpreter openstack_service_setup_host: "{{ groups['utility_all'][0] }}" -openstack_service_setup_host_python_interpreter: "/openstack/venvs/utility-{{ openstack_release }}/bin/python" \ No newline at end of file +openstack_service_setup_host_python_interpreter: "/openstack/venvs/utility-{{ openstack_release }}/bin/python" + +## Delegate all database setup tasks to the utility host, and use the utility venv python interpreter +openstack_db_setup_host: "{{ openstack_service_setup_host }}" +openstack_db_setup_python_interpreter: "{{ openstack_service_setup_host_python_interpreter }}" diff --git a/playbooks/utility-install.yml b/playbooks/utility-install.yml index 7df14ba35e..106dcaa81e 100644 --- a/playbooks/utility-install.yml +++ b/playbooks/utility-install.yml @@ -75,6 +75,40 @@ utility_distro_packages: "{{ (utility_distro_packages | default([])) + _utility_distro_openstack_clients_packages[utility_distro_openstack_clients_python_version|int] }}" when: install_method == "distro" + - name: Add EPEL repsitory + block: + - name: Download EPEL gpg keys + get_url: + url: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_distribution_major_version) }}" + dest: /etc/pki/rpm-gpg + register: _get_yum_keys + until: _get_yum_keys is success + retries: 5 + delay: 2 + + - name: Install EPEL gpg keys + rpm_key: + key: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" + state: present + + - name: Install the EPEL repository + yum_repository: + name: epel-utility + baseurl: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') ~ '/' ~ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}" + description: 'Extra Packages for Enterprise Linux 7 - $basearch' + gpgcheck: yes + enabled: yes + state: present + includepkgs: 'python3-PyMySQL python36-PyMySQL' + register: install_epel_repo + until: install_epel_repo is success + retries: 5 + delay: 2 + when: + - install_method == "distro" + - ansible_os_family | lower == 'redhat' + - ansible_distribution_major_version is version('8', '<') + - name: Install distro packages package: name: "{{ utility_distro_packages | default([]) }}"