Browse Source

uninstall ansible when version is older then 2.10

master
parent
commit
5ac0278164
2 changed files with 14 additions and 0 deletions
  1. +13
    -0
      tasks/ansible.yaml
  2. +1
    -0
      vars/main.yaml

+ 13
- 0
tasks/ansible.yaml View File

@@ -1,5 +1,18 @@
---

- name: check version of ansible
shell: pip3 show ansible | grep Version | cut -d ' ' -f 2
ignore_errors: true
changed_when: false
register: get_ansible_version

- name: old ansible pip package removed
pip:
name: ansible
state: absent
executable: pip3
when: "{{ ansible_installed_version is version('2.10', '<') }}"

- name: ansible pip package
pip:
name: ansible


+ 1
- 0
vars/main.yaml View File

@@ -0,0 +1 @@
ansible_installed_version: "{% if get_ansible_version.stdout != '' %}{{get_ansible_version.stdout}}{% else %}0{% endif %}"

Loading…
Cancel
Save