feat: add option to prepare iscsid to support storage providers (#2)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c2ddaeafe5
commit
b8f4148994
@ -71,7 +71,7 @@ local PipelineDeployment(scenario='rocky9') = {
|
|||||||
'linting',
|
'linting',
|
||||||
],
|
],
|
||||||
trigger: {
|
trigger: {
|
||||||
ref: ['refs/heads/main', 'refs/tags/**'],
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ trigger:
|
|||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
- refs/tags/**
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- linting
|
- linting
|
||||||
@ -147,6 +148,6 @@ depends_on:
|
|||||||
|
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: f96521e29a09a85e7e86b421ac16ceeaffcdc3645d76dfdeda7e4adf46bb42d0
|
hmac: 051c4db5d5ce34efd5e5e54a2c57fbfb7f8ee2f491013a788f7e9d58eba160fb
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -53,3 +53,5 @@ k3s_server_resource_creations: []
|
|||||||
k3s_server_resource_patches: []
|
k3s_server_resource_patches: []
|
||||||
|
|
||||||
k3s_node_labels: {}
|
k3s_node_labels: {}
|
||||||
|
|
||||||
|
k3s_iscsi_enabled: False
|
||||||
|
@ -8,3 +8,13 @@
|
|||||||
listen: __k3s_restart
|
listen: __k3s_restart
|
||||||
become: True
|
become: True
|
||||||
become_user: root
|
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
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
# token: "{{ hcloud_token | b64encode }}"
|
# token: "{{ hcloud_token | b64encode }}"
|
||||||
k3s_node_labels:
|
k3s_node_labels:
|
||||||
node.kubernetes.io/exclude-from-external-load-balancers: "true"
|
node.kubernetes.io/exclude-from-external-load-balancers: "true"
|
||||||
|
k3s_iscsi_enabled: True
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Override host variables
|
- name: Override host variables
|
||||||
set_fact:
|
set_fact:
|
||||||
|
@ -14,6 +14,12 @@ def test_k3s_running_and_enabled(host):
|
|||||||
assert k3s.is_enabled
|
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):
|
def test_k3s_node_ready(host):
|
||||||
jsonpth = '{range .items[*]}{@.metadata.name}:{range @.status.conditions[?(@.type=="Ready")]}{@.type}={@.status};{end}{end}' # noqa
|
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
|
nodes = host.run(f"k3s kubectl get nodes -o jsonpath='{jsonpth}'").stdout
|
||||||
|
26
tasks/iscsi.yml
Normal file
26
tasks/iscsi.yml
Normal 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
|
@ -5,3 +5,5 @@
|
|||||||
- include_tasks: init.yml
|
- include_tasks: init.yml
|
||||||
when: k3s_server | bool
|
when: k3s_server | bool
|
||||||
- include_tasks: setup.yml
|
- include_tasks: setup.yml
|
||||||
|
- include_tasks: iscsi.yml
|
||||||
|
when: k3s_iscsi_enabled | bool
|
||||||
|
Loading…
Reference in New Issue
Block a user