generic roles for different tools of an organization or company
Official Ansible Documentation for using collections
Add to your requirements.yml:
# requirements.yml
collections:
# current unreleased from git source, requires ansible 2.10 or higher
- name: git+https://github.com/teamapps-org/ansible-collection-teamapps-general.git
type: git
version: mainRun ansible-galaxy collection install -r requirements.yml -f
Tip: You can specify the installation path for collections in your project in ansible.cfg before running the command above.
# ansible.cfg
[defaults]
collections_path = collectionsThe roles in this collection can be used by using their full name, prefixed with teamapps.general
Check the defaults.yml of the roles for information on how to configure them.
# Ansible Playbook
# site.yml
- name: Zammad Helpdesk Play
hosts: yourhost.example.com
vars:
letsencrypt_email: mail@example.com
zammad_domain: help.example.com
roles:
- role: teamapps.general.webproxy
- role: teamapps.general.zammad
tags: zammad
- The collection now ships the
teamapps.general.to_nice_yamlfilter, which transparently callscommunity.general.to_nice_yamlon newer Ansible releases and falls back to the legacy core implementation on older ones. Add thecommunity.generalcollection to your requirements when targeting ansible-core 2.12 or newer so the upstream filter is available. - ansible-core newer than 2.19 removed the safe YAML dumper from core. When the
community.generalimplementation is missing the collection still falls back to the legacy dumper but now emits a warning because sensitive vault strings could be dumped in clear text (see ansible/ansible#85722). Installcommunity.generalto avoid the warning and regain the safe serializer.
We use pipenv to install ansible and dependency package.
This is my current way I do it on Ubuntu. There are other ways to install ansible and manage the python dependencies.
cd ansible-collection-teamapps-general # where you cloned this repository
sudo apt install python3-pip
# set PATH so it includes user's ~/.local/bin
echo $PATH | grep '\.local/bin' || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.profile && export PATH="$HOME/.local/bin:$PATH"
pip3 install --user --upgrade pip pipenv
pipenv shell --three
pipenv sync
# check ansible working correctly
ansible --versioncd ansible-collection-teamapps-general # where you cloned this repository
pipenv shell- Update your pip and pipenv packages:
pip3 install --user --upgrade pip pipenv - To update your local packages to what's defined in the Pipfile and Pipfile.lock, run
pipenv sync - To update the Pipfile.lock, run
pipenv update - For a major upgrade of ansible, you will get a warning. use
pipenv --rmand thenpipenv sync
Check YAML and ansible syntax
ansible-lint roles/*Apache 2.0