Probably something like:

- name: Ensure M_upgrade - M_installed = 1
  assert:
    that:
      - M_upgrade|int - M_installed|int == 1

On Mon, Jan 22, 2018 at 11:18 AM, ZillaYT <[email protected]> wrote:

> I have an Ansible task that aims to upgrade our Gitlab application. I want
> the user to ONLY be able to upgrade 1 major release. For example, I want to
> enable a 8.x to 9.x upgrade, but not an 8.x to 10.x upgrade. I'm aware of
> the version_compare module, which I use, but need more than what it does.
>
> I did write a filter that extracts the major, minor, patch versions of a
> Semver-format version so I can get the major part. But how do I then
> compare them to see if their difference is > 1?
>
> I do...
>
> # NOTE: server_major is a filter I wrote to extract the major version of
> an M.m.p Semver-format version.
> - name: Get major version of installed version
>   set_fact: M_installed=installed_version|sermver_major
> - name: Get the major version of the desired upgrade version
>   set_fact: M_upgrade=upgrade_version|semver_major
> - name: Ensure M_upgrade - M_installed = 1
>   "How do I do this?"
>
>
> Maybe there is a more straight-forward way to do this?
>
> --
> 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/6a53fc0f-ce87-4f7a-8f6c-8a1d2a4014dd%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/6a53fc0f-ce87-4f7a-8f6c-8a1d2a4014dd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v98fpAF-BBJJ8679D3i_5Yiim_5xhvQO1o0%2BaWuQu3XrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to