From 217d6e6e0d37ec48a874e44f2d9d4cfdaf006648 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20K=C3=A4b?= <alexander.kaeb@h-da.de>
Date: Mon, 3 Apr 2023 17:16:26 +0200
Subject: [PATCH] fix: Use correct tmp dir path

---
 tasks/node-certs.yml | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tasks/node-certs.yml b/tasks/node-certs.yml
index 5528cc6..8240afb 100644
--- a/tasks/node-certs.yml
+++ b/tasks/node-certs.yml
@@ -10,7 +10,7 @@
 - name: Node Certificates | Fetch Sidecar CA Cert
   ansible.builtin.fetch:
     src: "{{ item }}"
-    dest: "{{ tmp_cert_dir }}/"
+    dest: "{{ tmp_cert_dir.path }}/"
     flat: true
   with_items:
     - "{{ gl_sidecar_ca_path }}/sidecar-ca.pem"
@@ -22,7 +22,7 @@
 - name: Node Certificates | Fetch Graylog Node CA Cert
   ansible.builtin.fetch:
     src: "{{ gl_node_ca_path }}/graylog-ca.pem"
-    dest: "{{ tmp_cert_dir }}/"
+    dest: "{{ tmp_cert_dir.path }}/"
     flat: true
   delegate_to: "{{ groups[use_central_ca_host | bool | ternary('ca-store', 'graylog-nodes')] | first }}"
   become: true
@@ -33,31 +33,31 @@
   block:
     - name: Node Certificates | Generate private keys
       community.crypto.openssl_privatekey:
-        path: "{{ tmp_cert_dir }}/sidecar-{{ inventory_hostname }}.key"
+        path: "{{ tmp_cert_dir.path }}/sidecar-{{ inventory_hostname }}.key"
         return_content: true
         state: present
 
     - name: Node Certificates | Create CSRs
       community.crypto.openssl_csr_pipe:
-        privatekey_path: "{{ tmp_cert_dir }}/sidecar-{{ inventory_hostname }}.key"
+        privatekey_path: "{{ tmp_cert_dir.path }}/sidecar-{{ inventory_hostname }}.key"
         common_name: "{{ ansible_fqdn }}"  # CN
         subject_alt_name: "{{ node_cert_sans }}"
       register: "node_csr"
 
     - name: Node Certificates | Generate Certificates
       community.crypto.x509_certificate:
-        path: "{{ tmp_cert_dir }}/sidecar-{{ inventory_hostname }}.pem"
+        path: "{{ tmp_cert_dir.path }}/sidecar-{{ inventory_hostname }}.pem"
         csr_content: "{{ node_csr.csr }}"
         provider: ownca
-        ownca_path: "{{ tmp_cert_dir }}/sidecar-ca.pem"
-        ownca_privatekey_path: "{{ tmp_cert_dir }}/sidecar-ca.key"
+        ownca_path: "{{ tmp_cert_dir.path }}/sidecar-ca.pem"
+        ownca_privatekey_path: "{{ tmp_cert_dir.path }}/sidecar-ca.key"
         ownca_privatekey_passphrase: "{{ sidecar_ca_passphrase }}"
         ownca_not_after: "+{{ cert_valid_days }}d"
         ownca_not_before: "-1d"  # valid since yesterday
 
 - name: Node Certificates | Copy Node certificates
   ansible.builtin.copy:
-    src: "{{ tmp_cert_dir }}/{{ item.file }}"
+    src: "{{ tmp_cert_dir.path }}/{{ item.file }}"
     dest: "{{ sidecar_cert_dir }}"
     mode: "{{ item.mode }}"
   with_items:
-- 
GitLab