I think ansible_version is pretty new (1.8?), so it won't help much with older versions
James Cammarata <[email protected]> napisał: >Hi James, the variable ansible_version is available for this. Here's an >example of the debug output of this variable: > >TASK: [debug var=ansible_version] >********************************************* >ok: [127.0.0.1] => { > "ansible_version": { > "full": "1.8", > "major": 1, > "minor": 8, > "revision": 0, > "string": "..." > } >} > >The "string" portion contains what is shown when you run something like >"ansible-playbook --version", I've just omitted here since it's a >pretty >long string. > >Hope that helps! > > >On Mon, Nov 24, 2014 at 10:28 AM, James Morgan <[email protected]> >wrote: > >> Hi, >> >> Prior to Ansible 1.7.2 I did not need to add slashes to the end of >each >> line. Since this version it complains if I don't >> >> This causes a problem as different environments have different >versions of >> ansible. Some 1.7, some 1.7.2 >> >> Is there a way to query the version of ansible? >> >> For example >> >> - name: Generate permissions >> tags: >> - db >> - data >> shell: > >> chdir="{{ release_dir }}/some_app" >> tclsh {{ genperms }} *\ <---------* >> -format LOAD *\* >> -output_dir "{{ release_dir }}/reference/db" *\* >> "{{ conf_dir }}//box_specific/some_app.cfg" >> >> I plan to move some of these shell commands into a module which would >sort >> this, but I need solution that doesn't rely on that. >> >> Thanks >> >> James >> >> -- >> 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/bdfe4515-bcaf-451e-9bb2-4b97397a1dcf%40googlegroups.com >> ><https://groups.google.com/d/msgid/ansible-project/bdfe4515-bcaf-451e-9bb2-4b97397a1dcf%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> 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/CAMFyvFieqc22B5k%3DomBV4CteS5mReMgK2Yc6gV-ZBShkiCnpbQ%40mail.gmail.com. >For more options, visit https://groups.google.com/d/optout. -- Wysłane za pomocą K-9 Mail. -- 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/e653b5b6-95c7-477d-8065-fe085a5a8761%40email.android.com. For more options, visit https://groups.google.com/d/optout.
