add more ansible tasks to rolE
This commit is contained in:
parent
f1fd49431d
commit
aff06a396f
3 changed files with 34 additions and 11 deletions
4
roles/k3s-nfs-host/defaults/main.yml
Normal file
4
roles/k3s-nfs-host/defaults/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Defaults for k3s-nfs-host
|
||||||
|
---
|
||||||
|
nfs_host_mount_point: /srv/nfs
|
||||||
|
nfs_host_kubeconfig_path: "$HOME/.kube/config-k3s-netz39-tunnel"
|
|
@ -1,20 +1,38 @@
|
||||||
# nfs server einrichten
|
---
|
||||||
# apt install nfs-kernel-server
|
|
||||||
|
|
||||||
# mountpoint anlegen
|
# - name: Create a new ext4 primary partition
|
||||||
# /srv/nfs
|
# community.general.parted:
|
||||||
# sudo chown nobody:nogroup /srv/nfs
|
# device: "{{ nfs_host_storage_device }}"
|
||||||
# sudo chmod 0777 /srv/nfs
|
# number: 1
|
||||||
|
# state: present
|
||||||
|
# fs_type: ext4
|
||||||
|
|
||||||
|
- name: Install nfs-kernel-server
|
||||||
|
ansible.builtin.apt:
|
||||||
|
state: present
|
||||||
|
name:
|
||||||
|
- nfs-kernel-server
|
||||||
|
|
||||||
|
- name: ensure nfs mountpoint is present
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ nfs_host_mount_point }}"
|
||||||
|
state: directory
|
||||||
|
owner: nobody
|
||||||
|
group: nogroup
|
||||||
|
mode: '0777'
|
||||||
|
|
||||||
# modify /etc/exports#
|
# modify /etc/exports#
|
||||||
# echo '/srv/nfs 10.0.0.0/24(rw,sync,no_subtree_check)'
|
# echo '/srv/nfs 10.0.0.0/24(rw,sync,no_subtree_check)'
|
||||||
|
- name: ensure exports file has k3s ips
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: templates/exports.j2
|
||||||
|
dest: "/etc/exports"
|
||||||
# restart nfs server
|
# restart nfs server
|
||||||
|
|
||||||
# apply node label
|
# apply node label
|
||||||
- name: Apply labels to each worker nodes
|
- name: Apply labels to storage worker node
|
||||||
k8s:
|
kubernetes.core.k8s:
|
||||||
kubeconfig: "{{ ocp_ignition_file_path }}/auth/kubeconfig"
|
kubeconfig: "{{ nfs_host_kubeconfig_path }}"
|
||||||
state: present
|
state: present
|
||||||
definition:
|
definition:
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
1
roles/k3s-nfs-host/templates/exports.j2
Normal file
1
roles/k3s-nfs-host/templates/exports.j2
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{{ nfs_host_mount_point }} k3s-w[0-9]+.n39.eu(rw,sync,no_subtree_check)
|
Loading…
Reference in a new issue