Ansible Collection Skeleton

Hello, I’m trying to write my own collection skeleton. I’m trying to start with the default one. But it doesn’t work even if I call it from --collection-skeleton:

# ansible-galaxy collection init --force --collection-skeleton /usr/local/lib/python3.11/site-packages/ansible/galaxy/data/default/collection/ my.pappo
ERROR! template error while templating string: Could not load "comment_ify": 'comment_ify'. String: ### REQUIRED
{% for option in required_config %}
[...]

My environent is:

ansible [core 2.16.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.5 (main, Sep  7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2.1.0.1)] (/usr/bin/python3.11)
  jinja version = 3.1.3
  libyaml = True

The same happens if I copy the path /usr/local/lib/python3.11/site-packages/ansible/galaxy/data/default/collection/ in a new folder and I call it with “–collection-skeleton”. I think I’m missing something about the right way to write new collection skeletons.

Could you help me to understand?
Thank you very much
Kind Regards
Marco

The default collection’s galaxy.yml.j2 uses an internal filter (comment_ify) that explicitly specified skeletons don’t have access to. You can use the default skeleton by omitting the --collection-skeleton /path/to/skeleton. The syntax is right for providing a custom skeleton. Any of the non-default skeletons should be valid starting point for a custom skeleton since they won’t use the internal filter.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.