On Wed, Mar 30, 2022 at 7:18 AM Pavel Cahyna <pcahyna@redhat.com> wrote:
On Wed, Mar 30, 2022 at 07:04:28AM -0600, Richard Megginson wrote:
> On Wed, Mar 30, 2022 at 7:01 AM Pavel Cahyna <pcahyna@redhat.com> wrote:
>
> > Hi,
> >
> > On Wed, Mar 30, 2022 at 02:36:59PM +0200, Jörg Kastning wrote:
> > > 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"
> > > ~~~
> >
>
> Here is an alternate way to do this "define platform/OS specific vars"
> https://github.com/linux-system-roles/template/blob/master/tasks/main.yml#L8-L21
> which confirms to current recommended practices:
> https://github.com/redhat-cop/automation-good-practices/tree/main/roles#platform-specific-variables

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.

>
> >
> > > 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?
> >
> > https://github.com/linux-system-roles/timesync/pull/47/files
> >
> > P.
> > _______________________________________________
> > systemroles mailing list -- systemroles@lists.fedorahosted.org
> > To unsubscribe send an email to systemroles-leave@lists.fedorahosted.org
> > Fedora Code of Conduct:
> > https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives:
> > https://lists.fedorahosted.org/archives/list/systemroles@lists.fedorahosted.org
> > Do not reply to spam on the list, report it:
> > https://pagure.io/fedora-infrastructure
> >