scripts

Random assortment of scripts
Log | Files | Refs

commit 052355de57c7f1ba9f9e8aad7bc6922e8d07bff6
parent d492272324f0c1e0c544a3752c583fb50c5a01cd
Author: andersuno <anders.hedman01@gmail.com>
Date:   Mon,  9 Nov 2020 21:12:02 +0100

 Changes to be committed:
	new file:   mkansibleroledirs.sh

Diffstat:
Amkansibleroledirs.sh | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/mkansibleroledirs.sh b/mkansibleroledirs.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +echo "Make sure you stand in your Ansible roles directory before running" + +dir=$(pwd) + +echo "Is this the correct directory?" "$dir" "[Y/n]" +read -r ans + +[ "$ans" = n ] || [ "$ans" = N ] && exit + +echo "What should the new role be called?" +read -r rolename + +DIRS="tasks handlers templates files vars defaults meta" + +for i in ${DIRS}; do + echo "$dir/$rolename/$i"; +done + +[ -e "$dir/$rolename" ] && echo "This directory already exist, OVERWRITE? [y/N]" && read -r ans + +[ "$ans" != y ] && [ "$ans" != Y ] && exit + +for i in ${DIRS}; do + mkdir -p "$dir/$rolename/$i"; +done + +YMLDIRS="tasks handlers vars defaults meta" +mainymlcontent="---\n" + +for i in ${YMLDIRS}; do + echo $mainymlcontent >> "$dir/$rolename/$i/main.yml"; +done