Expand pip options for boto3 install

This brings the role more inline with other windmill roles.

Change-Id: Ib97bdae004fd7fcbe4b06564d88423f64e5b2bca
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2020-05-01 12:07:34 -04:00
parent fdd90ed6cf
commit 1387bf009f
4 changed files with 70 additions and 9 deletions

View File

@ -25,8 +25,8 @@
- job:
name: ansible-role-boto3-src
parent: ansible-role-boto3-base
vars:
boto3_install_method: git
# vars:
# boto3_install_method: git
- job:
name: ansible-role-boto3-src-fedora-latest

View File

@ -28,5 +28,13 @@ boto3_file_credentials_mode: 0640
boto3_file_credentials_owner: "{{ boto3_user_name }}"
boto3_file_credentials_src: root/.aws/credentials.j2
boto3_install_method: pip
boto3_pip_name: boto3
# boto3_pip_virtualenv: /root/venv
# boto3_pip_executable:
# boto3_pip_editable:
# boto3_pip_extra_args:
# boto3_pip_version:
# boto3_pip_virtualenv_python
# boto3_pip_virtualenv:
# boto3_pip_virtualenv_symlink:

View File

@ -12,9 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Install boto3 using pip
become: true
become_user: "{{ boto3_user_name }}"
pip:
name: "{{ boto3_pip_name }}"
virtualenv: "{{ boto3_pip_virtualenv|default(omit) }}"
- name: Define boto3_pip_executable if needed
set_fact:
boto3_pip_executable: pip3
when:
- boto3_install_method == 'git' or boto3_install_method == 'pip'
- boto3_pip_virtualenv_python is not defined
- boto3_pip_executable is not defined
- include: "install/{{ boto3_install_method }}.yaml"

50
tasks/install/pip.yaml Normal file
View File

@ -0,0 +1,50 @@
# Copyright 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Install boto3 using pip
become: true
pip:
executable: "{{ boto3_pip_executable|default(omit) }}"
editable : "{{ boto3_pip_editable|default(omit) }}"
extra_args: "{{ boto3_pip_extra_args|default(omit) }}"
name: "{{ boto3_pip_name }}"
version: "{{ boto3_pip_version|default(omit) }}"
virtualenv_python: "{{ boto3_pip_virtualenv_python|default(omit) }}"
virtualenv: "{{ boto3_pip_virtualenv|default(omit) }}"
- name: Stat boto3_pip_virtualenv_symlink
stat:
path: "{{ boto3_pip_virtualenv_symlink | dirname }}"
register: r
when: boto3_pip_virtualenv_symlink is defined
- name: Create boto3_pip_virtualenv_symlink directory
become: true
file:
state: directory
path: "{{ boto3_pip_virtualenv_symlink | dirname }}"
when:
- boto3_pip_virtualenv_symlink is defined
- not r.stat.exists
- name: Symlink boto3 virtualenv
become: true
file:
dest: "{{ boto3_pip_virtualenv_symlink }}"
src: "{{ boto3_pip_virtualenv }}"
state: link
when:
- boto3_pip_virtualenv is defined
- boto3_pip_virtualenv_symlink is defined
- boto3_pip_virtualenv != boto3_pip_virtualenv_symlink