Skip to content

Commit aa5a945

Browse files
authored
Merge pull request #21 from noelmcloughlin/archlinux
fix(os): archlinux fixes
2 parents 499e356 + 77d3625 commit aa5a945

File tree

10 files changed

+83
-41
lines changed

10 files changed

+83
-41
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ AUR iscsi packages are supported. Run `users` state (users-formula) to create re
6565

6666
iscsi:
6767
{% if grains.os == 'Arch' %}
68-
user: iscsimake
68+
user: iscsimake #already defined in initiator/defaults.yaml
6969

7070
users:
7171
iscsimake:

iscsi/initiator/defaults.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# vim: sts=2 ts=2 sw= et ai
22
#
33
iscsi:
4-
user: iscsiuser #not used unless archlinux
4+
user: iscsimake #archlinux only
55
initiator:
66
iscsid: #FreeBSD Foundation
77
man5:
88
manpage: iscsi.conf(5)
99
vendor: FreeBSD Foundation
1010
svcname: iscsid
1111
kmodule: iscsi_initiator
12-
modloadtext: iscsi_initiator_load="YES"
12+
kmoduletext: iscsi_initiator_load="YES"
1313
svcloadfile: /etc/rc.conf
1414
svcloadtext: iscsictl_enable="YES"
1515
config: /etc/iscsi.conf
@@ -28,7 +28,7 @@ iscsi:
2828
vendor: Open-iSCSI
2929
svcname: open-iscsi
3030
kmodule: None
31-
modloadtext: xxxxxxxxx="YES"
31+
kmoduletext: xxxxxxxxx="YES"
3232
svcloadfile:
3333
svcloadtext:
3434
config: /etc/iscsi/iscsid.conf
@@ -72,7 +72,7 @@ iscsi:
7272
vendor:
7373
svcname: ['fcoe', 'lldpad',]
7474
kmodule: None
75-
modloadtext: xxxxxxxxx="YES"
75+
kmoduletext: xxxxxxxxx="YES"
7676
svcloadfile:
7777
svcloadtext:
7878
targetconf: /etc/fcoe/cfg-ethx

iscsi/initiator/install.sls

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,25 @@ iscsi_initiator_service_config:
7676
data: {{ data|json }}
7777
component: 'initiator'
7878
provider: {{ provider }}
79-
json: {{ data['man5']['format']['json'] }}
79+
json: {{ data.man5.format.json|json }}
8080
81-
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
81+
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
8282
iscsi_initiator_kernel_module:
8383
file.line:
8484
- name: {{ iscsi.kernel.modloadfile }}
85-
- content: {{ data.man5.kloadtext }}
85+
- content: {{ data.man5.kmoduletext }}
8686
- backup: True
8787
{%- if not iscsi.client.enabled %}
8888
- mode: delete
8989
cmd.run:
90-
- name: {{ iscsi.initiator.kernel.modunload }}
91-
- onlyif: {{ iscsi.initiator.kernel.modquery }}
90+
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
91+
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
9292
{%- else %}
9393
- mode: ensure
9494
- after: autoboot_delay.*$
9595
cmd.run:
96-
- name: {{ iscsi.initiator.kernel.modload }}
97-
- unless: {{ iscsi.initiator.kernel.modquery }}
96+
- name: {{ iscsi.kernel.modload }} {{ data.man5.kmodule }}
97+
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
9898
- require:
9999
- file: iscsi_initiator_kernel_module
100100
{%- endif %}
@@ -122,8 +122,22 @@ iscsi_initiator_service:
122122
- watch:
123123
- file: iscsi_initiator_service_config
124124
{%- endif %}
125+
{%- if data.man5.svcname is iterable and data.man5.svcname is not string %}
126+
- names: {{ data.man5.svcname|json }}
127+
{%- else %}
125128
- name: {{ data.man5.svcname }}
129+
{%- endif %}
126130
{%- if data.man5.kmodule %}
127131
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
128132
{%- endif %}
129133
134+
iscsi_initiator_service_running_failure_explanation:
135+
test.show_notification:
136+
- text: |
137+
In certain circumstances the iscsi initiator service will not start.
138+
One reason is your kernel version was upgraded and reboot is needed.
139+
If that's the case then run command:
140+
'systemctl enable {{ data.man5.svcname }}' && reboot
141+
- onfail:
142+
- service: iscsi_initiator_service
143+
- unless: {{ grains.os_family in ('MacOS', 'Windows') }} #maybe not needed but no harm

iscsi/initiator/remove.sls

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@ iscsi_initiator_service_dead:
1717
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
1818
{%- endif %}
1919
20-
{%- set kmodule = iscsi.client['provider']['man5']['kmodule'] %}
21-
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
20+
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
2221
iscsi_initiator_kernel_module_{{ data.man5.kmodule }}_removed:
2322
file.line:
2423
- name: {{ iscsi.kernel.modloadfile }}
25-
- content: {{ data.man5.kloadtext }}
24+
- content: {{ data.man5.kmoduletext }}
2625
- backup: True
2726
- mode: delete
2827
cmd.run:
29-
- name: {{ iscsi.initiator.kernel.modunload }}
30-
- onlyif: {{ iscsi.initiator.kernel.modquery }}
28+
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
29+
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
3130
- require:
3231
- iscsi_initiator_service_dead
3332
- require_in:
@@ -44,5 +43,5 @@ iscsi_initiator_wanted_pkgs_{{ pkg }}_removed:
4443
4544
iscsi_initiator_service_config_removed:
4645
file.absent:
47-
- name: {{ iscsi.initiator.man5.config }}
48-
- onlyif: test -f {{ iscsi.initiator.man5.config }}
46+
- name: {{ data.man5.config }}
47+
- onlyif: test -f {{ data.man5.config }}

iscsi/isns/remove.sls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ iscsi_isns_remove_{{ pkg }}_pkg:
2828
- require:
2929
- service: iscsi_isns_service_config_removed
3030
{% endfor %}
31-

iscsi/osfamilymap.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ Gentoo:
5858
kmodule: iscsi_tcp
5959

6060
Arch:
61+
initiator:
62+
open-iscsi:
63+
man5:
64+
svcname: ##open-iscsi on archlinux uses non-standard service names
65+
- iscsi
66+
- iscsid
6167
user: iscsimake
6268
client:
6369
make:

iscsi/target/defaults.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ iscsi:
99
vendor: tgt project
1010
svcname: tgtd
1111
kmodule: None
12-
modloadtext: xxxxxxxxx="YES"
12+
kmoduletext: xxxxxxxxx="YES"
1313
svcloadfile:
1414
svcloadtext:
1515
config: /etc/tgt/conf.d/targets.conf
@@ -36,7 +36,7 @@ iscsi:
3636
vendor: FreeBSD Foundation
3737
svcname: ctld #CAM Target Layer/iSCSI target daemon
3838
kmodule: cfiscsi
39-
modloadtext: cfiscsi_load="YES"
39+
kmoduletext: cfiscsi_load="YES"
4040
svcloadfile: /etc/rc.conf
4141
svcloadtext: 'iscsid_enable="YES"'
4242
allowconf:
@@ -68,7 +68,7 @@ iscsi:
6868
vendor: IET project
6969
svcname: iscsitarget
7070
kmodule: iscsi_trgt
71-
modloadtext: iscsi_trgt
71+
kmoduletext: iscsi_trgt
7272
svcloadfile:
7373
svcloadtext:
7474
config: /etc/ietd.conf
@@ -108,7 +108,7 @@ iscsi:
108108
vendor: Kernel.org
109109
svcname: target
110110
kmodule: target_core_mod
111-
modloadtext: target_core_mod
111+
kmoduletext: target_core_mod
112112
svcloadfile:
113113
svcloadtext:
114114
config: /etc/target/saveconfig.json
@@ -133,7 +133,7 @@ iscsi:
133133
vendor:
134134
svcname: fcoe-target
135135
kmodule: fcoe_target
136-
modloadtext: fcoe_target
136+
kmoduletext: fcoe_target
137137
svcloadfile:
138138
svcloadtext:
139139
config: ....

iscsi/target/install.sls

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,25 @@ iscsi_target_service_config:
7676
data: {{ data|json }}
7777
component: 'target'
7878
provider: {{ provider }}
79-
json: {{ data['man5']['format']['json'] }}
79+
json: {{ data.man5.format.json|json }}
8080
81-
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
81+
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
8282
iscsi_target_kernel_module:
8383
file.line:
8484
- name: {{ iscsi.kernel.modloadfile }}
85-
- content: {{ data.man5.kloadtext }}
85+
- content: {{ data.man5.kmoduletext }}
8686
- backup: True
8787
{%- if not data.enabled %}
8888
- mode: delete
8989
cmd.run:
90-
- name: {{ data.kernel.modunload }}
91-
- onlyif: {{ data.kernel.modquery }}
90+
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
91+
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
9292
{%- else %}
9393
- mode: ensure
9494
- after: 'autoboot_delay.*'
9595
cmd.run:
96-
- name: {{ data.kernel.modload }}
97-
- unless: {{ data.kernel.modquery }}
96+
- name: {{ iscsi.kernel.modload }} {{ data.man5.kmodule }}
97+
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
9898
- require:
9999
- file: iscsi_target_kernel_module
100100
{%- endif %}
@@ -133,3 +133,13 @@ iscsi_target_service_running:
133133
- unless: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
134134
{%- endif %}
135135
136+
iscsi_target_service_running_failure_explanation:
137+
test.show_notification:
138+
- text: |
139+
In certain circumstances the iscsi target service will not start.
140+
One reason is your kernel version was upgraded but host not rebooted.
141+
If that's the case then run command:
142+
'systemctl enable {{ data.man5.svcname }}' && reboot
143+
- onfail:
144+
- service: iscsi_target_service_running
145+
- unless: {{ grains.os_family in ('MacOS', 'Windows') }} #maybe not needed but no harm

iscsi/target/remove.sls

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@ iscsi_target_service_dead:
1717
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
1818
{%- endif %}
1919
20-
21-
{%- set kmodule = iscsi.server['provider']['man5']['kmodule'] %}
22-
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kloadtext %}
20+
{%- if iscsi.kernel.mess_with_kernel and data.man5.kmodule and data.man5.kmoduletext %}
2321
iscsi_target_kernel_module_{{ data.man5.kmodule }}_removed:
2422
file.line:
2523
- name: {{ iscsi.kernel.modloadfile }}
26-
- content: {{ data.man5.kloadtext }}
24+
- content: {{ data.man5.kmoduletext }}
2725
- backup: True
2826
- mode: delete
2927
cmd.run:
30-
- name: {{ iscsi.target.kernel.modunload }}
31-
- onlyif: {{ iscsi.target.kernel.modquery }}
28+
- name: {{ iscsi.kernel.modunload }} {{ data.man5.kmodule }}
29+
- onlyif: {{ iscsi.kernel.modquery }} {{ data.man5.kmodule }}
3230
- require:
3331
- iscsi_target_service_dead
3432
- require_in:
@@ -45,6 +43,5 @@ iscsi_target_wanted_pkgs_{{ pkg }}_removed:
4543
4644
iscsi_target_service_config_removed:
4745
file.absent:
48-
- name: {{ iscsi.target.man5.config }}
49-
- onlyif: test -f {{ iscsi.target.man5.config }}
50-
46+
- name: {{ data.man5.config }}
47+
- onlyif: test -f {{ data.man5.config }}

pillar.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
#Sample pillars for iSNS/iSCSI on FreeBSD and GNU/Linux
22

3+
{% if grains.os == 'Arch' %}
4+
### this user is needed for archlinux
5+
users:
6+
iscsimake:
7+
sudouser: True
8+
shell: /bin/bash
9+
empty_password: True
10+
home: /home/iscsimake
11+
createhome: True
12+
optional_groups:
13+
- wheel
14+
- root
15+
sudo_rules:
16+
- 'ALL=(ALL) ALL'
17+
{% endif %}
18+
19+
320
iscsi:
421
isns:
522
enabled: True

0 commit comments

Comments
 (0)