This may not directly answer your question, but this how I am handling that 
same issue. We have definitions of packages and rpms defined in group_vars 
and host_vars:

# inventory/dse/group_vars/dse/package_versions.yml
package_versions:
  app:
    app: 4.6.1
    jre: jre-1.7.0_75-fcs.x86_64

Then as part of the role of "app" we check if the packages are already 
installed:

# roles/datastax_enterprise/tasks/main.yml
- name: Lookup installed jre version
  shell: rpm -q jre || true
  register: installed_jre_version
  ignore_errors: true
  changed_when: installed_jre_version.stdout != package_versions.app.jre

- name: Install jre rpm
  yum:  pkg={{ path_to_rpm }}/{{ package_versions.app.jre }} state=present
  sudo: yes
  when: installed_jre_version | changed

So "installed_jre_version | changed" is True only when jre doesn't match 
our version (not installed or earlier version). You can take the same 
action as my "Lookup installed jre version" to register a variable based on 
the output of "1" or of a different play that double-checks "1" and then 
run "2" based on that 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 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/58239dbe-2bb0-43d4-a975-6919cd3f1faa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to