Files
ansible-freeipa/utils/build-galaxy-release.sh
Thomas Woerner f45b7d9db0 build-galaxy-release: Galaxyfy READMEs, module EXAMPLES and tests
Up to now the snippets in the README files, the EXAMPLES in the modules
and also the tests playbooks have not been adapted while building the
collection.

These are the invoved python files:

    utils/galaxyfy-README.py
    utils/galaxyfy-module-EXAMPLES.py
    utils/galaxyfy-playbook.py
    utils/galaxyfy.py

utils/galaxyfy.py provides the function galaxyfy_playbook, which has been
extended and is used in galaxyfy-playbook.py, galaxyfy-README.py and
galaxyfy-module-EXAMPLES.py.
2020-11-13 15:59:45 +01:00

66 lines
1.9 KiB
Bash

#!/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.${collection_prefix}.plugins.module_utils.ansible_freeipa_module/" plugins/modules/*.py
cd plugins/module_utils && {
ln -s ../../roles/*/module_utils/*.py .
cd ../..
}
cd plugins/modules && {
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/*/action_plugins/*.py .
cd ../..
}
for x in $(find plugins/modules -name "*.py" -print); do
python utils/galaxyfy-module-EXAMPLES.py "$x" "ipa" "$collection_prefix"
done
for x in $(find roles/*/library -name "*.py" -print); do
python utils/galaxyfy-module-EXAMPLES.py "$x" "ipa" "$collection_prefix"
done
for x in roles/*/tasks/*.yml; do
python utils/galaxyfy-playbook.py "$x" "ipa" "$collection_prefix"
done
for x in $(find playbooks -name "*.yml" -print); do
python utils/galaxyfy-playbook.py "$x" "ipa" "$collection_prefix"
done
for x in $(find . -name "README*.md" -print); do
python utils/galaxyfy-README.py "$x" "ipa" "$collection_prefix"
done
for x in $(find tests -name "*.yml" -print); do
python utils/galaxyfy-playbook.py "$x" "ipa" "$collection_prefix"
done
#git diff
ansible-galaxy collection build
rm plugins/module_utils/ansible_ipa_*
rm plugins/modules/ipaserver_*
rm plugins/modules/ipareplica_*
rm plugins/modules/ipaclient_*
rm plugins/action_plugins/ipaclient_*
git reset --hard