mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-15 05:52:24 +00:00
utils/*galaxy*: Make galaxy scripts more generic
The namespace and colleciton name have been hard coded. Now variables are used for them. The project prefix and collection prefix are now passed to galaxyify-playbook.py.
This commit is contained in:
@@ -1,36 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
namespace="freeipa"
|
||||
collection="ansible_freeipa"
|
||||
collection_prefix="${namespace}.${collection}"
|
||||
|
||||
galaxy_version=$(git describe --tags | sed -e "s/^v//")
|
||||
echo $galaxy_version | grep "-" -q || galaxy_version="${galaxy_version}"
|
||||
sed -i -e "s/version: .*/version: \"$galaxy_version\"/" galaxy.yml
|
||||
|
||||
find . -name "*~" -exec rm {} \;
|
||||
|
||||
sed -i -e "s/ansible.module_utils.ansible_freeipa_module/ansible_collections.freeipa.ansible_freeipa.plugins.module_utils.ansible_freeipa_module/" plugins/modules/*.py
|
||||
sed -i -e "s/ansible.module_utils.ansible_freeipa_module/ansible_collections.${collection_prefix}.plugins.module_utils.ansible_freeipa_module/" plugins/modules/*.py
|
||||
|
||||
cd plugins/module_utils && {
|
||||
ln -s ../../roles/ipa*/module_utils/*.py .
|
||||
ln -s ../../roles/*/module_utils/*.py .
|
||||
cd ../..
|
||||
}
|
||||
|
||||
cd plugins/modules && {
|
||||
sed -i -e "s/ansible.module_utils.ansible_ipa_/ansible_collections.freeipa.ansible_freeipa.plugins.module_utils.ansible_ipa_/" ../../roles/ipa*/library/*.py
|
||||
ln -s ../../roles/ipa*/library/*.py .
|
||||
sed -i -e "s/ansible.module_utils.ansible_ipa_/ansible_collections.${collection_prefix}.plugins.module_utils.ansible_ipa_/" ../../roles/*/library/*.py
|
||||
ln -s ../../roles/*/library/*.py .
|
||||
cd ../..
|
||||
}
|
||||
|
||||
[ ! -x plugins/action_plugins ] && mkdir plugins/action_plugins
|
||||
cd plugins/action_plugins && {
|
||||
ln -s ../../roles/ipa*/action_plugins/*.py .
|
||||
ln -s ../../roles/*/action_plugins/*.py .
|
||||
cd ../..
|
||||
}
|
||||
|
||||
for x in roles/ipa*/tasks/*.yml; do
|
||||
python utils/galaxyify-playbook.py "$x"
|
||||
for x in roles/*/tasks/*.yml; do
|
||||
python utils/galaxyify-playbook.py "$x" "ipa" "$collection_prefix"
|
||||
done
|
||||
|
||||
for x in $(find playbooks -name "*.yml" -print); do
|
||||
python utils/galaxyify-playbook.py "$x"
|
||||
python utils/galaxyify-playbook.py "$x" "ipa" "$collection_prefix"
|
||||
done
|
||||
|
||||
#git diff
|
||||
@@ -43,4 +47,3 @@ rm plugins/modules/ipareplica_*
|
||||
rm plugins/modules/ipaclient_*
|
||||
rm plugins/action_plugins/ipaclient_*
|
||||
git reset --hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user