refactor 2/2: ensureparentdir > ensuredir

This commit is contained in:
2026-09-15 21:55:40 +05:30
parent 829e8225f6
commit a06e02c7cc
2 changed files with 0 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
galaxy_info:
author: kevinnlsamuel
description: sayin hello
dependencies:
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
+28
View File
@@ -0,0 +1,28 @@
- name: check if dir exists
register: stat_output
ansible.builtin.stat:
path: "{{ path }}"
- name: create dir if not exists
when: not stat_output.stat.exists
ansible.builtin.file:
path: "{{ path }}"
state: directory
- name: backup and create dir if not dir
when: stat_output.stat.exists and not stat_output.stat.isdir
block:
- name: "backup existing {{ path }}"
no_log: true
ansible.builtin.copy:
src: "{{ path }}"
dest: "{{ path }}.old"
- name: "delete existing {{ path }}"
no_log: true
ansible.builtin.file:
path: "{{ path }}"
state: absent
- name: "create {{ path }}"
ansible.builtin.file:
path: "{{ path }}"
state: directory