* 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>
76 lines
2.5 KiB
YAML
76 lines
2.5 KiB
YAML
---
|
|
# Copyright 2015, 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: 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 }}"
|
|
global_environment_variables:
|
|
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
post_tasks:
|
|
- name: Open modules file
|
|
slurp:
|
|
src: /etc/modules
|
|
register: modules_file
|
|
- name: Open sysctl file
|
|
slurp:
|
|
src: /etc/sysctl.conf
|
|
register: sysctl_file
|
|
- name: Open hosts file
|
|
slurp:
|
|
src: /etc/hosts
|
|
register: hosts_file
|
|
- name: Open /etc/environment file
|
|
slurp:
|
|
src: /etc/environment
|
|
register: environment_file
|
|
- name: Read files
|
|
set_fact:
|
|
modules_content: "{{ modules_file.content | b64decode }}"
|
|
sysctl_content: "{{ sysctl_file.content | b64decode }}"
|
|
hosts_content: "{{ hosts_file.content | b64decode }}"
|
|
environment_content: "{{ environment_file.content | b64decode }}"
|
|
- name: Check for release file
|
|
stat:
|
|
path: /etc/openstack-release
|
|
register: release_file
|
|
- name: Check for systat file
|
|
stat:
|
|
path: /etc/default/sysstat
|
|
register: systat_file
|
|
- name: Check for ssh dir
|
|
stat:
|
|
path: "{{ ansible_env.HOME}}/.ssh"
|
|
register: ssh_dir
|
|
- name: Check role functions
|
|
assert:
|
|
that:
|
|
- "'dm_multipath' in modules_content"
|
|
- "'vm.swappiness' in sysctl_content"
|
|
- "'127.111.111.101 test1' in hosts_content"
|
|
- "'127.111.111.102 test2' in hosts_content"
|
|
- "release_file.stat.exists"
|
|
- "systat_file.stat.exists"
|
|
- "'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' in environment_content"
|
|
- "ssh_dir.stat.isdir"
|