Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/l-with/ansible-role-set_and_check_ci_facts


https://github.com/l-with/ansible-role-set_and_check_ci_facts

ansible ansible-role environment-variables terraform-state

Last synced: 3 days ago
JSON representation

Awesome Lists containing this project

README

        

# Ansible Role set and check CI facts

sets and checks facts from environment variables or from terraform state on control host

## Dependencies

The role depends on terraform and a backend configuration for terraform including the credentials (possibly set by environment variables) in the folder the playbook is executed (not the folder of the playbook).

The role uses `community.general.json_query`.

## Role Variables

| group | variable | default | description |
| --- | --- | ---| --- |
| facts | set_and_check_ci_facts_required_vars | `[]` |

the list of variables to get from environment or terraform state

The variables are looked up from

  • the environment variables with the same name as in the list, but in upper cases (if `set_and_check_facts_from_terraform_state` is `false`)

  • the outputs of the terraform state with the same name as in the list (if `set_and_check_facts_from_terraform_state`)

If the variable could not be set and is not in `set_and_check_ci_facts_non_required_vars`, ansible.builtin.failed is used to fail. |
| facts | set_and_check_ci_facts_non_required_vars | `[]` | the list of variables not to check if set or not |
| facts | set_and_check_ci_facts_required_env_vars | `[]` |

the list of variables to get from environment

The variables are looked up from the environment variables with the same name as in the list, but in upper cases. |
| facts | set_and_check_ci_facts_non_required_env_vars | `[]` | the list of variables not to check if set or not (subset of `set_and_check_ci_facts_required_env_vars`) |
| facts | set_and_check_ci_facts_required_tf_vars | `[]` |

the list of environment variables `TF_VAR_*` to get from the environment

The ansible variables are named without prefix `TF_VAR_` and assumed to be named with exact case. |
| facts | set_and_check_ci_facts_non_required_tf_vars | `[]` | the list of variables `TF_VAR_*` not to check if set or not (subset of `set_and_check_ci_facts_required_tf_vars`) |
| control | set_and_check_ci_facts_from_terraform_state | `false` | if the facts in `set_and_check_ci_facts_required_vars` should be read from terraform state instead from environment |
| control | set_and_check_ci_facts_terraform_command | `'terraform'` |

the terraform cmd

This can be used for GitLab ci to set to `gitlab-terraform` or for specifying a terraform command by full path. |
| control | `set_and_check_ci_facts_terraform_dir` | `'.'` | the director to `chdir` before executing `set_and_check_ci_facts_terraform_command` |
| debug | `set_and_check_ci_facts_print_terraform_state` | `false` | if the terraform state should be printed (only output values) |