feat(variables): start polishing variables for customization

This commit is contained in:
Bertrand Lanson 2023-12-30 15:54:37 +01:00
parent 97a4752dbe
commit 878f97244b
3 changed files with 72 additions and 45 deletions

View File

@ -5,6 +5,11 @@
gather_facts: true gather_facts: true
become: true become: true
tasks: tasks:
- name: "Vault"
when: enable_vault | bool
tags:
- vault
block:
- name: "Include ednxzu.hashicorp_vault" - name: "Include ednxzu.hashicorp_vault"
ansible.builtin.include_role: ansible.builtin.include_role:
name: ednxzu.hashistack.hashicorp_vault name: ednxzu.hashistack.hashicorp_vault

View File

@ -7,11 +7,12 @@ enable_vault: "yes"
enable_consul: "yes" enable_consul: "yes"
enable_nomad: "yes" enable_nomad: "yes"
deployment_method: "docker" deployment_method: "host"
api_interface: "eth0" api_interface: "eth0"
api_interface_address: "{{ ansible_facts[api_interface]['ipv4']['address'] }}" api_interface_address: "{{ ansible_facts[api_interface]['ipv4']['address'] }}"
configuration_directory: "{{ lookup('env', 'PWD') }}/etc/hashistack" configuration_directory: "{{ lookup('env', 'PWD') }}/etc/hashistack"
configuration_global_vars_file: "globals.yml"
########################## ##########################
# Support options ######## # Support options ########
@ -93,7 +94,7 @@ default_container_extra_volumes:
- "/etc/localtime:/etc/localtime" - "/etc/localtime:/etc/localtime"
hashi_vault_start_service: true hashi_vault_start_service: true
hashi_vault_version: "1.15.2" hashi_vault_version: latest
hashi_vault_deploy_method: "{{ deployment_method }}" # deployment method, either host or docker hashi_vault_deploy_method: "{{ deployment_method }}" # deployment method, either host or docker
hashi_vault_env_variables: {} hashi_vault_env_variables: {}
hashi_vault_data_dir: "/opt/vault" hashi_vault_data_dir: "/opt/vault"

21
playbooks/load_vars.yml Normal file
View File

@ -0,0 +1,21 @@
---
# hashistack variable injection playbook
- name: "Deploy"
hosts: all
gather_facts: true
become: true
tasks:
- name: "Load global variables"
ansible.builtin.include_vars:
dir: "{{ configuration_directory }}"
files_matching: "{{ configuration_global_vars_file }}"
- name: "Load group specific variables"
ansible.builtin.include_vars:
dir: ""
files_matching: ""
- name: "Load host specific variables"
ansible.builtin.include_vars:
dir: ""
files_matching: ""