Merge pull request #243 from t-woerner/galaxy-fix

Galaxy fix
This commit is contained in:
Rafael Guterres Jeffman
2020-04-06 20:44:21 -03:00
committed by GitHub
13 changed files with 35 additions and 38 deletions

View File

@@ -18,6 +18,7 @@ license_file: "COPYING"
dependencies:
tags:
- "system"
- "identity"
- "ipa"
- "freeipa"

View File

@@ -96,9 +96,6 @@ options:
config_master_host_name:
description: The config master_host_name setting
required: no
ccache:
description: The local ccache
required: no
installer_ccache:
description: The installer ccache setting
required: no
@@ -172,7 +169,6 @@ def main():
# additional
server=dict(required=True),
config_master_host_name=dict(required=True),
ccache=dict(required=True),
installer_ccache=dict(required=True),
_ca_enabled=dict(required=False, type='bool'),
_kra_enabled=dict(required=False, type='bool'),
@@ -232,8 +228,6 @@ def main():
# additional
options.server = ansible_module.params.get('server')
master_host_name = ansible_module.params.get('config_master_host_name')
ccache = ansible_module.params.get('ccache')
# os.environ['KRB5CCNAME'] = ccache
os.environ['KRB5CCNAME'] = ansible_module.params.get('installer_ccache')
installer._ccache = ansible_module.params.get('installer_ccache')
ca_enabled = ansible_module.params.get('_ca_enabled')
@@ -268,8 +262,6 @@ def main():
remote_api = gen_remote_api(master_host_name, paths.ETC_IPA)
installer._remote_api = remote_api
# ccache = os.environ['KRB5CCNAME']
with redirect_stdout(ansible_log):
ansible_log.debug("-- INSTALL KRA --")

View File

@@ -155,19 +155,19 @@ def main():
with redirect_stdout(ansible_log):
argspec = inspect.getargspec(install_krb)
if "promote" in argspec.args:
krb = install_krb(
install_krb(
config,
setup_pkinit=not options.no_pkinit,
pkcs12_info=pkinit_pkcs12_info,
promote=promote)
else:
if "fstore" not in argspec.args:
krb = install_krb(
install_krb(
config,
setup_pkinit=not options.no_pkinit,
pkcs12_info=pkinit_pkcs12_info)
else:
krb = install_krb(
install_krb(
config,
setup_pkinit=not options.no_pkinit,
pkcs12_info=pkinit_pkcs12_info,

View File

@@ -606,7 +606,6 @@
server: "{{ result_ipareplica_test.server }}"
config_master_host_name:
"{{ result_ipareplica_prepare.config_master_host_name }}"
ccache: "{{ result_ipareplica_prepare.ccache }}"
installer_ccache: "{{ result_ipareplica_prepare.installer_ccache }}"
_ca_enabled: "{{ result_ipareplica_prepare._ca_enabled }}"
_kra_enabled: "{{ result_ipareplica_prepare._kra_enabled }}"

View File

@@ -58,7 +58,7 @@ options:
description: The starting value for the IDs range (default random)
required: no
idmax:
description: The max value for the IDs range (default: idstart+199999)
description: The max value for the IDs range (default idstart+199999)
required: no
no_hbac_allow:
description: Don't install allow_all HBAC rule

View File

@@ -79,7 +79,7 @@ options:
description: The starting value for the IDs range (default random)
required: no
idmax:
description: The max value for the IDs range (default: idstart+199999)
description: The max value for the IDs range (default idstart+199999)
required: no
no_hbac_allow:
description: Don't install allow_all HBAC rule

View File

@@ -55,7 +55,7 @@ options:
description: The starting value for the IDs range (default random)
required: no
idmax:
description: The max value for the IDs range (default: idstart+199999)
description: The max value for the IDs range (default idstart+199999)
required: no
no_hbac_allow:
description: Don't install allow_all HBAC rule

View File

@@ -111,7 +111,7 @@ options:
description: The starting value for the IDs range (default random)
required: no
idmax:
description: The max value for the IDs range (default: idstart+199999)
description: The max value for the IDs range (default idstart+199999)
required: no
domainlevel:
description: The domain level

View File

@@ -98,7 +98,7 @@ options:
description: The starting value for the IDs range (default random)
required: no
idmax:
description: The max value for the IDs range (default: idstart+199999)
description: The max value for the IDs range (default idstart+199999)
required: no
no_reverse:
description: Do not create new reverse DNS zone

View File

@@ -79,7 +79,7 @@ options:
description: The starting value for the IDs range (default random)
required: yes
idmax:
description: The max value for the IDs range (default: idstart+199999)
description: The max value for the IDs range (default idstart+199999)
required: yes
no_pkinit:
description: Disable pkinit setup steps

View File

@@ -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}-1"
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/galaxyfy-playbook.py "$x" "ipa" "$collection_prefix"
done
for x in $(find playbooks -name "*.yml" -print); do
python utils/galaxyify-playbook.py "$x"
python utils/galaxyfy-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

View File

@@ -2,11 +2,14 @@ import sys
import re
def galaxify_playbook(playbook_in):
p1 = re.compile('(ipa.*:)$')
p2 = re.compile('(.*:) (ipa.*)$')
def galaxify_playbook(playbook_in, project_prefix, collection_prefix):
p1 = re.compile('(%s.*:)$' % project_prefix)
p2 = re.compile('(.*:) (%s.*)$' % project_prefix)
lines = []
pattern1 = r'%s.\1' % collection_prefix
pattern2 = r'\1 %s.\2' % collection_prefix
with open(playbook_in) as in_f:
changed = False
changeable = False
@@ -22,14 +25,13 @@ def galaxify_playbook(playbook_in):
elif stripped.startswith("include_role:"):
include_role = True
elif include_role and stripped.startswith("name:"):
line = p2.sub(r'\1 freeipa.ansible_freeipa.\2', line)
line = p2.sub(pattern2, line)
changed = True
elif changeable and stripped.startswith("- role:"):
line = p2.sub(r'\1 freeipa.ansible_freeipa.\2', line)
line = p2.sub(pattern2, line)
changed = True
elif changeable and not stripped.startswith(
"freeipa.ansible_freeipa."):
line = p1.sub(r'freeipa.ansible_freeipa.\1', line)
elif changeable and not stripped.startswith(collection_prefix):
line = p1.sub(pattern1, line)
changed = True
lines.append(line)
@@ -40,4 +42,4 @@ def galaxify_playbook(playbook_in):
out_f.write(line)
galaxify_playbook(sys.argv[1])
galaxify_playbook(sys.argv[1], sys.argv[2], sys.argv[3])

View File

@@ -120,7 +120,7 @@ param_docs = {
"allow_zone_overlap": "Create DNS zone even if it already exists",
"skip_conncheck": "Skip connection check to remote master",
"idstart": "The starting value for the IDs range (default random)",
"idmax": "The max value for the IDs range (default: idstart+199999)",
"idmax": "The max value for the IDs range (default idstart+199999)",
"no_hbac_allow": "Don't install allow_all HBAC rule",
"domainlevel": "The domain level",
"external_ca_type": "Type of the external CA",