40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
- name: Login to Infisical
|
|
infisical.vault.login:
|
|
url: "https://app.infisical.com"
|
|
auth_method: universal_auth
|
|
universal_auth_client_id: "{{ lookup('env', 'INFISICAL_UNIVERSAL_AUTH_CLIENT_ID') }}"
|
|
universal_auth_client_secret: "{{ lookup('env', 'INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET') }}"
|
|
register: infisical_login
|
|
delegate_to: localhost
|
|
check_mode: false
|
|
|
|
- name: Read all secrets as dictionary
|
|
infisical.vault.read_secrets:
|
|
login_data: "{{ infisical_login.login_data }}"
|
|
project_id: "{{ lookup('env', 'TF_VAR_infisical_workspace_id') }}"
|
|
env_slug: "prod"
|
|
path: "/ansible"
|
|
as_dict: false
|
|
register: secrets
|
|
delegate_to: localhost
|
|
check_mode: false
|
|
|
|
- name: Export secrets as vars
|
|
ansible.builtin.set_fact:
|
|
"{{ item.key }}": "{{ item.value }}"
|
|
loop: "{{ secrets.secrets }}"
|
|
loop_control:
|
|
label: "{{ item.key }}"
|
|
no_log: true
|
|
|
|
- name: Load the opentofu output
|
|
ansible.builtin.set_fact:
|
|
opentofu: "{{ opentofu | default({}) | combine({item.key: item.value.value}) }}"
|
|
loop: "{{ lookup('cloud.terraform.tf_output', binary_path='bin/tofu') | dict2items }}"
|
|
loop_control:
|
|
label: "{{ item.key }}"
|
|
no_log: true
|
|
|
|
- name: Set variables from opentofu output
|
|
ansible.builtin.set_fact:
|
|
all_services: "{{ opentofu.services }}"
|