Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

provide metadata/dummy data for roles to allow for easier use/testing #325

Open
miabbott opened this issue Jan 29, 2018 · 2 comments
Open

Comments

@miabbott
Copy link
Collaborator

Over in #324, I muse about improving the CI tests to do better checking of changed roles in PRs.

Unfortunately, before we can do that effectively, we need to have some sane metadata/dummy data about the arguments that a role requires. Some of the roles have some snippets about required variables, but we really need a standard, so that tests can determine how to run the roles.

This is just a spitball idea, but something like this:

---
#
# name:  docker_run
# args:
#    - docker_image (required)
#    - run_options (optional)
#
# dummy_data:
#    - docker_image: registry.fedoraproject.org/fedora:27
#

So maybe we need to define a sane standard for providing dummy data and then work on updating all the roles to have said data.

@mike-nguyen
Copy link
Collaborator

mike-nguyen commented Feb 16, 2018

Here's a spitball idea:

Maybe have a roles/role_name/vars/test.yml with dummy data in it? For example

roles/ansible_version_check/vars/test.yml

---
avc_major: 2
avc_minor: 2

Then we can have a generic playbook like this:
test.yml

---
- name: Test Role
  hosts: all                                                                                               
  become: true

  vars_files:
    - "roles/{{ role }}/vars/test.yml"

  roles:
    - role: "{{ role }}"

To test, we run `ansible-playbook test.yml -e role="ansible_version_check"

This might need some work on the vars_files section if the role does not require any vars.

@miabbott
Copy link
Collaborator Author

@mike-nguyen I like it! We could still require vars/test.yml and just have it be a blank file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants