From 5e4158e25b29f758efa90b3acedd6d8e3ada9fd5 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 22 Dec 2018 01:02:43 +0100 Subject: [PATCH] replace command module running mktemp with tempfile module --- ansible/roles/openwrt/image/tasks/prepare.yml | 7 ++++--- ansible/roles/usb-install/tasks/main.yml | 9 +++++---- ansible/roles/vm/install/tasks/main.yml | 11 ++++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ansible/roles/openwrt/image/tasks/prepare.yml b/ansible/roles/openwrt/image/tasks/prepare.yml index b6b67c5..3414371 100644 --- a/ansible/roles/openwrt/image/tasks/prepare.yml +++ b/ansible/roles/openwrt/image/tasks/prepare.yml @@ -1,11 +1,12 @@ --- - name: Create temporary build directory - command: mktemp --tmpdir -d openwrt-{{ inventory_hostname }}.XXXXXX + tempfile: + state: directory register: tmpdir - set_fact: - openwrt_imgbuilder_dir: "{{ tmpdir.stdout }}" - openwrt_imgbuilder_files: "{{ tmpdir.stdout }}/files" + openwrt_imgbuilder_dir: "{{ tmpdir.path }}" + openwrt_imgbuilder_files: "{{ tmpdir.path }}/files" - name: Create the directories for mixins file: diff --git a/ansible/roles/usb-install/tasks/main.yml b/ansible/roles/usb-install/tasks/main.yml index 1523aed..fab32b0 100644 --- a/ansible/roles/usb-install/tasks/main.yml +++ b/ansible/roles/usb-install/tasks/main.yml @@ -1,22 +1,23 @@ --- - block: - name: Create temporary workdir - command: mktemp -d + tempfile: + state: directory register: tmpdir - import_role: name: preseed vars: - preseed_tmpdir: "{{ tmpdir.stdout }}" + preseed_tmpdir: "{{ tmpdir.path }}" - name: Copy the preseed initramfs to the artifacts directory copy: - src: "{{ tmpdir.stdout }}/initrd.preseed.gz" + src: "{{ tmpdir.path }}/initrd.preseed.gz" dest: "{{ artifacts_dir }}/" always: - name: Cleanup temporary workdir file: - path: "{{ tmpdir.stdout }}" + path: "{{ tmpdir.path }}" state: absent diff --git a/ansible/roles/vm/install/tasks/main.yml b/ansible/roles/vm/install/tasks/main.yml index b9201c0..5043fcc 100644 --- a/ansible/roles/vm/install/tasks/main.yml +++ b/ansible/roles/vm/install/tasks/main.yml @@ -33,7 +33,8 @@ - block: - name: create a temporary workdir - command: mktemp -d + tempfile: + state: directory register: tmpdir - import_role: @@ -41,11 +42,11 @@ vars: ssh_users_root: "{{ hostvars[hostname].ssh_users_root }}" install_interface: enp1s1 - preseed_tmpdir: "{{ tmpdir.stdout }}" + preseed_tmpdir: "{{ tmpdir.path }}" - name: Make preseed workdir readable by qemu acl: - path: "{{ tmpdir.stdout }}" + path: "{{ tmpdir.path }}" state: present entity: libvirt-qemu etype: user @@ -58,7 +59,7 @@ xml: "{{ lookup('template', 'libvirt-domain.xml.j2') }}" vars: run_installer: yes - preseed_tmpdir: "{{ tmpdir.stdout }}" + preseed_tmpdir: "{{ tmpdir.path }}" - name: start vm virt: @@ -90,7 +91,7 @@ always: - name: cleanup temporary workdir file: - path: "{{ tmpdir.stdout }}" + path: "{{ tmpdir.path }}" state: absent - name: define new production vm -- 1.7.10.4