Updated role using the Multi-Distro framework

* The default apt packages have been moved into a var file
  that is only loaded when the detected OS is matched.
* The Install task file has had the apt specific tasks moved
  into a named install task file.
* Ubuntu 16.04 and CentOS 7 support have been added

Implements: blueprint multi-platform-host
Change-Id: I469081671415df23a35108abf4452722ba011f9b
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-03-21 22:51:03 -05:00 committed by Kevin Carter (cloudnull)
parent 1e6c62c59a
commit 79acae2254
14 changed files with 303 additions and 86 deletions

View File

@ -13,9 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
## APT Cache Options
cache_timeout: 600
openstack_code_name: Mitaka
openstack_release: master
@ -28,66 +25,6 @@ openstack_host_sysstat_statistics_hour: 23
## of OSA containers and hosts if disabling this
openstack_host_manage_hosts_file: true
## Defined required kernel
openstack_host_required_kernel: 3.13.0-34-generic
## Kernel modules loaded on hosts
openstack_host_kernel_modules:
- 8021q
# TODO (odyssey4me): revise the minimum kernel version once this kernel version is commonplace
# If we end up with more requirements like this, then we should change the approach.
- "{% if ansible_kernel | version_compare('3.18.0-0-generic', '>') %}br_netfilter{% endif %}"
- dm_multipath
- dm_snapshot
- ebtables
- ip6table_filter
- ip6_tables
- ip_tables
- ipt_MASQUERADE
- ipt_REJECT
- iptable_filter
- iptable_mangle
- iptable_nat
- iscsi_tcp
- nbd
- nf_conntrack
- nf_conntrack_ipv4
- nf_defrag_ipv4
- nf_nat
- nf_nat_ipv4
# TODO (odyssey4me): revise the minimum kernel version once this kernel version is commonplace
# If we end up with more requirements like this, then we should change the approach.
- "{% if ansible_kernel | version_compare('4.4.0-0-generic', '<') %}scsi_dh{% endif %}"
- vhost_net
- x_tables
## Base packages
openstack_host_apt_packages:
- apparmor-utils
- apt-transport-https
- bridge-utils
- build-essential
- cgroup-lite
- curl
- dmeventd
- dstat
- ebtables
- htop
- iptables
- irqbalance
- libkmod-dev
- libkmod2
- lvm2
- python-software-properties
- python-dev
- rsync
- rsyslog
- sshpass
- sysstat
- time
- vlan
- wget
## kernel modules for specific group hosts
# to include it in your play, an example is given below:
#openstack_host_specific_kernel_modules:

View File

@ -29,4 +29,6 @@ galaxy_info:
- development
- openstack
dependencies:
- apt_package_pinning
- role: apt_package_pinning
when:
- ansible_pkg_mgr == 'apt'

View File

@ -14,7 +14,14 @@
# TODO(odyssey4me) remove this once https://review.openstack.org/288634 has merged
# and the disk images are rebuilt and redeployed.
curl
wget
# Requirements for Paramiko 2.0
libssl-dev
libffi-dev
libffi-dev [platform:dpkg]
libssl-dev [platform:dpkg]
libffi-devel [platform:rpm]
openssl-devel [platform:rpm]
# For selinux
libselinux-python [platform:rpm]

View File

@ -22,6 +22,10 @@ if [ "$(which apt-get)" ]; then
apt-get install -y build-essential python2.7 python-dev git-core libssl-dev libffi-dev
fi
if [ "$(which yum)" ]; then
yum install -y '@Development Tools' python-devel git libffi-devel openssl-devel
fi
# get pip, if necessary
if [ ! "$(which pip)" ]; then
curl --silent --show-error --retry 5 \

View File

@ -13,8 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- include: openstack_proxy_settings.yml
- include: openstack_host_packages.yml
- include: openstack_host_install.yml
- include: openstack_sysstat.yml
- include: openstack_update_hosts_file.yml
when: openstack_host_manage_hosts_file | bool

View File

@ -0,0 +1,26 @@
---
# 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.
- include: openstack_host_install_apt.yml
when:
- ansible_pkg_mgr == 'apt'
tags:
- install-apt
- include: openstack_host_install_yum.yml
when:
- ansible_pkg_mgr == 'yum'
tags:
- install-yum

View File

@ -22,6 +22,7 @@
register: apt_cache_stat
tags:
- openstack-apt-packages
- openstack-packages
- name: Update apt if needed
apt:

View File

@ -0,0 +1,27 @@
---
# 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 host packages
yum:
pkg: "{{ item }}"
state: present
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: openstack_host_yum_packages
tags:
- openstack-yum-packages
- openstack-packages

View File

@ -13,16 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Check Kernel Variant
fail:
msg: >
Wrong kernel Variant found
[ {{ ansible_kernel.split('-')[2] }} != generic ]
Resolve this issue before continuing.
when: ansible_kernel.split('-')[2] != 'generic'
tags:
- openstack-host-kernel-check
- name: Check Kernel Version
fail:
msg: >

View File

@ -21,6 +21,7 @@
with_items:
- { src: "sysstat.default.j2", dest: "/etc/default/sysstat" }
- { src: "sysstat.cron.j2", dest: "/etc/cron.d/sysstat", mode: "0755" }
when: openstack_host_sysstat_enabled | bool
notify: Restart sysstat
tags:
- openstack-host-sysstat

View File

@ -16,19 +16,17 @@
- name: Playbook for role testing
hosts: localhost
connection: local
gather_facts: true
pre_tasks:
- name: First ensure apt cache is always refreshed
apt:
update_cache: yes
when:
- ansible_pkg_mgr == 'apt'
roles:
- role: "{{ rolename | basename }}"
openstack_host_kernel_modules:
- dm_multipath
openstack_kernel_options:
- { key: 'vm.swappiness', value: 5 }
global_environment_variables:
http_proxy: "http://someproxy.example.com"
https_proxy: "https://someproxy.example.com"
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
post_tasks:
- name: Open modules file
slurp:
@ -73,7 +71,5 @@
- "'127.111.111.102 test2' in hosts_content"
- "release_file.stat.exists"
- "systat_file.stat.exists"
- "'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games' in environment_content"
- "'http_proxy=http://someproxy.example.com' in environment_content"
- "'https_proxy=https://someproxy.example.com' in environment_content"
- "'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' in environment_content"
- "ssh_dir.stat.isdir"

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

@ -0,0 +1,68 @@
---
# 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.
## Defined required kernel
openstack_host_required_kernel: 3.10.0-327.13.1.el7.x86_64
## Kernel modules loaded on hosts
openstack_host_kernel_modules:
- 8021q
- dm_multipath
- dm_snapshot
- ebtables
- ip6table_filter
- ip6_tables
- ip_tables
- ipt_MASQUERADE
- ipt_REJECT
- iptable_filter
- iptable_mangle
- iptable_nat
- iscsi_tcp
- nf_conntrack
- nf_conntrack_ipv4
- nf_defrag_ipv4
- nf_nat
- nf_nat_ipv4
# TODO (odyssey4me): revise the minimum kernel version once this kernel version is commonplace
# If we end up with more requirements like this, then we should change the approach.
- "{% if hostvars[inventory_hostname]['ansible_kernel'] | version_compare('4.4.0-0-generic', '<') %}scsi_dh{% endif %}"
- vhost_net
- x_tables
## Base packages
openstack_host_yum_packages:
- bridge-utils
- '@Development Tools'
- curl
- device-mapper-event
- dstat
- ebtables
- htop
- iptables
- irqbalance
- kmod-devel
- kmod-libs
- kmod
- lvm2
- python-devel
- rsync
- rsyslog
- sshpass
- sysstat
- sudo
- time
- vconfig
- wget

77
vars/ubuntu-14.04.yml Normal file
View File

@ -0,0 +1,77 @@
---
# 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.
## APT Cache Options
cache_timeout: 600
## Defined required kernel
openstack_host_required_kernel: 3.13.0-34-generic
## Kernel modules loaded on hosts
openstack_host_kernel_modules:
- 8021q
# TODO (odyssey4me): revise the minimum kernel version once this kernel version is commonplace
# If we end up with more requirements like this, then we should change the approach.
- "{% if hostvars[inventory_hostname]['ansible_kernel'] | version_compare('3.18.0-0-generic', '>') %}br_netfilter{% endif %}"
- dm_multipath
- dm_snapshot
- ebtables
- ip6table_filter
- ip6_tables
- ip_tables
- ipt_MASQUERADE
- ipt_REJECT
- iptable_filter
- iptable_mangle
- iptable_nat
- iscsi_tcp
- nbd
- nf_conntrack
- nf_conntrack_ipv4
- nf_defrag_ipv4
- nf_nat
- nf_nat_ipv4
# TODO (odyssey4me): revise the minimum kernel version once this kernel version is commonplace
# If we end up with more requirements like this, then we should change the approach.
- "{% if hostvars[inventory_hostname]['ansible_kernel'] | version_compare('4.4.0-0-generic', '<') %}scsi_dh{% endif %}"
- vhost_net
- x_tables
## Base packages
openstack_host_apt_packages:
- apparmor-utils
- apt-transport-https
- bridge-utils
- build-essential
- cgroup-lite
- curl
- dmeventd
- dstat
- ebtables
- htop
- iptables
- irqbalance
- libkmod-dev
- libkmod2
- lvm2
- python-software-properties
- python-dev
- rsync
- rsyslog
- sshpass
- sysstat
- time
- vlan
- wget

71
vars/ubuntu-16.04.yml Normal file
View File

@ -0,0 +1,71 @@
---
# 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.
## APT Cache Options
cache_timeout: 600
## Defined required kernel
openstack_host_required_kernel: 4.2.0-18-generic
## Kernel modules loaded on hosts
openstack_host_kernel_modules:
- 8021q
- dm_multipath
- dm_snapshot
- ebtables
- ip6table_filter
- ip6_tables
- ip_tables
- ipt_MASQUERADE
- ipt_REJECT
- iptable_filter
- iptable_mangle
- iptable_nat
- iscsi_tcp
- nbd
- nf_conntrack
- nf_conntrack_ipv4
- nf_defrag_ipv4
- nf_nat
- nf_nat_ipv4
- vhost_net
- x_tables
## Base packages
openstack_host_apt_packages:
- apparmor-utils
- apt-transport-https
- bridge-utils
- build-essential
- cgroup-lite
- curl
- dmeventd
- dstat
- ebtables
- htop
- iptables
- irqbalance
- libkmod-dev
- libkmod2
- lvm2
- python-software-properties
- python-dev
- rsync
- rsyslog
- sshpass
- sysstat
- time
- vlan
- wget