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
This commit is contained in:
Alan Bishop 2023-02-27 12:57:50 -08:00
parent 41b7571c61
commit 84c9d7f7bb
1 changed files with 20 additions and 0 deletions

View File

@ -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"