When running pup_stat alone, it works.

Adding {{ }} around items did not help



On Fri, Aug 2, 2019, 2:40 AM Kai Stian Olstad <
ansible-project+l...@olstad.com> wrote:

> On 01.08.2019 23:05, Veera wrote:
> > Hi,
> >
> > I am trying to  call variables to the shell module  but failing ..
> >
> > - name: status of  services
> >    hosts: myhost
> >    remote_user: root
> >    gather_facts: no
> >    vars:
> >      - pp_stat: "/etc/init.d/puppet status"
> >      - pr_date: "echo '========= as on  date of ==========='; date"
> >
> >    strategy: free
> >    tasks:
> >      - name: List the   status of the puppet services
> >        ignore_errors: yes
> >        shell: "{{ item }}"
> >        with_items:
> >           -  pp_stat
> >           - pr_date
> >        register: pupstat
> >      - debug:
> >          var: pupstat.stdout_lines
> >
> >
> > error reads:
> >
> > TASK [List the   status of the puppet services]
> >
> **************************************************************************************
> > failed: [wf-omsal1-01-01] (item=pp_stat) => {"changed": true, "cmd":
> > "pp_stat", "delta": "0:00:00.004792", "end": "2019-08-02
> 01:02:19.344642",
> > "item": "pp_stat", "msg": "non-zero return code", "rc": 127, "start":
> "2019-08-02
> > 01:02:19.339850", "stderr": "/bin/sh: pp_stat: command not found",
> > "stderr_lines": ["/bin/sh: pp_stat: command not found"], "stdout": "",
> > "stdout_lines": []}
> > failed: [wf-omsal1-01-01] (item=pr_date) => {"changed": true, "cmd":
> > "pr_date", "delta": "0:00:00.004765", "end": "2019-08-02
> 01:02:24.356002",
> > "item": "pr_date", "msg": "non-zero return code", "rc": 127, "start":
> "2019-08-02
> > 01:02:24.351237", "stderr": "/bin/sh: pr_date: command not found",
> > "stderr_lines": ["/bin/sh: pr_date: command not found"], "stdout": "",
> > "stdout_lines": []}
> > ...ignoring
> >
> >
> > TASK [debug]
> >
> *************************************************************************************************************************
> > ok: [wf-omsal1-01-01] => {
> >      "pupstat.stdout_lines": "VARIABLE IS NOT DEFINED!"
> > }
> >
> > what I am  missing in calling the  variables?
> > using {{ }}  to items  also failed..
>
> Variables in with_items need {{ }} around them.
>
> --
> Kai Stian Olstad
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/8ad-GDtPa6E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e744297c-9e97-56fa-2459-e7b505a4dc63%40olstad.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALNY%2B%2BQWD8X%2B7huJTDj5W6_vVd%3DGyiaN1nuL6%3D%3DaVJb_a9%2BWbQ%40mail.gmail.com.

Reply via email to