Skip to content
Snippets Groups Projects
ansible_version.yml 1.06 KiB
Newer Older
  • Learn to ignore specific revisions
  • ---
    - hosts: localhost
      gather_facts: false
      become: no
      vars:
    
        minimal_ansible_version: 2.11.0
    
        maximal_ansible_version: 2.13.0
    
        ansible_connection: local
    
        - name: "Check {{ minimal_ansible_version }} <= Ansible version < {{ maximal_ansible_version }}"
    
            msg: "Ansible must be between {{ minimal_ansible_version }} and {{ maximal_ansible_version }} exclusive"
    
            that:
              - ansible_version.string is version(minimal_ansible_version, ">=")
    
              - ansible_version.string is version(maximal_ansible_version, "<")
    
    
        - name: "Check that python netaddr is installed"
          assert:
            msg: "Python netaddr is not present"
            that: "'127.0.0.1' | ipaddr"
          tags:
            - check
    
        # CentOS 7 provides too old jinja version
        - name: "Check that jinja is not too old (install via pip)"
          assert:
            msg: "Your Jinja version is too old, install via pip"
            that: "{% set test %}It works{% endset %}{{ test == 'It works' }}"
          tags:
            - check