Why extra variables (-e) ignoring commands after pipeline ("|") while
running playbook with -e options.


Following playbook giving output till "netstat -an" only. I want the output
of this "netstat -an | grep 8080" or any command which can be run at the
run time on remote host.


ansible-playbook /etc/ansible/command_run.yml -e "ip=192.168.4.10" -e
'command="netstat -an | grep 8080"'

command_run.yml

- hosts: "{{ip}}"
  gather_facts: no
  remote_user: remote
  connection: local

  tasks:
   - name: Running command
     command: ansible {{ip}} -a "{{command}}"



However, Following is working.

ansible-playbook /etc/ansible/command_run.yml -e "ip=192.168.4.10" -e
'command="free -m"'.

-- 
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/CAH5ShBjNOk8qT0mPNRNRNTa4L2arejnPN4k-93rt71Y_VyO6%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to