Skip to content

donhector/ansible-role-crossplatform

Repository files navigation

Ansible role: crossplatform

Ansible Galaxy role badge Ansible Galaxy quality badge CI badge MIT licensed Python version pre-commit badge semantic-release commitizen friendly gitlint enabled

Description

Example of a dummy cross-platform Ansible role. The purpose of this repo was to:

  • Illustrate handling OS specific vars and tasks in Ansible roles
  • Illustrate how a role can be tested across platforms using Molecule
  • Illustrate the use of some nice Github features:
    • Github Actions: To build a CI/CD pipelines for the role.
    • Bots: To manage vulnearble dependencies (ie. dependabot) and pull requests (ie. stale)
    • Issue Templates: To standarize community raised issues/questions
  • Illustrate the use of good software developement practices:
    • Virtual environments with pipenv
    • enforcing coding standards:
      • linters
      • editorconfig
      • pre-commit checks
    • use of Makefile to provide a common interface to usual tasks such as 'lint', 'test' and hide complexity for end users.
    • Commit message standarization and enforcement (ie: conventional commits via commitizen + pre-commit validations)
    • Semantic versioning and releasing (ie: semantic-release)

Requirements

NOTE: Role requires Fact Gathering by ansible!

One of the following OS families:

  • Debian
  • RedHat
  • Windows

Role Variables

crossplatform_message : Message to be printed

Dependencies

None

Example Playbook

- name: Test the role
  hosts: localhost
  roles:
    - ansible-role-crossplatform

To test:

ansible-playbook tests/test.yml -i tests/inventory

License

MIT

Author Information

@donhector