How to handle roles with dependencies on collections?
by Richard Megginson
Some roles now have dependencies on collections, since with ansible-core
some of the plugins are now external to ansible and only available via
collections.
for background see https://github.com/linux-system-roles/storage/issues/258
The Ansible team regards this as a "not my problem" issue.
I was thinking of adding a non-standard file like
`meta/collection-requirements.yml` to the roles that need it - at least we
could document that users will have to first do
ansible-galaxy role install linux-system-roles.storage
then use
ansible-galaxy collection install -r
/path/to/roles/linux-system-roles.storage/meta/collection-requirements.yml
Any ideas?
10 months, 3 weeks
Re: How to handle too long lines in YAML dictionary?
by Jörg Kastning
Am 30.03.2022 um 15:23 schrieb Richard Megginson:
>> Thanks, wouldn't it be the most readable to combine the two approaches?
>>
> +1
>
>
>> - "{{ ansible_facts['os_family'] }}.yml"
>> - "{{ ansible_facts['distribution'] }}.yml"
>> - "{{ ansible_facts['distribution'] ~ '_' ~
>> ansible_facts['distribution_major_version'] }}.yml"
>> - "{{ ansible_facts['distribution'] ~ '_' ~
>> ansible_facts['distribution_version'] }}.yml"
>>
>> P.
Thank you both. That's what I use, now.
Joerg
11 months, 4 weeks
How to handle too long lines in YAML dictionary?
by Jörg Kastning
Hi,
Running `tox -e yamllint` in my role directory shows that the following
lines in my tasks/main.yml are too long:
~~~
- name: Perform platform/version specific tasks
include_tasks: "{{ lookup('first_found', __rolename_ff_params) }}"
vars:
__rolename_ff_params:
files:
- "{{ ansible_facts['distribution'] }}_{{
ansible_facts['distribution_version'] }}.yml"
- "{{ ansible_facts['distribution'] }}_{{
ansible_facts['distribution_major_version'] }}.yml"
~~~
The last two lines are too long. I've attached the code as well, in case
my MUA messes with the linebreaks here.
How could I solve this? Can I use Multi Line Strings in YAML
dictionaries too?
Could someone give an example please on how to solve this?
Thanks in advance for your help.
Joerg
--
Jörg Kastning
Plattformen und Serverdienste
BITS - Bielefelder IT-Servicezentrum
Universität Bielefeld
11 months, 4 weeks