From d4d176f85f6aa253d48207bb527583bfcb3a34a7 Mon Sep 17 00:00:00 2001 From: N Date: Fri, 20 Sep 2019 23:30:01 +0100 Subject: [PATCH] fix(freebsd): loader.conf is existing file --- iscsi/defaults.yaml | 2 +- iscsi/initiator/kernel/install.sls | 11 +++++++++-- iscsi/target/kernel/install.sls | 9 ++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/iscsi/defaults.yaml b/iscsi/defaults.yaml index 951fcfc7..e848e97f 100644 --- a/iscsi/defaults.yaml +++ b/iscsi/defaults.yaml @@ -59,7 +59,7 @@ iscsi: name: iscsi_initiator text: 'iscsi_initiator_load="YES"' ctld: - name: ctld + name: text: 'cfiscsi_load="YES"' ietd: name: iscsi_trgt diff --git a/iscsi/initiator/kernel/install.sls b/iscsi/initiator/kernel/install.sls index 9026828f..eb84081a 100644 --- a/iscsi/initiator/kernel/install.sls +++ b/iscsi/initiator/kernel/install.sls @@ -14,20 +14,27 @@ include: iscsi-initiator-kernel-install-file-line: file.line: - - onlyif: iscsi.config.name.modprobe and 'text' in iscsi.config.kmodule[provider] }} + - onlyif: {{ iscsi.config.name.modprobe and 'text' in iscsi.config.kmodule[provider] }} - name: {{ iscsi.config.name.modprobe }} - content: {{ iscsi.config.kmodule[provider]['text'] }} - backup: True {%- if not iscsi.initiator.enabled %} - mode: delete cmd.run: + - onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }} - name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }} - onlyif: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }} {%- else %} - - create: True + {%- if grains.os_family in ('FreeBSD',) %} + - mode: ensure + - after: 'autoboot_delay.*' + {%- else %} - mode: ensure + - create: True - match: None + {%- endif %} cmd.run: + - onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }} - name: {{ iscsi.kernel.modload }} {{ iscsi.config.kmodule[provider]['name'] }} - unless: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }} {%- endif %} diff --git a/iscsi/target/kernel/install.sls b/iscsi/target/kernel/install.sls index b085a466..cb7a0622 100644 --- a/iscsi/target/kernel/install.sls +++ b/iscsi/target/kernel/install.sls @@ -21,14 +21,21 @@ iscsi-target-kernel-install-file-line: - cmd: iscsi-target-kernel-install-file-line - backup: True {%- if iscsi.target.enabled %} - - create: True + {%- if grains.os_family in ('FreeBSD',) %} + - mode: replace + - after: 'autoboot_delay.*' + {%- else %} - mode: ensure + - create: True - match: None + {%- endif %} cmd.run: + - onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }} - name: {{ iscsi.kernel.modload }} {{ iscsi.config.kmodule[provider]['name'] }} - unless: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }} {%- else %} cmd.run: + - onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }} - name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }} - onlyif: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }} - mode: delete