Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ngine-io/ansible-collection-hashi

Hashicorp Ansible Role Collection
https://github.com/ngine-io/ansible-collection-hashi

ansible ansible-collection ansible-collections ansible-roles consul hashicorp hashicorp-consul hashicorp-nomad

Last synced: about 23 hours ago
JSON representation

Hashicorp Ansible Role Collection

Awesome Lists containing this project

README

        

# Ansible Collection - ngine_io.hashi

## Install

```yaml
# file: ./requirements.yml
collections:
- name: [email protected]:ngine-io/ansible-collection-hashi.git
type: git
version: master
```

## Example Configuration

NOTE: Configuring the firewalld/iptables is not part of the collection.

### Inventory

```ini
[consul:children]
nomad

[nomad:children]
nomad_servers
nomad_clients

[nomad_servers]
nomad-server[1:3]

[nomad_clients]
nomad-client[1:5]
```

### Group Vars

#### Vars for nomad
```yaml
# file: ./group_vars/nomad.yml
nomad__use_consul: true
```

#### Vars for nomad clients
```yaml
# file: ./group_vars/nomad_clients.yml
---
consul__role: client
nomad__roles:
- client
```

#### Vars for nomad servers

```yaml
# file: ./group_vars/nomad_servers.yml
---
consul__role: server
nomad__node_class: server
nomad__roles:
- server
# Optional: also be a client
# - client
```

### Playbook
```yaml
# file: ./playbooks/nomad.yml
---
- hosts: nomad_servers

- hosts: nomad_servers
serial: 1
roles:
- role: ngine_io.hashi.consul
tags: consul
- role: ngine_io.hashi.nomad
tags: nomad

- hosts: nomad_clients
serial:
- 1
- 30%
roles:
# Install docker for docker workloads
# - role: geerlingguy.docker
# tags: docker
- role: ngine_io.hashi.consul
tags: consul
- role: ngine_io.hashi.cni
tags: cni
- role: ngine_io.hashi.nomad
tags: nomad

- hosts: nomad_servers[0]
vars:
nomad_job__job_templates:
- name: http-echo
path: http-echo.nomad
- name: traefik
path: traefik.nomad
roles:
- role: ngine_io.hashi.nomad_job
tags: nomad_job
```

### Upgrading a Nomad cluster

```yaml
# file: ./playbooks/nomad_upgrade.yml
---
- hosts: nomad_servers
serial: 1
roles:
- role: ngine_io.hashi.nomad_upgrade
tags: nomad

- hosts: nomad_clients
serial:
- 1
- 30%
roles:
- role: ngine_io.hashi.nomad_upgrade
tags: nomad
```