openstack-ansible/playbooks/common-tasks/ceph-server.yml
Jonathan Rosser ec3233f9f8 Update ansible-lint==4.3.5, flake8==3.8.3, bashate>=0.5.1
Correct lint errors that arise from these version updates.

This also fixes ceph deployment after backporting breaking changes
to stable-5.0 branch.

Change-Id: Iaa6bd137ebc4bf6cc2071712eb3f53a08c85d75e
2020-10-05 13:32:51 +00:00

104 lines
3.5 KiB
YAML

---
# Copyright 2017, Logan Vig <logan2211@gmail.com>
#
# 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.
- include_tasks: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml"
when: not is_metal
vars:
list_of_bind_mounts: "{{ ceph_container_bind_mounts }}"
- include_tasks: common-tasks/unbound-clients.yml
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
#TODO: mgariepy, revisit to use include_role when https://github.com/ansible/ansible/issues/20077 is fixed
- name: Ensure Ansible can work with SELinux
package:
name: libselinux-python3
state: present
when:
- ansible_pkg_mgr in ['yum', 'dnf']
# Set the priority of the ceph community apt repo either above or below that of UCA or distro sources
- name: Set apt package pins
include_role:
name: apt_package_pinning
vars:
apt_package_pinning_file_name: "ceph_community_pin.pref"
apt_package_pinning_priority: "{{ (ceph_repository == 'community') | ternary(1000, 100) }}"
apt_pinned_packages: [{ package: '*', release: 'ceph.com' }]
when:
- ansible_pkg_mgr == 'apt'
# We need to have PyYAML for ceph-ansible roles
- block:
- name: Install python3-yaml
package:
name: "{{ (ansible_os_family | lower == 'debian') | ternary('python3-yaml', 'python3-pyyaml') }}"
state: present
# Rescue is mainly for CentOS 7
rescue:
- name: Download EPEL gpg keys
get_url:
url: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7') }}"
dest: /etc/pki/rpm-gpg
register: _get_yum_keys
until: _get_yum_keys is success
retries: 5
delay: 2
when:
- ansible_os_family | lower == 'redhat'
- ansible_distribution_major_version is version('7', '=')
- name: Install EPEL gpg keys
rpm_key:
key: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"
state: present
when:
- ansible_os_family | lower == 'redhat'
- ansible_distribution_major_version is version('7', '=')
- name: Install the EPEL repository
yum_repository:
name: epel-ceph
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: 'python2-pip'
register: install_epel_repo
until: install_epel_repo is success
retries: 5
delay: 2
when:
- ansible_os_family | lower == 'redhat'
- ansible_distribution_major_version is version('7', '=')
# Installing both pip's not to fail
- name: Installing pip
package:
name:
- "{{ (ansible_os_family | lower == 'redhat' and ansible_distribution_major_version is version('8', '<')) | ternary('python2-pip', 'python-pip') }}"
- python3-pip
state: present
- name: Install PyYAML
pip:
name: PyYAML