Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible: create collection to store reusable roles. #135

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The [infra](./infra) directory contains code which manages and handles deployed
and is partitioned by AWS region.

### Shared
The [shared](./shared) directory contains reusable Terraform modules, Ansible roles, and Nomad job
specifications.
The [shared](./shared) directory contains reusable Terraform modules, Ansible roles and collections,
and Nomad job specifications.

### Tools
The [tools](./tools) directory hosts our custom written Go tools which are aimed at running and
Expand Down
2 changes: 0 additions & 2 deletions ansible.cfg

This file was deleted.

1 change: 0 additions & 1 deletion infra/eu-west-2/core/ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[defaults]
roles_path=../../../../shared/ansible/roles
inventory=inventory.yaml
6 changes: 3 additions & 3 deletions infra/eu-west-2/core/ansible/playbook_bastion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

- hosts: bastion
roles:
- role: common
- role: hashicorp.nomad_bench.common

- role: gantsign.golang
vars:
golang_gopath: "/home/{{ ansible_user_id }}/go"
golang_version: "1.21.7"
golang_redis_sha256sum: "13b76a9b2a26823e53062fa841b07087d48ae2ef2936445dc34c4ae03293702c"

- role: influxdb_telegraf
- role: hashicorp.nomad_bench.influxdb_telegraf
vars:
influxdb_telegraf_input_nomad_enabled: false
influxdb_telegraf_output_token: "{{ terraform_influxdb_token }}"
Expand All @@ -20,6 +20,6 @@
# Hack to make the Terraform dynamic inventory plugin work with complex types.
influxdb_telegraf_output_urls: "{{ terraform_influxdb_telegraf_output_urls_json | ansible.builtin.from_json }}"

- role: build
- role: hashicorp.nomad_bench.build
vars:
build_user: "{{ lookup('env', 'USER') }}"
8 changes: 4 additions & 4 deletions infra/eu-west-2/core/ansible/playbook_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

- hosts: client
roles:
- role: common
- role: hashicorp.nomad_bench.common

- role: cni
- role: hashicorp.nomad_bench.cni

- role: "geerlingguy.docker"
become: true

- role: nomad
- role: hashicorp.nomad_bench.nomad
vars:
nomad_client_enabled: true
nomad_server_join_retry_join: ["{{ terraform_nomad_server_join }}"]
Expand All @@ -31,7 +31,7 @@
enabled: true
nomad_acl_enabled: true

- role: influxdb_telegraf
- role: hashicorp.nomad_bench.influxdb_telegraf
vars:
influxdb_telegraf_input_nomad_url: "https://127.0.0.1:4646"
influxdb_telegraf_input_nomad_tls_ca: "{{ nomad_config_dir }}tls/ca.pem"
Expand Down
4 changes: 2 additions & 2 deletions infra/eu-west-2/core/ansible/playbook_lb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

- hosts: lb
roles:
- role: common
- role: hashicorp.nomad_bench.common

- role: nomad_lb
- role: hashicorp.nomad_bench.nomad_lb
vars:
nomad_lb_ca_cert: "{{ lookup('file', '../tls/nomad-agent-ca.pem') }}"
nomad_lb_tls_cert: "{{ lookup('file', '../tls/global-client-nomad.pem') }}"
Expand Down
6 changes: 3 additions & 3 deletions infra/eu-west-2/core/ansible/playbook_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

- hosts: server
roles:
- role: common
- role: hashicorp.nomad_bench.common

- role: nomad
- role: hashicorp.nomad_bench.nomad
vars:
nomad_server_enabled: true
nomad_server_bootstrap_expect: 3
Expand All @@ -21,7 +21,7 @@
nomad_cli_tls_cert_key: "{{ lookup('file', '../tls/global-cli-nomad-key.pem') }}"
nomad_acl_enabled: true

- role: influxdb_telegraf
- role: hashicorp.nomad_bench.influxdb_telegraf
vars:
influxdb_telegraf_input_nomad_url: "https://127.0.0.1:4646"
influxdb_telegraf_input_nomad_tls_ca: "{{ nomad_config_dir }}tls/ca.pem"
Expand Down
1 change: 0 additions & 1 deletion infra/eu-west-2/test-cluster-template/ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[defaults]
roles_path=../../../../shared/ansible/roles
inventory=inventory.yaml
8 changes: 4 additions & 4 deletions infra/eu-west-2/test-cluster-template/ansible/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- hosts: bastion
roles:
- role: build
- role: hashicorp.nomad_bench.build
vars:
build_user: "{{ lookup('env', 'USER') }}"
tags:
Expand All @@ -12,8 +12,8 @@

- hosts: server
roles:
- role: common
- role: nomad
- role: hashicorp.nomad_bench.common
- role: hashicorp.nomad_bench.nomad
vars:
# Most variables are defined in the inventory with Terraform. You can
# customize values for specific hosts or groups using the files in
Expand All @@ -23,7 +23,7 @@
# each host and group.
nomad_server_join_retry_join: ["{{ terraform_nomad_server_join }}"]
nomad_custom_binary_source: "{{ build_nomad_local_code_path }}/pkg/linux_amd64/nomad"
- role: influxdb_telegraf
- role: hashicorp.nomad_bench.influxdb_telegraf
vars:
influxdb_telegraf_input_nomad_url: "http://127.0.0.1:4646"
influxdb_telegraf_output_urls: "{{ terraform_influxdb_telegraf_output_urls_json | ansible.builtin.from_json }}"
11 changes: 11 additions & 0 deletions shared/ansible/hashicorp/nomad_bench/galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

namespace: "hashicorp"
name: "nomad_bench"
version: "0.0.1"
readme: "../../README.md"
authors:
- "HashiCorp"
description: "Nomad Bench Ansible Collection"
repository: "https://github.com/hashicorp-forge/nomad-bench"
11 changes: 11 additions & 0 deletions shared/ansible/hashicorp/nomad_bench/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ansible==9.2.0
ansible-core==2.16.3
cffi==1.16.0
cryptography==42.0.2
Jinja2==3.1.3
jmespath==1.0.1
MarkupSafe==2.1.4
packaging==23.2
pycparser==2.21
PyYAML==6.0.1
resolvelib==1.0.1
12 changes: 12 additions & 0 deletions shared/ansible/hashicorp/nomad_bench/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

roles:
- src: "geerlingguy.docker"
version: "7.1.0"
- src: "gantsign.golang"
version: "3.2.4"

collections:
- name: "cloud.terraform"
version: "2.0.0"
3 changes: 3 additions & 0 deletions shared/ansible/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ roles:
collections:
- name: "cloud.terraform"
version: "2.0.0"
- name: "hashicorp.nomad_bench"
source: "shared/ansible/hashicorp/nomad_bench"
type: "dir"
Loading