feat: add option to prepare iscsid to support storage providers
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Robert Kaussow 2023-01-09 21:44:13 +01:00
parent c2ddaeafe5
commit 18bd2e60bc
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
6 changed files with 47 additions and 0 deletions

View File

@ -53,3 +53,5 @@ k3s_server_resource_creations: []
k3s_server_resource_patches: []
k3s_node_labels: {}
k3s_iscsi_enabled: False

View File

@ -8,3 +8,13 @@
listen: __k3s_restart
become: True
become_user: root
- name: Restart iscsid service
service:
name: iscsid
state: restarted
daemon_reload: yes
enabled: yes
listen: __iscsid_restart
become: True
become_user: root

View File

@ -30,6 +30,7 @@
# token: "{{ hcloud_token | b64encode }}"
k3s_node_labels:
node.kubernetes.io/exclude-from-external-load-balancers: "true"
k3s_iscsi_enabled: True
pre_tasks:
- name: Override host variables
set_fact:

View File

@ -14,6 +14,12 @@ def test_k3s_running_and_enabled(host):
assert k3s.is_enabled
def test_iscsid_running_and_enabled(host):
k3s = host.service("iscsid")
assert k3s.is_running
assert k3s.is_enabled
def test_k3s_node_ready(host):
jsonpth = '{range .items[*]}{@.metadata.name}:{range @.status.conditions[?(@.type=="Ready")]}{@.type}={@.status};{end}{end}' # noqa
nodes = host.run(f"k3s kubectl get nodes -o jsonpath='{jsonpth}'").stdout

26
tasks/iscsi.yml Normal file
View File

@ -0,0 +1,26 @@
---
- block:
- name: Ensure iscsi is installed
package:
name: "{{ item }}"
state: present
loop:
- iscsi-initiator-utils
- name: Configure iscsi-initiator
copy:
content: "InitiatorName=$(/sbin/iscsi-iname)"
dest: /etc/iscsi/initiatorname.iscsi
owner: root
group: root
mode: 0644
notify: __iscsid_restart
- name: Ensure iscsid service is up and running
service:
name: iscsid
daemon_reload: True
enabled: True
state: started
become: True
become_user: root

View File

@ -5,3 +5,5 @@
- include_tasks: init.yml
when: k3s_server | bool
- include_tasks: setup.yml
- incluse_tasks: iscsi.yml
when: k3s_iscsi_enabled | bool