Skip to content

Commit

Permalink
[ALIEN-3657] Parameter to install ansible with yum or with pip
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDuru committed Apr 28, 2021
1 parent 3d40410 commit bb44700
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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
33 changes: 17 additions & 16 deletions playbooks/roles/yorc/install-dependencies/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,45 +13,38 @@
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
update_cache: true
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:
name: "pip"
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:
Expand All @@ -66,15 +59,23 @@
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:
name: "ansible{{ yorc_ansible_version }}"
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:
Expand Down

0 comments on commit bb44700

Please sign in to comment.