tripleo-ansible/tripleo_ansible/roles/test_package_action/tasks/main.yml
Kevin Carter 12d9d8dd61
Import action plugin from tripleo-common
The package action plugin has been imported from tripleo common.
This plugin acts as a shim allowing tripleo to control package
installations within ansible using a global variable.

The action plugin will now have tests to ensure that it is
functioning as expected within ansible.

* The default scenario will run the test role normally ensuring
  that the plugin does not interfer with normal operations.
* The negative scenario will run the test role with the global
  option `tripleo_enable_package_install` set to false. This will
  ensure that no package is installed.
* The positive scenario will run the test role with the global
  option `tripleo_enable_package_install` set to true, which
  will ensure the expect package is installed.

All three scenarios have been added as jobs which run when
this role or plugin has been changed.

Because this job will run three different molecule scenarios
a change has been made to the pytest setup which will allow
us to pass in command line arguments to the job function.
This update will allow us to now set the command line option
`--scenario` when running tests. This new argument has been
documented in the `contributing.rst` file.

Change-Id: I096d6332f8231620e39ead557e7c9598adad66dd
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2019-06-17 11:00:54 -05:00

38 lines
1.5 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
# "{{ role_name }}" will search for and load any operating system variable file
# found within the "vars/" path. If no OS files are found the task will skip.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- name: Install test packages
package:
name: "{{ test_install_packages }}"
state: present