mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
utils/build-galaxy-release.sh: Create module action group
The module action group <collection-prefix>.modules is created
automatically while building the galaxy release.
The action group can be used for module_defaults in this way:
module_defauls:
group/<collection-prefix>.modules:
ipaadmin_password: SomeADMINpassword
Example:
module_defaults:
group/freeipa.ansible_freeipa.modules:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
collections:
- freeipa.ansible_freeipa
This commit is contained in:
@@ -114,6 +114,8 @@ echo -e "\033[ACreating CHANGELOG.rst... \033[32;1mDONE\033[0m"
|
||||
|
||||
sed -i -e "s/ansible.module_utils.ansible_freeipa_module/ansible_collections.${collection_prefix}.plugins.module_utils.ansible_freeipa_module/" plugins/modules/*.py
|
||||
|
||||
python utils/create_action_group.py "meta/runtime.yml" "$collection_prefix"
|
||||
|
||||
(cd plugins/module_utils && {
|
||||
ln -sf ../../roles/*/module_utils/*.py .
|
||||
})
|
||||
|
||||
24
utils/create_action_group.py
Normal file
24
utils/create_action_group.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import sys
|
||||
import yaml
|
||||
from facts import MANAGEMENT_MODULES
|
||||
|
||||
|
||||
def create_action_group(yml_file, project_prefix):
|
||||
yaml_data = None
|
||||
with open(yml_file) as f_in:
|
||||
yaml_data = yaml.safe_load(f_in)
|
||||
|
||||
yaml_data.setdefault("action_groups", {})[
|
||||
"%s.modules" % project_prefix
|
||||
] = MANAGEMENT_MODULES
|
||||
|
||||
with open(yml_file, 'w') as f_out:
|
||||
yaml.safe_dump(yaml_data, f_out, default_flow_style=False,
|
||||
explicit_start=True)
|
||||
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: %s <runtime file> <collection prefix>" % sys.argv[0])
|
||||
sys.exit(-1)
|
||||
|
||||
create_action_group(sys.argv[1], sys.argv[2])
|
||||
Reference in New Issue
Block a user