File tree Expand file tree Collapse file tree 3 files changed +92
-0
lines changed Expand file tree Collapse file tree 3 files changed +92
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - hosts : compute
4
+ become : yes
5
+ gather_facts : yes
6
+ tasks :
7
+ # ###### to be part of k3s role run at build time
8
+ - name : Install pip
9
+ dnf :
10
+ name : python3-pip
11
+ delegate_to : " {{ groups['control'] | first }}"
12
+ run_once : true
13
+
14
+ - name : Install pip dependencies for k8s ansible module
15
+ ansible.builtin.pip :
16
+ name :
17
+ - kubernetes==30.1.0
18
+ delegate_to : " {{ groups['control'] | first }}"
19
+ run_once : true
20
+ # ######
21
+ - name : Create Slurm Namespace
22
+ kubernetes.core.k8s :
23
+ name : slurm
24
+ api_version : v1
25
+ kind : Namespace
26
+ state : present
27
+ delegate_to : " {{ groups['control'] | first }}"
28
+ run_once : true
29
+
30
+ - name : Create Kubernetes Secret for each compute node hostvars
31
+ kubernetes.core.k8s :
32
+ state : present
33
+ definition :
34
+ apiVersion : v1
35
+ kind : Secret
36
+ metadata :
37
+ name : " {{ inventory_hostname }}-hostvars"
38
+ namespace : slurm
39
+ type : Opaque
40
+ data :
41
+ hostvars.yml : " {{ lookup('ansible.builtin.template', 'roles/compute_init/templates/hostvars.yml.j2') | b64encode }}"
42
+ delegate_to : " {{ groups['control'] | first }}"
43
+
44
+ - name : Deploy Slurm Config Push DaemonSet
45
+ kubernetes.core.k8s :
46
+ state : present
47
+ definition :
48
+ apiVersion : apps/v1
49
+ kind : DaemonSet
50
+ metadata :
51
+ name : " slurm-hostvars-writer-{{ inventory_hostname }}"
52
+ namespace : slurm
53
+ spec :
54
+ selector :
55
+ matchLabels :
56
+ name : slurm-hostvars-writer
57
+ template :
58
+ metadata :
59
+ labels :
60
+ name : slurm-hostvars-writer
61
+ spec :
62
+ securityContext :
63
+ runAsUser : 1000
64
+ runAsGroup : 1000
65
+ fsGroup : 1000
66
+ containers :
67
+ - name : pause
68
+ image : registry.k8s.io/pause
69
+ initContainers :
70
+ - name : copy-hostvars
71
+ image : busybox:1.37
72
+ command : ['sh', '-c', 'mkdir -p /etc/compute-init/hostvars && cat /mnt/hostvars/hostvars.yml > /etc/compute-init/hostvars/{{ inventory_hostname }}.yml']
73
+ volumeMounts :
74
+ - name : hostvars-dir
75
+ mountPath : /etc/
76
+ - name : hostvars-secret
77
+ mountPath : /mnt/hostvars
78
+ readOnly : true
79
+ volumes :
80
+ - name : hostvars-dir
81
+ hostPath :
82
+ path : /etc/
83
+ type : Directory
84
+ - name : hostvars-secret
85
+ projected :
86
+ sources :
87
+ - secret :
88
+ name : " {{ inventory_hostname }}-hostvars"
89
+ delegate_to : " {{ groups['control'] | first }}"
Original file line number Diff line number Diff line change @@ -9,4 +9,5 @@ cookiecutter
9
9
selinux # this is a shim to avoid having to use --system-site-packages, you still need sudo yum install libselinux-python3
10
10
netaddr
11
11
matplotlib
12
+ kubernetes == 31.0.0
12
13
pulp-cli == 0.23.2
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ collections:
48
48
- name : https://github.com/azimuth-cloud/ansible-collection-image-utils
49
49
type : git
50
50
version : 0.4.0
51
+ - name : kubernetes.core
52
+ version : 2.4.2
51
53
# stackhpc.pulp has pulp.squeezer as dependency, any version, but latest
52
54
# requires newer ansible than can install
53
55
- name : pulp.squeezer
You can’t perform that action at this time.
0 commit comments