summaryrefslogtreecommitdiffstats
path: root/roles/static_inventory/tasks/checkpoint.yml
diff options
context:
space:
mode:
authorBogdan Dobrelya <bdobreli@redhat.com>2017-07-17 14:05:42 +0200
committerTomas Sedovic <tomas@sedovic.cz>2017-07-17 14:05:42 +0200
commita0d2dd9d29e8622e739870baf172f2b8a7e9c6a0 (patch)
treeaf6498151b459ab00685dd4f47b0286f2f90e9a8 /roles/static_inventory/tasks/checkpoint.yml
parentbef7807177915fe4861fcef5c4a78884f49b3b0e (diff)
downloadopenshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.tar.gz
openshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.tar.bz2
openshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.tar.xz
openshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.zip
Add a role to generate a static inventory (#540)
* Add the static-inventory role that configures the inventory/hosts file by the given path, or creates it for you. Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
Diffstat (limited to 'roles/static_inventory/tasks/checkpoint.yml')
-rw-r--r--roles/static_inventory/tasks/checkpoint.yml17
1 files changed, 17 insertions, 0 deletions
diff --git a/roles/static_inventory/tasks/checkpoint.yml b/roles/static_inventory/tasks/checkpoint.yml
new file mode 100644
index 000000000..c0365bd3d
--- /dev/null
+++ b/roles/static_inventory/tasks/checkpoint.yml
@@ -0,0 +1,17 @@
+---
+- name: check for static inventory dir
+ stat:
+ path: "{{ inventory_path }}"
+ register: stat_inventory_path
+
+- name: create static inventory dir
+ file:
+ path: "{{ inventory_path }}"
+ state: directory
+ mode: 0750
+ when: not stat_inventory_path.stat.exists
+
+- name: create inventory from template
+ template:
+ src: inventory.j2
+ dest: "{{ inventory_path }}/hosts"