21 lines
598 B
YAML
21 lines
598 B
YAML
---
|
|
- name: "Generate html file for each host"
|
|
hosts: all
|
|
gather_facts: yes
|
|
vars:
|
|
host_inventory: "1-1.practice-k8s.cloud"
|
|
inventory_dir: "/var/www/html/inventory"
|
|
tasks:
|
|
- name: "Create template directory"
|
|
file:
|
|
path: "{{inventory_dir}}"
|
|
owner: "apache"
|
|
group: "apache"
|
|
mode: "0755"
|
|
state: "directory"
|
|
delegate_to: "{{host_inventory}}"
|
|
- name: "html file generation"
|
|
template:
|
|
src: "template-net.html.j2"
|
|
dest: "{{inventory_dir}}/{{inventory_hostname}}.html"
|
|
delegate_to: "{{host_inventory}}" |