Add hostpath roles

master
guppy 2023-06-01 15:56:25 +02:00
parent 65e6725f34
commit 47c6cf891f
3 changed files with 28 additions and 0 deletions

5
hostpath.yaml 100644
View File

@ -0,0 +1,5 @@
---
- hosts: worker-node
name: "HostPath"
roles:
- role: hostpath

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<body>
<h1>This file is on k8s-worker-node2 at /data</h1>
<p>Hello World!</p>
</body>
</html>

View File

@ -0,0 +1,13 @@
- name: create data dir on K8s-worker-node2
become: yes
file:
path: /data
state: directory
when: "'K8s-worker-node2' in ansible_facts.hostname"
- name: copy file on K8s-worker-node2
become: yes
copy:
src: index.html
dest: /data/
when: "'K8s-worker-node2' in ansible_facts.hostname"