Skip to content
/ ansible-role-tpl Public template

Ansible template for wayofdev roles.

License

Notifications You must be signed in to change notification settings

wayofdev/ansible-role-tpl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation




Build Status Ansible Role Latest Version Ansible Quality Score Ansible Role Software License Commits since latest release

Ansible Role: Template

This is template, that is used to create roles for wayofdev project.

If you like/use this role, please consider starring it. Thanks!


πŸ—‚ Table of Contents


🌳 Directory Tree for Project

Repository uses default structure, sugested by Ansible Documentation

β”œβ”€β”€ πŸ“„ Makefile
β”œβ”€β”€ πŸ“„ README.md
β”œβ”€β”€ πŸ—‚ assets
β”œβ”€β”€ πŸ—‚ contrib
β”‚Β Β  └── poetry-bin
β”œβ”€β”€ πŸ—‚ defaults
β”‚Β Β  └── πŸ“„ main.yml
β”œβ”€β”€ πŸ—‚ files
β”œβ”€β”€ πŸ—‚ handlers
β”‚Β Β  └── πŸ“„ main.yml
β”œβ”€β”€ πŸ—‚ meta
β”‚Β Β  └── πŸ“„ main.yml
β”œβ”€β”€ πŸ—‚ molecule
β”‚Β Β  β”œβ”€β”€ πŸ—‚ _partials
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ πŸ—‚ playbooks
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ πŸ“„ converge.yml
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ πŸ—‚ defaults
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── πŸ“„ verify.yml
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ πŸ“„ ssh_config
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ πŸ—‚ tasks
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── πŸ“„ setup.yml
β”‚Β Β  β”‚Β Β  └── πŸ—‚ vars
β”‚Β Β  β”‚Β Β      └── πŸ“„ main.yml
β”‚Β Β  β”œβ”€β”€ πŸ—‚ default
β”‚Β Β  β”‚Β Β  └── πŸ“„ molecule.yml
β”‚Β Β  β”œβ”€β”€ πŸ—‚ default-macos-on-localhost
β”‚Β Β  β”‚Β Β  └── πŸ“„ molecule.yml
β”‚Β Β  └── πŸ—‚ default-macos-over-ssh
β”‚Β Β      └── πŸ“„ molecule.yml
β”œβ”€β”€ πŸ“„ pyproject.toml
β”œβ”€β”€ πŸ“„ requirements.yml
β”œβ”€β”€ πŸ—‚ tasks
β”‚Β Β  └── πŸ“„ main.yml
β”œβ”€β”€ πŸ—‚ templates
└── πŸ—‚ vars
    └── πŸ“„ main.yml

πŸ‘¨β€πŸ’» IDE Support

Jetbrains products has great ansible language support together with OrchidE plugin.

⚠️ Notice: For ansible language support and autocompletion with OrchidE following additional File Type Patterns should be added.

Open Preferences β†’ Languages & Frameworks β†’ OrchidE β†’ File Type Patterns:

Ansible Type Regex Pattern Pattern Type
RoleTask .*/tasks/.*\.ya?ml Include
RoleTask .*/handlers/.*\.ya?ml Include
Variable .*/tests/defaults/.*\.ya?ml Include
Variable .*/defaults/.*\.ya?ml Include
Variable .*/meta/.*\.ya?ml Include
Variable .*/vars/.*\.ya?ml Include

πŸ“‘ Requirements

  • Up-to-date version of ansible. During maintenance/development, we stick to ansible versions and will use new features if they are available (and update meta/main.yml for the minimum version).
  • Compatible OS. See compatibility table.
  • Role has dependencies on third-party roles on different operating systems. See requirements.yml and dependencies section.

πŸ”§ Role Variables

Available variables are listed below, along with example values (see defaults/main.yml). Additional variables are stored in vars/main.yml.


β†’ Structure

---

tpl_key: value

πŸ“— Example Playbook

---

- hosts: all
  connection: local

  vars:
    tpl_key: value

  roles:
    - wayofdev.homebrew
    - wayofdev.tpl

βš™οΈ Development

To install dependencies and start development you can check contents of our Makefile

Install poetry using poetry-bin and all dev python dependencies:

$ make install

Install only python dependencies, assuming that you already have poetry:

$ make install-deps

Install all git hooks:

$ make hooks

Lint all role files:

$ make lint

πŸ§ͺ Testing

You can check Makefile to get full list of commands for remote and local testing. For local testing you can use these comands to test whole role or separate tasks:

β†’ on localhost

⚠️ Notice: By defaut all tests are ran against your local machine!

# run molecule tests on localhost
$ poetry run molecule test --scenario-name default-macos-on-localhost -- -vvv

# or with make command
$ make m-local

# choose which tags will be included
$ export TASK_TAGS="tpl-install,tpl-update"; make m-local

# runs molecule with docker driver
$ poetry run molecule test --scenario-name default -- -vvv

# or with make file
$ make m-linux

β†’ over SSH

# run molecule scenarios against remote machines over SSH
# this will need VM setup and configuration
$ poetry run molecule test --scenario-name default-macos-over-ssh -- -vvv

$ make m-remote

# tags also can be passed
$ export TASK_TAGS="tpl-install,tpl-update"
$ make m-remote

πŸ“¦ Dependencies

Installation handled by Makefile and requirments are defined in requirements.yml

β†’ for all

β†’ only macOS

β†’ only Linux


🧩 Compatibility

This role has been tested on these systems:

system / container tag
macos monterey
macos big-sur
ubuntu jammy
ubuntu focal
debian bullseye
debian buster
fedora 36
fedora 35
centos 8
centos 7

🀝 License

Licence


πŸ™†πŸΌβ€β™‚οΈ Author Information

This role was created in 2022 by lotyp / wayofdev.


🧱 Credits and Resources

Inspired by:

  • Some resources goes here if needed...

🫑 Contributors