From bb44700ec5ce6ce75a9ca9fca32a36787b24c5db Mon Sep 17 00:00:00 2001 From: Emmanuel Duru Date: Wed, 28 Apr 2021 16:24:37 +0200 Subject: [PATCH] [ALIEN-3657] Parameter to install ansible with yum or with pip --- .../install-dependencies/defaults/main.yml | 1 + .../yorc/install-dependencies/tasks/main.yml | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/playbooks/roles/yorc/install-dependencies/defaults/main.yml b/playbooks/roles/yorc/install-dependencies/defaults/main.yml index 59d4a55..99a24f1 100644 --- a/playbooks/roles/yorc/install-dependencies/defaults/main.yml +++ b/playbooks/roles/yorc/install-dependencies/defaults/main.yml @@ -1,3 +1,4 @@ yorc_ansible_version: "==2.7.2" # some extra args can be passed to pip #pip_extra_args: +install_ansible_with_pip: true diff --git a/playbooks/roles/yorc/install-dependencies/tasks/main.yml b/playbooks/roles/yorc/install-dependencies/tasks/main.yml index 12b97e6..7022ce5 100644 --- a/playbooks/roles/yorc/install-dependencies/tasks/main.yml +++ b/playbooks/roles/yorc/install-dependencies/tasks/main.yml @@ -4,7 +4,7 @@ offline: false when: offline is not defined -- name: Instal epel-release +- name: Install epel-release yum: pkg: epel-release state: present @@ -13,7 +13,7 @@ when: (not offline) and (not ((dont_install_epel is defined) and (dont_install_epel))) ignore_errors: yes -- name: Instal python +- name: Install python yum: pkg: python3 state: present @@ -21,21 +21,13 @@ become: true when: (not offline) -- name: Instal python pip +- name: Install python pip yum: pkg: python3-pip state: present update_cache: true become: true - when: (not offline) - -- name: Link pip3 to pip - alternatives: - name: pip - link: /usr/bin/pip - path: /usr/bin/pip3 - become: true - when: (not offline) + when: (not offline and install_ansible_with_pip) - name: Upgrade pip using pip pip: @@ -43,15 +35,16 @@ executable: pip3 state: latest become: true - when: (not offline and pip_extra_args is not defined) + when: (not offline and pip_extra_args is not defined and install_ansible_with_pip) - name: Upgrade pip using pip (with extra args) pip: name: "pip" + executable: pip3 state: latest extra_args: "{{ pip_extra_args }}" become: true - when: (not offline and pip_extra_args is defined) + when: (not offline and pip_extra_args is defined and install_ansible_with_pip) # - name: Change pip config # template: @@ -66,7 +59,7 @@ name: "ansible{{ yorc_ansible_version }}" executable: pip3 become: true - when: (not offline and pip_extra_args is not defined) + when: (not offline and pip_extra_args is not defined and install_ansible_with_pip) - name: Install ansible using pip (with extra args) pip: @@ -74,7 +67,15 @@ executable: pip3 extra_args: "{{ pip_extra_args }}" become: true - when: (not offline and pip_extra_args is defined) + when: (not offline and pip_extra_args is defined and install_ansible_with_pip) + +- name: Install ansible using yum + yum: + pkg: ansible + state: present + update_cache: true + become: true + when: (not offline and not install_ansible_with_pip) # - name: Instal the needed package # yum: