diff --git a/defaults/main.yaml b/defaults/main.yaml index d25d4d2..de0eca4 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -1,4 +1,13 @@ +ansible_version: 5.0.1 +ansible_pip_package: ansible + ansible_use_ara: false +ansible_ara_version: 1.5.7 +ansible_ara_pip_package: ara + ansible_use_mitogen: false +ansible_mitogen_version: 0.3.0 +ansible_mitogen_pip_package: mitogen + ansible_with_ovh_module: false ansible_use_ssh_pipelining: true diff --git a/tasks/ansible.yaml b/tasks/ansible.yaml index 124c26c..47cb238 100644 --- a/tasks/ansible.yaml +++ b/tasks/ansible.yaml @@ -1,20 +1,6 @@ --- -- 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 - state: latest - executable: pip3 + name: "{{ansible_pip_package}}" + version: "{{ansible_version}}" diff --git a/tasks/ara.yaml b/tasks/ara.yaml index e6179d0..6507255 100644 --- a/tasks/ara.yaml +++ b/tasks/ara.yaml @@ -2,9 +2,8 @@ - name: ara pip package pip: - name: ara - state: present - executable: pip3 + name: "{{ansible_ara_pip_package}}" + version: "{{ansible_ara_version}}" - name: get ara location shell: python3 -c "import os,ara; print(os.path.dirname(ara.__file__))" diff --git a/tasks/cleanup.yaml b/tasks/cleanup.yaml index cfbc573..90d3bc1 100644 --- a/tasks/cleanup.yaml +++ b/tasks/cleanup.yaml @@ -18,3 +18,15 @@ state: absent executable: pip3 when: not ansible_use_mitogen + +- 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 + when: ansible_installed_version is version('2.10', '<') diff --git a/tasks/mitogen.yaml b/tasks/mitogen.yaml index b6d3657..1078e37 100644 --- a/tasks/mitogen.yaml +++ b/tasks/mitogen.yaml @@ -2,9 +2,8 @@ - name: mitogen pip package pip: - name: mitogen - state: latest - executable: pip3 + name: "{{ansible_mitogen_pip_package}}" + version: "{{ansible_mitogen_version}}" - name: get ansible_mitogen location shell: python3 -c "import os,ansible_mitogen; print(os.path.dirname(ansible_mitogen.__file__))"