From ffacc20cc8fd985c1242e0e5ab59f0d2ef4cd20a Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Mon, 25 Jul 2016 11:06:22 -0500 Subject: [PATCH] Implement CentOS 7 support in os_glance This change implements CentOS 7 support within the os_glance role. Change-Id: I65d8e66673f5372fe880680a035842ffcd775ac2 Signed-off-by: Kevin Carter Co-Authored-By: Major Hayden Co-Authored-By: Marc Gariepy --- manual-test.rc | 22 +++++++++++++++++ meta/main.yml | 3 +++ ...ance-packages-rename-abd348b0725e4b7b.yaml | 4 ++++ ...ance-centos7-support-21cb81e361831c9f.yaml | 4 ++++ tasks/glance_install.yml | 4 ++++ tasks/glance_install_yum.yml | 24 +++++++++++++++++++ tasks/main.yml | 1 + tests/test-install-glance.yml | 4 ++-- tests/test-install-keystone.yml | 4 ++-- tests/test-prepare-host.yml | 13 +++++++++- vars/redhat-7.yml | 21 ++++++++++++++++ 11 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 manual-test.rc create mode 100644 releasenotes/notes/glance-packages-rename-abd348b0725e4b7b.yaml create mode 100644 releasenotes/notes/os_glance-centos7-support-21cb81e361831c9f.yaml create mode 100644 tasks/glance_install_yum.yml create mode 100644 vars/redhat-7.yml diff --git a/manual-test.rc b/manual-test.rc new file mode 100644 index 00000000..fa1cdf95 --- /dev/null +++ b/manual-test.rc @@ -0,0 +1,22 @@ +export VIRTUAL_ENV=$(pwd) +export ANSIBLE_HOST_KEY_CHECKING=False +export ANSIBLE_SSH_CONTROL_PATH=/tmp/%%h-%%r + +# TODO (odyssey4me) These are only here as they are non-standard folder +# names for Ansible 1.9.x. We are using the standard folder names for +# Ansible v2.x. We can remove this when we move to Ansible 2.x. +export ANSIBLE_ACTION_PLUGINS=${HOME}/.ansible/plugins/action +export ANSIBLE_CALLBACK_PLUGINS=${HOME}/.ansible/plugins/callback +export ANSIBLE_FILTER_PLUGINS=${HOME}/.ansible/plugins/filter +export ANSIBLE_LOOKUP_PLUGINS=${HOME}/.ansible/plugins/lookup + +# This is required as the default is the current path or a path specified +# in ansible.cfg +export ANSIBLE_LIBRARY=${HOME}/.ansible/plugins/library + +# This is required as the default is '/etc/ansible/roles' or a path +# specified in ansible.cfg +export ANSIBLE_ROLES_PATH=${HOME}/.ansible/roles:$(pwd)/.. + +echo "Run manual functional tests by executing the following:" +echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml -e \"rolename=$(pwd)\"" diff --git a/meta/main.yml b/meta/main.yml index c766cb39..0c17e0c2 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -24,6 +24,9 @@ galaxy_info: versions: - trusty - xenial + - name: EL + versions: + - 7 categories: - cloud - python diff --git a/releasenotes/notes/glance-packages-rename-abd348b0725e4b7b.yaml b/releasenotes/notes/glance-packages-rename-abd348b0725e4b7b.yaml new file mode 100644 index 00000000..915c46a1 --- /dev/null +++ b/releasenotes/notes/glance-packages-rename-abd348b0725e4b7b.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - The ``glance_apt_packages`` variable has been renamed to + ``glance_distro_packages`` so that it applies to multiple operating systems. diff --git a/releasenotes/notes/os_glance-centos7-support-21cb81e361831c9f.yaml b/releasenotes/notes/os_glance-centos7-support-21cb81e361831c9f.yaml new file mode 100644 index 00000000..b44a4850 --- /dev/null +++ b/releasenotes/notes/os_glance-centos7-support-21cb81e361831c9f.yaml @@ -0,0 +1,4 @@ +--- +features: + - CentOS7/RHEL support has been added to the os_glance + role. diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index beadef35..c706b3ed 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -17,6 +17,10 @@ when: - ansible_pkg_mgr == 'apt' +- include: glance_install_yum.yml + when: + - ansible_pkg_mgr == 'yum' + - name: Create developer mode constraint file copy: dest: "/opt/developer-pip-constraints.txt" diff --git a/tasks/glance_install_yum.yml b/tasks/glance_install_yum.yml new file mode 100644 index 00000000..cac8addd --- /dev/null +++ b/tasks/glance_install_yum.yml @@ -0,0 +1,24 @@ +--- +# Copyright 2016, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Install yum packages + yum: + pkg: "{{ item }}" + state: "{{ glance_package_state }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: "{{ glance_distro_packages }}" diff --git a/tasks/main.yml b/tasks/main.yml index 67cc4b03..b03e2229 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -20,6 +20,7 @@ - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - "{{ ansible_distribution | lower }}.yml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml" - "{{ ansible_os_family | lower }}.yml" tags: - always diff --git a/tests/test-install-glance.yml b/tests/test-install-glance.yml index 0d84058a..3a4062f3 100644 --- a/tests/test-install-glance.yml +++ b/tests/test-install-glance.yml @@ -39,7 +39,7 @@ mysql_db: login_user: "root" login_password: "secrete" - login_host: "localhost" + login_host: "{{ glance_galera_address }}" name: "{{ glance_galera_database }}" state: "present" delegate_to: "10.100.100.2" @@ -48,7 +48,7 @@ mysql_user: login_user: "root" login_password: "secrete" - login_host: "localhost" + login_host: "{{ glance_galera_address }}" name: "{{ glance_galera_database }}" password: "{{ glance_container_mysql_password }}" host: "{{ item }}" diff --git a/tests/test-install-keystone.yml b/tests/test-install-keystone.yml index c3536367..fd3fec26 100644 --- a/tests/test-install-keystone.yml +++ b/tests/test-install-keystone.yml @@ -39,7 +39,7 @@ mysql_db: login_user: "root" login_password: "secrete" - login_host: "localhost" + login_host: "{{ keystone_galera_address }}" name: "{{ keystone_galera_database }}" state: "present" delegate_to: "10.100.100.2" @@ -48,7 +48,7 @@ mysql_user: login_user: "root" login_password: "secrete" - login_host: "localhost" + login_host: "{{ keystone_galera_address }}" name: "{{ keystone_galera_database }}" password: "{{ keystone_container_mysql_password }}" host: "{{ item }}" diff --git a/tests/test-prepare-host.yml b/tests/test-prepare-host.yml index c1d127b4..bd3e23c1 100644 --- a/tests/test-prepare-host.yml +++ b/tests/test-prepare-host.yml @@ -16,6 +16,11 @@ - name: Perform basic LXC host setup hosts: localhost pre_tasks: + - name: Ensure apt cache is always refreshed + apt: + update_cache: yes + when: + - ansible_pkg_mgr == 'apt' - name: Ensure root's new public ssh key is in authorized_keys authorized_key: user: root @@ -31,7 +36,13 @@ set_fact: lxc_container_cache_files: - { src: '/etc/pip.conf', dest: '/etc/pip.conf' } - when: nodepool.stat.exists | bool + when: + - nodepool.stat.exists | bool + - name: install the epel repo rpm from a remote repo + yum: + name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" + state: "present" + when: ansible_pkg_mgr == 'yum' roles: - role: "lxc_hosts" lxc_net_address: 10.100.100.1 diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml new file mode 100644 index 00000000..d28efe4d --- /dev/null +++ b/vars/redhat-7.yml @@ -0,0 +1,21 @@ +# Copyright 2016, Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +glance_distro_packages: + - cronie + - cronie-anacron + - rpcbind + - rsync + - git + - nfs-utils