浏览代码

uninstall ansible when version is older then 2.10

master
父节点
当前提交
5ac0278164
共有 2 个文件被更改,包括 14 次插入0 次删除
  1. +13
    -0
      tasks/ansible.yaml
  2. +1
    -0
      vars/main.yaml

+ 13
- 0
tasks/ansible.yaml 查看文件

@@ -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 查看文件

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

正在加载...
取消
保存