Trying to pass a list of packages to be installed, and the output must
return the packages will get installed before continuing with the install.
Example output I get using jq (which is what I'm after):
"dpkg-dev [1.17.5ubuntu5.5] (1.17.5ubuntu5.6 Ubuntu:14.04/trusty-updates
[all]) []"
"libdpkg-perl [1.17.5ubuntu5.5] (1.17.5ubuntu5.6
Ubuntu:14.04/trusty-updates [all])"
"apt-transport-https [1.0.1ubuntu2.11] (1.0.1ubuntu2.13
Ubuntu:14.04/trusty-updates [amd64])"
"linux-libc-dev [3.13.0-83.127] (3.13.0-85.129 Ubuntu:14.04/trusty-updates
[amd64])"
Below is the playbook
- name: APT | Check upgradeable packages
shell: apt-get -s install '{{item}}' | grep ^Inst | cut -d' ' -f2-
with_items: '{{adhoc_package_list}}'
register: packages
- name: APT | List upgradeable packages
debug: msg='{{item.stdout_lines}}'
with_items: '{{packages.results}}'
Is this possible?
On Friday, 6 May 2016 13:48:09 UTC+2, Johannes Kastl wrote:
>
> On 06.05.16 13:12 [email protected] <javascript:> wrote:
> > Hi,
> >
> > It is possible to select all the elements instead of specify one
> element?
> >
> > Working:
> > debug: msg="{{packages.results[0].stdout_lines}}"
> >
> > I've tried:
> > debug: msg="{{packages.results[].stdout_lines}}" - It returns 'list
> object
> > has no element ()'
> >
>
> Just a guess:
>
> debug: msg="{{item.stdout_lines}}"
> with_items: packages.results
>
> or just output the whole:
>
> debug: var=packages
> or
> debug: var=packages.results
>
> What do you want to achieve?
>
> Johannes
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/47436c5b-7874-4cae-b5fb-dcd4258e993e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.