Hi Sebastian
Merging the lists indeed did the trick. Thanks for the suggestion!
However, I have another, related question; The next task in this
playbook is like this:
- name: Install extra packages required for plugins  yum:      name:
"{{ item.packages }}"      state: "present"  with_items:       - "{{
default_plugins }}"      - "{{ plugins | d(omit) }}"  when:
item.packages is defined
And currently ansible even doesn't give a deprecation warning on this
task despite that I'm using a loop in combination with yum. And the
only difference I see is that i'm using {{ item.packages }} instead of
{{ item }} but I assume this will also deprecate ?How should I rewrite
this then ?
Thanks
Robin
Sebastian Meyer schreef op wo 27-03-2019 om 18:47 [+0100]:
> Hi Robin,
> 
> On 27.03.19 17:16, Robin Roevens wrote:
> > Hi all
> > 
> > I'm currently trying to get rid of all deprecation warnings as we
> > upgraded 
> > Ansible 2.3 to 2.7.9 (CentOS 7.4)
> > And I have this code:
> > 
> > - name: Install required system packages
> >   yum:
> >     name: "{{ item }}"
> >     state: 'present'
> >   with_items:
> >     - "{{ base_packages }}"
> >     - "{{ additional_packages | d(omit) }}"
> 
> Assuming base_packages and additional_packages are lists, try:
> 
> - name: install pkgs
>   yum:
>     state: present
>     name: "{{ base_pkgs + additional_pkgs | default([]) }}"
> 
> Ansible wants a flat list here. The suggestion in the deprecation
> warning thinks both are just normal values and wants you to put them
> into a list.
> 
> But if you already have lists, merge them with + as in the above
> code.
> 
> HTH,
> Sebastian
> 
> -- 
> Sebastian Meyer
> Linux Consultant & Trainer
> Mail: me...@b1-systems.de
> 
> B1 Systems GmbH
> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB
> 3537
> 
-- 
Dit bericht is gescanned op virussen en andere gevaarlijke
inhoud door MailScanner en lijkt schoon te zijn.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1553774236.2809.132.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to