I've been using Ansible for more than a year now and it's great. I mainly 
use it in playbook mode, and it's mainly called by the build server as part 
of a pipeline.

My concern is this: Several times I have gotten stuck when there's a need 
for using the output from one command as input to another. This makes it 
hard to automate flows. I find the Ansible built-in and Jinja filter too 
limited. With shell, I'm used to working with line-oriented output and 
piping one cmd to the next. I find that hard to do in Ansible.

Am I the only one with this problem?
Am I missing something?
What are the best practices? 
I don't know Python - is this what's limiting me?
Can you share your experiences/solutions?

I looked at some threads on this forum and I found some people with similar 
problems but no general solution. Is it correct that some (specialized) 
modules return the output as structured data? Could this be added to the 
basic modules?

*Here's an example:*
The first task calls a shell on target host that calls the Tomcat manager 
on localhost which lists the web apps. A output line looks like this:
    /MyWebApp:running:0:MyWebApp

After that I would like to create a list of the *running* webapps and use 
this in the following command.

    - name: Get running services

      local_action: shell getRunningServices {{ inventory_hostname }}

      register: validate_int_result


    - name: Echo running services

      local_action: command echo "Service - {{ item }}"

      with_items: validate_int_result.stdout_lines

      when: "':running:' in item"


Here the second task only identifies the relevant lines. *How do I do what 
I need to do, i.e. collect the running services into a list variable?*

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to