On 1/29/20 3:05 PM, Pawan Kumar wrote: > Hi Team, > > I am able to extract the selected list of installed rpms using ansible > "shell" module ,But when I tried using "yum" > module ,it's no success . > Your help would be appreciated .
Hello Pawan,
what's your yum task and the error message you get from the yum module?
Regards
Racke
>
> The playbook which is running with "shell" module & it's output is as follows
> ---
>
>
> Playbook---
>
> ---
> - hosts: localhost
> tasks:
> - name: Create a list
> set_fact:
> package_list:
> - zlib
> - parted
> - gawk
>
> - name: Display Lists
> debug:
> msg:
> - "{{ package_list }}"
>
>
> - name: ensure a list of packages installed
> shell: rpm -qa "{{ item }}"
> with_items: "{{ package_list }}"
> register: ensure_list
> args:
> warn: false
>
>
>
> - name: show results values from ensure_list & filtering one of the key
> attribute called 'stdout'
> debug:
> msg: "{{ ensure_list.results | map(attribute='stdout')|list }}"
>
>
>
>
>
> ================================================Output =======================
>
>
> PLAY [localhost]
> ********************************************************************************************************************************************
>
> TASK [Gathering Facts]
> **************************************************************************************************************************************
> ok: [localhost]
>
> TASK [Create a list]
> ****************************************************************************************************************************************
> ok: [localhost]
>
> TASK [Display Lists]
> ****************************************************************************************************************************************
> ok: [localhost] => {
> "msg": [
> [
> "zlib",
> "parted",
> "gawk"
> ]
> ]
> }
>
> TASK [ensure a list of packages installed]
> ******************************************************************************************************************
> changed: [localhost] => (item=zlib)
> changed: [localhost] => (item=parted)
> changed: [localhost] => (item=gawk)
>
>
> TASK [show results values from ensure_list]
> *****************************************************************************************************************
> ok: [localhost] => {
> "msg": [
> "zlib-1.2.7-18.el7.x86_64",
> "parted-3.1-31.el7.x86_64",
> "gawk-4.0.2-4.el7_3.1.x86_64"
> ]
> }
>
> PLAY RECAP
> **************************************************************************************************************************************************
> localhost : ok=6 changed=1 unreachable=0 failed=0
> skipped=0 rescued=0 ignored=0
>
> --
> 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]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5c0e4a0f-e4cb-4736-ab83-3c893052647d%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5c0e4a0f-e4cb-4736-ab83-3c893052647d%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/9874bdbe-1159-1913-2a16-52710e6382ac%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
