You're trying to compare a structure to a string. You probably meant
to use "git_installed_version" in your when conditional. Also, you
either need to quote the "{{ git_version }}" in the conditional so
that the string is quoted, or just leave it off entirely since it's
using 2 variables, no need to bring templating into it. You'll
probably want something like this:- name: Dump git_installed_version to file debug: msg="success" when: git_installed_version == git_version tags: dump On Thu, Mar 12, 2015 at 4:23 PM, Chris Short <[email protected]> wrote: > I am trying to register the output of a shell command, set it as a fact, and > then run the playbook only when there is not a match. Example: > > --- > - name: Register git version that is installed on system > shell: git --version | sed 's/git\ version\ //g' > register: git_version_output > tags: register > > - name: Set git_installed_version fact > set_fact: git_installed_version=git_version_output.stdout_lines > tags: fact > > - name: Dump git_installed_version to file > debug: msg="success" > when: git_version_output == {{ git_version }} > tags: dump > > But, I'm getting the following error: > > error while evaluating conditional: git_version_output == 2.3.2 > > I'm not quite sure if the syntax is right and I'm completely lost on how to > make the playbook run/not run if the conditional is met/not met. > > -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/941d93cb-bb5a-4f08-a441-7a05d3e0055b%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJQqANe_8Yp5x2N3NjH3jj1h9q2TeeSLyKESU%3DdOF2CrDHb9PA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
