diff --git a/hostpath.yaml b/hostpath.yaml new file mode 100644 index 0000000..7df80de --- /dev/null +++ b/hostpath.yaml @@ -0,0 +1,5 @@ +--- +- hosts: worker-node + name: "HostPath" + roles: + - role: hostpath diff --git a/roles/hostpath/files/index.html b/roles/hostpath/files/index.html new file mode 100644 index 0000000..122eac8 --- /dev/null +++ b/roles/hostpath/files/index.html @@ -0,0 +1,10 @@ + + +
+ +Hello World!
+ + + diff --git a/roles/hostpath/tasks/main.yaml b/roles/hostpath/tasks/main.yaml new file mode 100644 index 0000000..292149c --- /dev/null +++ b/roles/hostpath/tasks/main.yaml @@ -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"