Skip to content

Commit

Permalink
Merge pull request #21 from noelmcloughlin/archlinux
Browse files Browse the repository at this point in the history
fix(os): archlinux fixes
  • Loading branch information
aboe76 authored Sep 12, 2019
2 parents 499e356 + 77d3625 commit aa5a945
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ AUR iscsi packages are supported. Run `users` state (users-formula) to create re

iscsi:
{% if grains.os == 'Arch' %}
user: iscsimake
user: iscsimake #already defined in initiator/defaults.yaml

users:
iscsimake:
Expand Down
8 changes: 4 additions & 4 deletions iscsi/initiator/defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# vim: sts=2 ts=2 sw= et ai
#
iscsi:
user: iscsiuser #not used unless archlinux
user: iscsimake #archlinux only
initiator:
iscsid: #FreeBSD Foundation
man5:
manpage: iscsi.conf(5)
vendor: FreeBSD Foundation
svcname: iscsid
kmodule: iscsi_initiator
modloadtext: iscsi_initiator_load="YES"
kmoduletext: iscsi_initiator_load="YES"
svcloadfile: /etc/rc.conf
svcloadtext: iscsictl_enable="YES"
config: /etc/iscsi.conf
Expand All @@ -28,7 +28,7 @@ iscsi:
vendor: Open-iSCSI
svcname: open-iscsi
kmodule: None
modloadtext: xxxxxxxxx="YES"
kmoduletext: xxxxxxxxx="YES"
svcloadfile:
svcloadtext:
config: /etc/iscsi/iscsid.conf
Expand Down Expand Up @@ -72,7 +72,7 @@ iscsi:
vendor:
svcname: ['fcoe', 'lldpad',]
kmodule: None
modloadtext: xxxxxxxxx="YES"
kmoduletext: xxxxxxxxx="YES"
svcloadfile:
svcloadtext:
targetconf: /etc/fcoe/cfg-ethx
Expand Down
28 changes: 21 additions & 7 deletions iscsi/initiator/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ iscsi_initiator_service_config:
data: {{ data|json }}
component: 'initiator'
provider: {{ provider }}
json: {{ data['man5']['format']['json'] }}
json: {{ data.man5.format.json|json }}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_initiator_kernel_module:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
{%- if not iscsi.client.enabled %}
- mode: delete
cmd.run:
- name: {{ iscsi.initiator.kernel.modunload }}
- onlyif: {{ iscsi.initiator.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- else %}
- mode: ensure
- after: autoboot_delay.*$
cmd.run:
- name: {{ iscsi.initiator.kernel.modload }}
- unless: {{ iscsi.initiator.kernel.modquery }}
- name: {{ iscsi.kernel.modload }} {{ data.man5.kmodule }}
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- file: iscsi_initiator_kernel_module
{%- endif %}
Expand Down Expand Up @@ -122,8 +122,22 @@ iscsi_initiator_service:
- watch:
- file: iscsi_initiator_service_config
{%- endif %}
{%- if data.man5.svcname is iterable and data.man5.svcname is not string %}
- names: {{ data.man5.svcname|json }}
{%- else %}
- name: {{ data.man5.svcname }}
{%- endif %}
{%- if data.man5.kmodule %}
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
iscsi_initiator_service_running_failure_explanation:
test.show_notification:
- text: |
In certain circumstances the iscsi initiator service will not start.
One reason is your kernel version was upgraded and reboot is needed.
If that's the case then run command:
'systemctl enable {{ data.man5.svcname }}' && reboot
- onfail:
- service: iscsi_initiator_service
- unless: {{ grains.os_family in ('MacOS', 'Windows') }} #maybe not needed but no harm
13 changes: 6 additions & 7 deletions iscsi/initiator/remove.sls
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ iscsi_initiator_service_dead:
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
{%- set kmodule = iscsi.client['provider']['man5']['kmodule'] %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_initiator_kernel_module_{{ data.man5.kmodule }}_removed:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
- mode: delete
cmd.run:
- name: {{ iscsi.initiator.kernel.modunload }}
- onlyif: {{ iscsi.initiator.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- iscsi_initiator_service_dead
- require_in:
Expand All @@ -44,5 +43,5 @@ iscsi_initiator_wanted_pkgs_{{ pkg }}_removed:
iscsi_initiator_service_config_removed:
file.absent:
- name: {{ iscsi.initiator.man5.config }}
- onlyif: test -f {{ iscsi.initiator.man5.config }}
- name: {{ data.man5.config }}
- onlyif: test -f {{ data.man5.config }}
1 change: 0 additions & 1 deletion iscsi/isns/remove.sls
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ iscsi_isns_remove_{{ pkg }}_pkg:
- require:
- service: iscsi_isns_service_config_removed
{% endfor %}
6 changes: 6 additions & 0 deletions iscsi/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ Gentoo:
kmodule: iscsi_tcp

Arch:
initiator:
open-iscsi:
man5:
svcname: ##open-iscsi on archlinux uses non-standard service names
- iscsi
- iscsid
user: iscsimake
client:
make:
Expand Down
10 changes: 5 additions & 5 deletions iscsi/target/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ iscsi:
vendor: tgt project
svcname: tgtd
kmodule: None
modloadtext: xxxxxxxxx="YES"
kmoduletext: xxxxxxxxx="YES"
svcloadfile:
svcloadtext:
config: /etc/tgt/conf.d/targets.conf
Expand All @@ -36,7 +36,7 @@ iscsi:
vendor: FreeBSD Foundation
svcname: ctld #CAM Target Layer/iSCSI target daemon
kmodule: cfiscsi
modloadtext: cfiscsi_load="YES"
kmoduletext: cfiscsi_load="YES"
svcloadfile: /etc/rc.conf
svcloadtext: 'iscsid_enable="YES"'
allowconf:
Expand Down Expand Up @@ -68,7 +68,7 @@ iscsi:
vendor: IET project
svcname: iscsitarget
kmodule: iscsi_trgt
modloadtext: iscsi_trgt
kmoduletext: iscsi_trgt
svcloadfile:
svcloadtext:
config: /etc/ietd.conf
Expand Down Expand Up @@ -108,7 +108,7 @@ iscsi:
vendor: Kernel.org
svcname: target
kmodule: target_core_mod
modloadtext: target_core_mod
kmoduletext: target_core_mod
svcloadfile:
svcloadtext:
config: /etc/target/saveconfig.json
Expand All @@ -133,7 +133,7 @@ iscsi:
vendor:
svcname: fcoe-target
kmodule: fcoe_target
modloadtext: fcoe_target
kmoduletext: fcoe_target
svcloadfile:
svcloadtext:
config: ....
Expand Down
24 changes: 17 additions & 7 deletions iscsi/target/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ iscsi_target_service_config:
data: {{ data|json }}
component: 'target'
provider: {{ provider }}
json: {{ data['man5']['format']['json'] }}
json: {{ data.man5.format.json|json }}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_target_kernel_module:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
{%- if not data.enabled %}
- mode: delete
cmd.run:
- name: {{ data.kernel.modunload }}
- onlyif: {{ data.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- else %}
- mode: ensure
- after: 'autoboot_delay.*'
cmd.run:
- name: {{ data.kernel.modload }}
- unless: {{ data.kernel.modquery }}
- name: {{ iscsi.kernel.modload }} {{ data.man5.kmodule }}
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- file: iscsi_target_kernel_module
{%- endif %}
Expand Down Expand Up @@ -133,3 +133,13 @@ iscsi_target_service_running:
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
iscsi_target_service_running_failure_explanation:
test.show_notification:
- text: |
In certain circumstances the iscsi target service will not start.
One reason is your kernel version was upgraded but host not rebooted.
If that's the case then run command:
'systemctl enable {{ data.man5.svcname }}' && reboot
- onfail:
- service: iscsi_target_service_running
- unless: {{ grains.os_family in ('MacOS', 'Windows') }} #maybe not needed but no harm
15 changes: 6 additions & 9 deletions iscsi/target/remove.sls
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ iscsi_target_service_dead:
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
{%- endif %}
{%- set kmodule = iscsi.server['provider']['man5']['kmodule'] %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
iscsi_target_kernel_module_{{ data.man5.kmodule }}_removed:
file.line:
- name: {{ iscsi.kernel.modloadfile }}
- content: {{ data.man5.kloadtext }}
- content: {{ data.man5.kmoduletext }}
- backup: True
- mode: delete
cmd.run:
- name: {{ iscsi.target.kernel.modunload }}
- onlyif: {{ iscsi.target.kernel.modquery }}
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
- require:
- iscsi_target_service_dead
- require_in:
Expand All @@ -45,6 +43,5 @@ iscsi_target_wanted_pkgs_{{ pkg }}_removed:
iscsi_target_service_config_removed:
file.absent:
- name: {{ iscsi.target.man5.config }}
- onlyif: test -f {{ iscsi.target.man5.config }}
- name: {{ data.man5.config }}
- onlyif: test -f {{ data.man5.config }}
17 changes: 17 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#Sample pillars for iSNS/iSCSI on FreeBSD and GNU/Linux

{% if grains.os == 'Arch' %}
### this user is needed for archlinux
users:
iscsimake:
sudouser: True
shell: /bin/bash
empty_password: True
home: /home/iscsimake
createhome: True
optional_groups:
- wheel
- root
sudo_rules:
- 'ALL=(ALL) ALL'
{% endif %}


iscsi:
isns:
enabled: True
Expand Down

0 comments on commit aa5a945

Please sign in to comment.