From 84c9d7f7bbc7d705c5b417503669ac2436818262 Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Mon, 27 Feb 2023 12:57:50 -0800 Subject: [PATCH] tripleo_iscsid: ensure /etc/iscsi/iscsid.conf exists Ensure iscsid.conf exists, specifically to cover the case where the iscsi-initiator-utils package isn't installed on the host. Closes-Bug: #2007839 Change-Id: Ic057183fcdd208295777492e1836f0757cc9d579 --- .../roles/tripleo_iscsid/tasks/configure.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tripleo_ansible/roles/tripleo_iscsid/tasks/configure.yml b/tripleo_ansible/roles/tripleo_iscsid/tasks/configure.yml index 1e1e71961..f94e17991 100644 --- a/tripleo_ansible/roles/tripleo_iscsid/tasks/configure.yml +++ b/tripleo_ansible/roles/tripleo_iscsid/tasks/configure.yml @@ -43,6 +43,26 @@ path: /etc/iscsi/.initiator_reset state: touch +- name: Check if /etc/iscsi/iscsid.conf exists + ansible.builtin.stat: + path: /etc/iscsi/iscsid.conf + register: result + +- name: Create /etc/iscsi/iscsid.conf if necessary + when: result.stat.exists == False + block: + + - name: Fetch iscsid.conf from the iscsid container + ansible.builtin.command: podman run -ti --rm --name iscsid_config {{ tripleo_iscsid_config_image }} cat /etc/iscsi/iscsid.conf + register: iscsid_conf + + - name: Create a local copy of iscsid.conf + copy: + dest: /etc/iscsi/iscsid.conf + content: "{{ iscsid_conf.stdout }}" + mode: 0600 + check_mode: false + - name: Write CHAP algorithms ansible.builtin.lineinfile: path: "/etc/iscsi/iscsid.conf"