Add CentOS7 support for Swift

This PR Adds CentOS 7 support for Swift.
The following was required to get CentOS 7 to work:
* Add yum install path + packages
* Variablize rsync service name
* Gather network interface facts prior to setting storage/repl IPs
* Ensure /etc/defaults/rsync is only set for apt installations.
* Ensure the rsyslog service is started and enabled.

Change-Id: Ibaf8bc8d54b55820e8b527b52940c61c05c732d8
This commit is contained in:
Andy McCrae 2016-11-07 17:03:21 +00:00
parent 5e2ad01ed8
commit 42acde5ee9
10 changed files with 104 additions and 2 deletions

View File

@ -37,10 +37,12 @@
service:
name: "rsyslog"
state: "restarted"
enabled: "yes"
sleep: 2
- name: Restart rsync service
service:
name: "rsync"
name: "{{ swift_rsync_service_name }}"
state: "restarted"
enabled: "yes"
sleep: 2

View File

@ -31,6 +31,7 @@ galaxy_info:
- openstack
dependencies:
- pip_install
- rsyslog_client
- role: apt_package_pinning
when:
- ansible_pkg_mgr == 'apt'

View File

@ -0,0 +1,3 @@
---
features:
- CentOS7/RHEL support has been added to the os_swift role.

33
tasks/install-yum.yml Normal file
View File

@ -0,0 +1,33 @@
---
# Copyright 2014, 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 RDO package
yum:
pkg: "{{ rdo_package }}"
state: "present"
register: install_cloud_rdo_package
until: install_cloud_rdo_package | success
retries: 5
delay: 2
- name: Install yum packages
yum:
pkg: "{{ item }}"
state: "{{ swift_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ swift_distro_packages }}"

View File

@ -41,6 +41,14 @@
tags:
- always
- name: Gather facts for storage_bridge
setup:
filter: "{{ swift_storage_bridge }}"
when:
- swift_storage_bridge is defined
- hostvars[inventory_hostname][swift_storage_bridge] is defined
- swift_storage_address is not defined
- name: Swift storage address not found
fail:
msg: "{{ swift.storage_network }} not found on host, can't find storage address."
@ -96,6 +104,14 @@
tags:
- always
- name: Gather facts for storage_bridge
setup:
filter: "{{ swift_replication_bridge }}"
when:
- swift_replication_bridge is defined
- hostvars[inventory_hostname][swift_replication_bridge] is defined
- swift_replication_address is not defined
- name: Swift replication address not found
fail:
msg: "{{ swift.replication_network }} not found on host, can't find swift_replican_address"

View File

@ -17,6 +17,10 @@
static: no
when: ansible_pkg_mgr == 'apt'
- include: install-yum.yml
static: no
when: ansible_pkg_mgr == 'yum'
- name: Create developer mode constraint file
copy:
dest: "/opt/developer-pip-constraints.txt"

View File

@ -43,11 +43,13 @@
mode: "0644"
notify: "Restart rsync service"
- name: "Enable rsync in defaults"
# Red Hat/CentOS are enabled as part of the handler
- name: "Enable rsync service in defaults (Debian)"
lineinfile:
dest: "/etc/default/rsync"
line: "RSYNC_ENABLE=true"
regexp: "^RSYNC_ENABLE*"
when: ansible_pkg_mgr =="apt"
notify: "Restart rsync service"
- name: "Setup swift-recon-cron cron job"

View File

@ -42,3 +42,7 @@
src: https://git.openstack.org/openstack/openstack-ansible-os_keystone
scm: git
version: master
- name: rsyslog_client
src: https://git.openstack.org/openstack/openstack-ansible-rsyslog_client
scm: git
version: master

View File

@ -26,3 +26,7 @@ swift_distro_packages:
- python-dev
- rsync
- libssl-dev
swift_syslog_user_name: syslog
swift_syslog_group_name: syslog
swift_rsync_service_name: rsync

33
vars/redhat-7.yml Normal file
View File

@ -0,0 +1,33 @@
---
# 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.
swift_distro_packages:
- curl
- gcc
- git
- liberasurecode
- liberasurecode-devel
- libffi-devel
- openssh-server
- python-devel
- rsync
- openssl-devel
- cronie
- cronie-anacron
swift_syslog_user_name: root
swift_syslog_group_name: root
swift_rsync_service_name: rsyncd
rdo_package: "https://rdoproject.org/repos/rdo-release.rpm"