updated to create api key and add to infisical
This commit is contained in:
1 parent
5e3377ba46
commit
3ca2a472b7
1 file changed
+39
-4
@@ -136,7 +136,7 @@
|
||||
when: dns_service_file.stat.exists
|
||||
|
||||
- name: First-time service setup
|
||||
when: not dns_service_file.stat.exists
|
||||
#when: not dns_service_file.stat.exists #temp change
|
||||
block:
|
||||
- name: Create DNS log directory
|
||||
ansible.builtin.file:
|
||||
@@ -258,8 +258,43 @@
|
||||
method: GET
|
||||
body_format: form-urlencoded
|
||||
body:
|
||||
token: "{{ technitium_login.json.response.token }}"
|
||||
pass: "{{ technitium_pass_raw.user_input }}"
|
||||
no_log: true
|
||||
token: "{{ technitium_login.json.token }}"
|
||||
pass: admin
|
||||
newPass: "{{ technitium_pass_raw.user_input }}"
|
||||
no_log: false # temp change
|
||||
failed_when: technitium_change_pass.json.status != 'ok'
|
||||
register: technitium_change_pass
|
||||
|
||||
- name: Create Terraform API token
|
||||
ansible.builtin.uri:
|
||||
url: "http://localhost:5380/api/user/createToken"
|
||||
method: GET
|
||||
body_format: form-urlencoded
|
||||
body:
|
||||
token: "{{ technitium_login.json.token }}"
|
||||
tokenName: terraform
|
||||
register: technitium_terraform_token
|
||||
no_log: true
|
||||
failed_when: technitium_terraform_token.json.status != 'ok'
|
||||
|
||||
- name: Read secrets.tmpl to get Infisical connection details
|
||||
ansible.builtin.slurp:
|
||||
src: "{{ playbook_dir }}/../../../secrets.tmpl"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
register: secrets_tmpl_raw
|
||||
|
||||
- name: Parse Infisical project ID, env, and path from secrets.tmpl
|
||||
ansible.builtin.set_fact:
|
||||
infisical_params: >-
|
||||
{{ (secrets_tmpl_raw.content | b64decode).split('\n')[0] | regex_findall('"([^"]+)"') }}
|
||||
|
||||
- name: Store Terraform API token in Infisical
|
||||
ansible.builtin.command: >
|
||||
infisical secrets set TECHNITIUM_API_TOKEN="{{ technitium_terraform_token.json.token }}"
|
||||
--projectId="{{ infisical_params[0] }}"
|
||||
--env="{{ infisical_params[1] }}"
|
||||
--path="{{ infisical_params[2] }}"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
no_log: false # temp change
|
||||
Reference in new issue
Block a user