Getting started

Example inventory

The debops.resources role is included by default in the common.yml DebOps playbook, you don't need to add hosts to any groups to enable it.

Role provides a special variable, resources__src which points to ansible/resources/ directory located in the DebOps project directory, relative to the currently used Ansible inventory. This variable can be used in the item.src keys of the file/archive lists to use the files from a central location relative to the current DebOps project directory.

The ansible/resources/ directory is not created automatically, and role does not check the existence of the specified files before using them.

An example usage:

  - '/tmp/example-dir'

  - src: '{{ resources__src + "file.txt" }}'
    dest: '/tmp/example-dir/file.txt'

Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.resources role:


- name: Manage custom resources
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_all_hosts', 'debops_service_resources' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'


    - role: resources
      tags: [ 'role::resources', 'skip::resources' ]

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 a host was first configured to speed up playbook execution, when you are sure that most of the configuration is already in the desired state.

Available role tags:


Main role tag, should be used in the playbook to execute all tasks.


Manage paths on the remote hosts.


Manage online resources on the remote hosts.


Unpack archives on the remote hosts.


Manage file contents on the remote hosts.


Manage delayed paths on the remote hosts.


Run specified commands on the remote hosts.


Manage file privileges on the remote hosts.