Code Monkey home page Code Monkey logo

ansible-content-testing's Introduction

Ansible Content Testing repository

CI

This repository is meant to test the migration of various types of module and role invocations against the 'next generation' of Ansible, e.g. the ACD Ansible Community Distribution.

Testing

This project uses molecule to run tests in a controlled execution environment, and also requires kind to be installed for a local Kubernetes cluster to test against. Finally, it also requires the openshift Docker library be installed (pip3 install openshift).

Make sure you have Molecule, Docker, and Kind installed, then run:

molecule test

The CI GitHub Actions Workflow is meant to test this playbook against the following scenarios:

  • Latest Ansible 2.9.x release (should pass)
  • Latest Ansible ACD release (what will become 2.10) (should pass)
  • Latest ansible-base release (devel branch) (should fail)

License

MIT.

Author

Jeff Geerling maintains a large variety of Ansible content.

ansible-content-testing's People

Contributors

geerlingguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jefferyq7

ansible-content-testing's Issues

Have the same-named role across two collections, and ensure that both run

This is something that is currently breaking in Ansible 2.9 and below, but is fixed in ansible-base/2.10: ansible/ansible#69307

So basically, have two collections (with different names), and both collections have a role with the same role name. Have each role maybe write a different-named file to the filesystem, then in the playbook, have an assert that fails if both of those files don't exist.

Figure out how to run on ACD (Ansible Community Distribution)

As of February, the status of ACD / 'what is installed with pip install ansible as of 2.10' has been:

Please note that ACD is still currently in development and not available for testing yet at this time.

(Additionally, ansible-base is not yet installable either... but I could install devel.)

The main goal of this repository is to start testing what kind of modifications a playbook that works in Ansible 2.9 and earlier would need to run in ACD (hopefully, none).

Set up initial playbook for testing

The first playbook / use case is something that I have a lot of in Ansible 2.9 and earlier—use some galaxy content, a local role, some modules in ansible core that are not core-maintained...

  • Has a local ('standalone') role that is not part of Ansible Galaxy and uses modules that are in the community.general collection as of Ansible 2.10.
  • Has a role or two installed from Ansible Galaxy (like geerlingguy.mysql)
  • Uses content from a collection on Ansible Galaxy (like k8s_exec module in community.kubernetes — a module that's not in core 2.9)
  • Has a requirements.yml file to install said role(s) and collection(s) (ideally with one command to install all dependencies—currently it's impossible to do this even in 2.9)

Test tombstoning PR against ACD installation from #3

In #3 I got ACD installing (a very preliminary pre-build) and am using that to test the 2.9-era playbook (making sure modules and roles still work correctly).

However, ACD is currently failing because it needs this (ansible/ansible#67684) tombstoning/redirection PR in place to resolve the modules to the proper locations.

I'm not sure if that PR works or not, yet, but having a test playbook like this one should ensure there's some form of CI against it using an external playbook. I just need to figure out how to get that PR integrated with what I'm building for ACD...

Currently the ACD build fails with:

ERROR! couldn't resolve module/action 'docker_container'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/opt/hostedtoolcache/Python/3.7.6/x64/lib/python3.7/site-packages/molecule/provisioner/ansible/playbooks/docker/destroy.yml': line 8, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Destroy molecule instance(s)
      ^ here

Fix "couldn't resolve module/action 'k8s_exec'"

After working through #1, the local role I'm running is running into an issue where Ansible can't find the module that I used successfully in the playbook when the same task is copied into a role I created locally using ansible-galaxy init replay in the roles/ directory:

TASK [include_role : replay] ***************************************************
ERROR! couldn't resolve module/action 'k8s_exec'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/Users/jgeerling/Development/GitHub/ansible-content-testing/roles/replay/tasks/main.yml': line 10, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Test the k8s_exec module from the collection (in replay).
  ^ here

This seems to be me running into this annoying issue again: ansible/ansible#68198

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.