[add] tools:rename-roll

This commit is contained in:
Christian Fraß 2023-11-22 15:20:08 +01:00
parent c5bdce6824
commit 937f782007

19
tools/rename-roll Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
## args
name_from=$1 && shift
name_to=$1 && shift
## vars
var_from=$(echo ${name_from} | sed --expression="s|-|_|g" | sed --expression="s|:|_|g")
var_to=$(echo ${name_to} | sed --expression="s|-|_|g" | sed --expression="s|:|_|g")
## exec
git mv ansible/roles/${name_from} ansible/roles/${name_to}
find ansible -type f -exec sed --in-place --expression="s|var_${var_from}_|var_${var_to}_|g" {} \;
find ansible -type f -exec sed --in-place --expression="s|roles/${name_from}|roles/${name_to}|g" {} \;