mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
add setup-snapshot.yml used to prepare testing snapshots
When running CI tests, test performance can be improved by creating a snapshot image to use for the test, pre-installed with packages used by the role tests. The CI system can use tests/setup-snapshot.yml to prepare the snapshot image. Rather than having a list of packages to install in multiple places, the code which ensures the facts and variables is moved to a separate tasks/set_facts.yml so that the setup playbook can use `tasks_from: set_facts.yml` to get the list of network packages to install. NOTE: The network role developers should add additional packages to setup-snapshot.yml for other packages installed by other tests. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
parent
2b17fe73e9
commit
3cbb6b24c1
3 changed files with 30 additions and 14 deletions
|
|
@ -2,20 +2,7 @@
|
|||
# get service facts, used in defaults/main.yml
|
||||
---
|
||||
- name: Ensure ansible_facts used by role
|
||||
setup:
|
||||
gather_subset: min
|
||||
when: not ansible_facts.keys() | list |
|
||||
intersect(__network_required_facts) == __network_required_facts
|
||||
no_log: true
|
||||
|
||||
- name: Check which services are running
|
||||
service_facts:
|
||||
no_log: true
|
||||
|
||||
# needed for ansible_facts.packages
|
||||
- name: Check which packages are installed
|
||||
package_facts:
|
||||
no_log: true
|
||||
include_tasks: tasks/set_facts.yml
|
||||
|
||||
- name: Print network provider
|
||||
debug:
|
||||
|
|
|
|||
17
tasks/set_facts.yml
Normal file
17
tasks/set_facts.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- name: Ensure ansible_facts used by role are present
|
||||
setup:
|
||||
gather_subset: min
|
||||
when: not ansible_facts.keys() | list |
|
||||
intersect(__network_required_facts) == __network_required_facts
|
||||
no_log: true
|
||||
|
||||
- name: Check which services are running
|
||||
service_facts:
|
||||
no_log: true
|
||||
|
||||
# needed for ansible_facts.packages
|
||||
- name: Check which packages are installed
|
||||
package_facts:
|
||||
no_log: true
|
||||
12
tests/setup-snapshot.yml
Normal file
12
tests/setup-snapshot.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Set facts used by role
|
||||
include_role:
|
||||
name: linux-system-roles.network
|
||||
tasks_from: set_facts.yml
|
||||
public: true
|
||||
|
||||
- name: Install test packages
|
||||
package:
|
||||
name: "{{ network_packages }}"
|
||||
state: present
|
||||
Loading…
Add table
Add a link
Reference in a new issue