Getting started

Initial configuration

The debops.hashicorp role does not install any HashiCorp applications by default, even if enabled in the Ansible inventory. You need to specify the application names you wish to install using the hashicorp__applications list. For example, to install consul on all hosts that use the role, create a file in the Ansible inventory with contents:

hashicorp__applications: [ 'consul' ]

The role will install the consul binary, after verifying its authenticity, in the /usr/local/bin directory so that it will be automatically available for all users.

List of HashiCorp applications supported by the role can be found in the hashicorp__default_version_map default variable. You can also use it to easily install all supported applications at once:

hashicorp__applications: '{{ hashicorp__default_version_map.keys() }}'

After the binaries are installed, they are ready to be configured by other Ansible roles. See the Ansible integration document for more details.

Example inventory

The debops.hashicorp Ansible role is not enabled by default. To enable it on a host, you need to include that host in the [debops_service_hashicorp] inventory group:

[debops_service_hashicorp]
hostname

Example playbook

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

---

- name: Install HashiCorp applications
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_hashicorp' ]
  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::hashicorp' ]
      keyring__dependent_gpg_keys:
        - '{{ hashicorp__keyring__dependent_gpg_keys }}'

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