From bb08a954b1122df0df67bd2142d69b1b5eff532f Mon Sep 17 00:00:00 2001 From: Emmanouil Kampitakis Date: Fri, 24 May 2019 16:42:48 +0200 Subject: [PATCH 1/2] Circumvent the fact that register is not templatable --- tasks/generate_secret.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tasks/generate_secret.yml b/tasks/generate_secret.yml index c7fb3cb..7ec1331 100644 --- a/tasks/generate_secret.yml +++ b/tasks/generate_secret.yml @@ -17,8 +17,14 @@ mode: "0600" when: - not secret_file_stat.stat.exists - +# TODO: This below is a dirty hack and should be properly revisited - name: Retrieve secret slurp: src: "{{ secret_file_path }}" - register: "{{ secret.var }}" + register: secret_var + +- name: Set secret.var fact + set_fact: > + { + "{{ secret.var }}": "{{ secret_var }}" + } From 1e5fe9e3974e12dec6df61572be9fb74186b2368 Mon Sep 17 00:00:00 2001 From: Emmanouil Kampitakis Date: Fri, 24 May 2019 18:57:15 +0200 Subject: [PATCH 2/2] Dynamic fact setting works now Still hacky as hell --- tasks/generate_secret.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tasks/generate_secret.yml b/tasks/generate_secret.yml index 7ec1331..8818a28 100644 --- a/tasks/generate_secret.yml +++ b/tasks/generate_secret.yml @@ -24,7 +24,4 @@ register: secret_var - name: Set secret.var fact - set_fact: > - { - "{{ secret.var }}": "{{ secret_var }}" - } + set_fact: { "{{ secret.var }}": "{{ secret_var }}" }