Getting started¶
Example inventory¶
To host the DebOps API, add the hosts to the
debops_service_debops_api
Ansible inventory host group:
[debops_service_debops_api]
hostname
Example playbook¶
Here's an example playbook that can be used to host the DebOps API on a set of hosts:
---
- name: Setup and manage a DebOps API server
collections: [ 'debops.debops', 'debops.roles01',
'debops.roles02', 'debops.roles03' ]
hosts: [ 'debops_service_debops_api' ]
become: True
environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'
roles:
- role: keyring
tags: [ 'role::keyring', 'skip::keyring', 'role::nginx' ]
keyring__dependent_apt_keys:
- '{{ nginx__keyring__dependent_apt_keys }}'
- role: apt_preferences
tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
apt_preferences__dependent_list:
- '{{ nginx_apt_preferences_dependent_list }}'
- role: ferm
tags: [ 'role::ferm', 'skip::ferm' ]
ferm__dependent_rules:
- '{{ nginx_ferm_dependent_rules }}'
- role: python
tags: [ 'role::python', 'skip::python' ]
python__dependent_packages3:
- '{{ nginx__python__dependent_packages3 }}'
python__dependent_packages2:
- '{{ nginx__python__dependent_packages2 }}'
- role: nginx
tags: [ 'role::nginx', 'skip::nginx' ]
nginx__dependent_servers:
- '{{ debops_api__nginx__servers }}'
- role: debops_api
tags: [ 'role::debops_api', 'skip::debops_api' ]
Ansible tags¶
You can use Ansible --tags
or --skip-tags
parameters to limit what
tasks are performed during Ansible run. This can be used after host is first
configured to speed up playbook execution, when you are sure that most of the
configuration has not been changed.
Available role tags:
role::debops_api
- Main role tag, should be used in the playbook to execute all of the role tasks as well as role dependencies.
role::debops_api:pkg
- Tasks related to system package management like installing, upgrading or removing packages.
role::debops_api:git
- Tasks related to
git
operations. Especially the tasks "DebOps API input data" can take up to one minute so you might want to skip them on subsequent role runs. role::debops_api:cron
- Tasks related to
cron
job configuration.