63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
---
|
|
# Copyright 2022 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
- name: Ensure iscsi-initiator-utils
|
|
ansible.builtin.package:
|
|
name: iscsi-initiator-utils
|
|
state: present
|
|
|
|
- name: Check if initiator_reset present
|
|
ansible.builtin.stat:
|
|
path: /tmp/iscsi.host/.initiator_reset
|
|
register: initiator_reset_state
|
|
|
|
- name: Reset iscsi initiator name
|
|
block:
|
|
- name: Sync IQN from Host
|
|
ansible.builtin.copy:
|
|
src: /tmp/iscsi.host/.initiator_reset
|
|
dest: /tmp/iscsi.host/initiator
|
|
remote_src: True
|
|
|
|
- name: Get ISCSI Initiator Name
|
|
ansible.builtin.command: /usr/sbin/iscsi-name
|
|
register: iscsi_name
|
|
|
|
- name: Reset iscsi initiator name
|
|
ansible.builtin.copy:
|
|
dest: /etc/iscsi/initiatorname.iscsi
|
|
content: "{{ iscsi_name }}"
|
|
|
|
- name: Sync IQN to host
|
|
ansible.builtin.copy:
|
|
src: /etc/iscsi/initiatorname.iscsi
|
|
dest: /etc/iscsi/.initiator_reset
|
|
remote_src: True
|
|
|
|
- name: Sync IQN to host /tmp/iscsi.host/
|
|
ansible.builtin.copy:
|
|
src: /etc/iscsi/initiatorname.iscsi
|
|
dest: /tmp/iscsi.host/
|
|
remote_src: True
|
|
when: initiator_reset_state.stat.exists
|
|
|
|
- name: Write CHAP algorithms
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/iscsi/iscsid.conf
|
|
line: "node.session.auth.chap_algs = {{ tripleo_iscsid_chap_algs }}"
|
|
regexp: "^node.session.auth.chap_algs"
|
|
insertafter: "^#node.session.auth.chap.algs"
|