diff --git a/defaults/main.yml b/defaults/main.yml index 54956238..8229b901 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: diff --git a/meta/main.yml b/meta/main.yml index f9d7c1b5..4156d469 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -29,4 +29,6 @@ galaxy_info: - development - openstack dependencies: - - apt_package_pinning + - role: apt_package_pinning + when: + - ansible_pkg_mgr == 'apt' diff --git a/other-requirements.txt b/other-requirements.txt index 67cd643a..b7932824 100644 --- a/other-requirements.txt +++ b/other-requirements.txt @@ -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] diff --git a/run_tests.sh b/run_tests.sh index f7a19cc7..40cb7ffe 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -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 \ diff --git a/tasks/main.yml b/tasks/main.yml index eccbacd4..edea7359 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/tasks/openstack_host_install.yml b/tasks/openstack_host_install.yml new file mode 100644 index 00000000..8337ae71 --- /dev/null +++ b/tasks/openstack_host_install.yml @@ -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 \ No newline at end of file diff --git a/tasks/openstack_host_packages.yml b/tasks/openstack_host_install_apt.yml similarity index 98% rename from tasks/openstack_host_packages.yml rename to tasks/openstack_host_install_apt.yml index 28c53621..bb80b581 100644 --- a/tasks/openstack_host_packages.yml +++ b/tasks/openstack_host_install_apt.yml @@ -22,6 +22,7 @@ register: apt_cache_stat tags: - openstack-apt-packages + - openstack-packages - name: Update apt if needed apt: diff --git a/tasks/openstack_host_install_yum.yml b/tasks/openstack_host_install_yum.yml new file mode 100644 index 00000000..a62e7e70 --- /dev/null +++ b/tasks/openstack_host_install_yum.yml @@ -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 diff --git a/tasks/openstack_kernel_check.yml b/tasks/openstack_kernel_check.yml index 6a1f5f9d..8deab5ec 100644 --- a/tasks/openstack_kernel_check.yml +++ b/tasks/openstack_kernel_check.yml @@ -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: > diff --git a/tasks/openstack_sysstat.yml b/tasks/openstack_sysstat.yml index 481b052e..24dacedf 100644 --- a/tasks/openstack_sysstat.yml +++ b/tasks/openstack_sysstat.yml @@ -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 diff --git a/tests/test.yml b/tests/test.yml index f386d937..229e3080 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -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" diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml new file mode 100644 index 00000000..af7e2d1b --- /dev/null +++ b/vars/redhat-7.yml @@ -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 diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml new file mode 100644 index 00000000..b4569c11 --- /dev/null +++ b/vars/ubuntu-14.04.yml @@ -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 diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml new file mode 100644 index 00000000..7b0cb8d0 --- /dev/null +++ b/vars/ubuntu-16.04.yml @@ -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