Compare commits
67 Commits
Author | SHA1 | Date |
---|---|---|
Jeff Geerling | d5d1d2e4dd | |
dmotte | 105436e80f | |
Jeff Geerling | 59700c8f1f | |
Jeff Geerling | 69ce0d8149 | |
Jeff Geerling | f120430ad6 | |
Jeff Geerling | adac76a28c | |
Blake Ashley | fcc23775fe | |
Jeff Geerling | 832e5ce6ed | |
Zack Lovelelss | 6c927a7881 | |
Jeff Geerling | 13c187c5f8 | |
Jeff Geerling | 160021b3d5 | |
Barnabas Busa | 7886617de5 | |
Barnabas Busa | 9de8ba5c86 | |
Barnabas Busa | 12de34e3a9 | |
Barnabas Busa | 088273d11b | |
Barnabas Busa | 2aef145841 | |
Jeff Geerling | 65c354cc65 | |
Jeff Geerling | 641cee6b62 | |
Jeff Geerling | 2cd2805307 | |
Jeff Geerling | 456566abab | |
Jeff Geerling | 0360ca42ee | |
David Gray | 21455b6dba | |
Jeff Geerling | 248ac65fbb | |
Jeff Geerling | 3dea9f6772 | |
Jeff Geerling | 6e819c0e97 | |
Jeff Geerling | eab20180c2 | |
Jeff Geerling | c935c92c04 | |
Jeff Geerling | 5f4ab60283 | |
Jeff Geerling | 24aff0960e | |
Jeff Geerling | c44d7cd4da | |
Dylan Mitchell | 04add7b4c5 | |
fgierlinger | f5212246e6 | |
Jeff Geerling | fd6d58a571 | |
Jeff Geerling | 8bafb13646 | |
Jeff Geerling | 5ec66573d5 | |
Jeff Geerling | a2c8e54a56 | |
Jeff Geerling | 81ac0c6238 | |
Jeff Geerling | f748c258b6 | |
Jeff Geerling | 87d185606e | |
fgierlinger | 212fff0df3 | |
fgierlinger | 080746e32a | |
fgierlinger | b348af1dcb | |
Jeff Geerling | ca07424814 | |
Jeff Geerling | 56f900dbb6 | |
Jeff Geerling | cee6952975 | |
Jeff Geerling | bf2faee13d | |
Jeff Geerling | 210c71981b | |
Jeff Geerling | 020cbad256 | |
Jeff Geerling | 01d46fa4b9 | |
Jeff Geerling | ea930cc060 | |
Jeff Geerling | 6b7c9941ef | |
Jeff Geerling | 6e93443a3f | |
Eric Anderson | 9549761093 | |
Jeff Geerling | b2ef2b4251 | |
Jeff Geerling | 87179db548 | |
Viacheslav Ostroukh | a990947391 | |
Jeff Geerling | 4f1df0268e | |
Jeff Geerling | 8aea90ab72 | |
Jeff Geerling | dd8eedb7e6 | |
Jeff Geerling | 0717b46dc2 | |
Michael Porter | 0f8b8f32ee | |
Michael Porter | f4faa4d451 | |
Michael Porter | cffcf33bd2 | |
Michael Porter | 4dcb2b5ecf | |
Michael Porter | 69add2c5f0 | |
Jeff Geerling | 8435521e92 | |
Jeff Geerling | 82e1246958 |
|
@ -0,0 +1,3 @@
|
|||
skip_list:
|
||||
- 'yaml'
|
||||
- 'role-name'
|
|
@ -0,0 +1,4 @@
|
|||
# These are supported funding model platforms
|
||||
---
|
||||
github: geerlingguy
|
||||
patreon: geerlingguy
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
name: CI
|
||||
'on':
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
- cron: "0 4 * * 5"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: 'geerlingguy.pip'
|
||||
|
||||
jobs:
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the codebase.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: 'geerlingguy.pip'
|
||||
|
||||
- name: Set up Python 3.
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install test dependencies.
|
||||
run: pip3 install yamllint
|
||||
|
||||
- name: Lint code.
|
||||
run: |
|
||||
yamllint .
|
||||
|
||||
molecule:
|
||||
name: Molecule
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
distro:
|
||||
- rockylinux9
|
||||
- rockylinux8
|
||||
- fedora39
|
||||
- ubuntu2204
|
||||
- ubuntu2004
|
||||
- debian12
|
||||
- debian11
|
||||
|
||||
steps:
|
||||
- name: Check out the codebase.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: 'geerlingguy.pip'
|
||||
|
||||
- name: Set up Python 3.
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install test dependencies.
|
||||
run: pip3 install ansible molecule molecule-plugins[docker] docker
|
||||
|
||||
- name: Run Molecule tests.
|
||||
run: molecule test
|
||||
env:
|
||||
PY_COLORS: '1'
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
||||
MOLECULE_DISTRO: ${{ matrix.distro }}
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
|
||||
# repository or organization.
|
||||
#
|
||||
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
|
||||
# See: https://github.com/ansible/galaxy/issues/46
|
||||
|
||||
name: Release
|
||||
'on':
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: 'geerlingguy.pip'
|
||||
|
||||
jobs:
|
||||
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the codebase.
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'geerlingguy.pip'
|
||||
|
||||
- name: Set up Python 3.
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Ansible.
|
||||
run: pip3 install ansible-core
|
||||
|
||||
- name: Trigger a new import on Galaxy.
|
||||
run: >-
|
||||
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
|
||||
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
name: Close inactive issues
|
||||
'on':
|
||||
schedule:
|
||||
- cron: "55 21 * * 5" # semi-random time
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v8
|
||||
with:
|
||||
days-before-stale: 120
|
||||
days-before-close: 60
|
||||
exempt-issue-labels: bug,pinned,security,planned
|
||||
exempt-pr-labels: bug,pinned,security,planned
|
||||
stale-issue-label: "stale"
|
||||
stale-pr-label: "stale"
|
||||
stale-issue-message: |
|
||||
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||
close-issue-message: |
|
||||
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||
stale-pr-message: |
|
||||
This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||
close-pr-message: |
|
||||
This pr has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,2 +1,5 @@
|
|||
*.retry
|
||||
tests/test.sh
|
||||
*/__pycache__
|
||||
*.pyc
|
||||
.cache
|
||||
|
||||
|
|
29
.travis.yml
29
.travis.yml
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
services: docker
|
||||
|
||||
env:
|
||||
- distro: centos7
|
||||
- distro: fedora27
|
||||
- distro: ubuntu1604
|
||||
- distro: ubuntu1404
|
||||
- distro: debian9
|
||||
- distro: debian8
|
||||
|
||||
script:
|
||||
# Configure test script so we can run extra tests after playbook is run.
|
||||
- export container_id=$(date +%s)
|
||||
- export cleanup=false
|
||||
|
||||
# Download test shim.
|
||||
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
|
||||
- chmod +x ${PWD}/tests/test.sh
|
||||
|
||||
# Run tests.
|
||||
- ${PWD}/tests/test.sh
|
||||
|
||||
# Test whether packages are installed as specified.
|
||||
- docker exec --tty ${container_id} pip list installed | grep -e '^ipaddress.*1\.0\.18.*$'
|
||||
- docker exec --tty ${container_id} pip list installed | grep '^colorama'
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 120
|
||||
level: warning
|
||||
|
||||
ignore: |
|
||||
.github/workflows/stale.yml
|
16
README.md
16
README.md
|
@ -1,6 +1,6 @@
|
|||
# Ansible Role: Pip (for Python)
|
||||
|
||||
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-pip.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-pip)
|
||||
[![CI](https://github.com/geerlingguy/ansible-role-pip/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-pip/actions?query=workflow%3ACI)
|
||||
|
||||
An Ansible Role that installs [Pip](https://pip.pypa.io) on Linux.
|
||||
|
||||
|
@ -12,9 +12,13 @@ On RedHat/CentOS, you may need to have EPEL installed before running this role.
|
|||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
pip_package: python-pip
|
||||
pip_package: python3-pip
|
||||
|
||||
The name of the packge to install to get `pip` on the system. You can set to `python3-pip`, for example, when using Python 3 on Ubuntu.
|
||||
The name of the package to install to get `pip` on the system. For older systems that don't have Python 3 available, you can set this to `python-pip`.
|
||||
|
||||
pip_executable: pip3
|
||||
|
||||
The role will try to autodetect the pip executable based on the `pip_package` (e.g. `pip` for Python 2 and `pip3` for Python 3). You can also override this explicitly, e.g. `pip_executable: pip3.6`.
|
||||
|
||||
pip_install_packages: []
|
||||
|
||||
|
@ -35,7 +39,7 @@ A list of packages to install with pip. Examples below:
|
|||
- name: docker
|
||||
state: absent
|
||||
|
||||
# Or update a package ot the latest version.
|
||||
# Or update a package to the latest version.
|
||||
- name: docker
|
||||
state: latest
|
||||
|
||||
|
@ -47,6 +51,10 @@ A list of packages to install with pip. Examples below:
|
|||
- name: docker
|
||||
virtualenv: /my_app/venv
|
||||
|
||||
# Or pass through any extra arguments.
|
||||
- name: my_special_package_from_my_special_repo
|
||||
extra_args: --extra-index-url https://my-domain/pypi/pypi-master/simple
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
# For Python 3, use python3-pip.
|
||||
pip_package: python-pip
|
||||
pip_package: python3-pip
|
||||
pip_executable: "{{ 'pip3' if pip_package.startswith('python3') else 'pip' }}"
|
||||
|
||||
pip_install_packages: []
|
||||
|
|
|
@ -2,28 +2,27 @@
|
|||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
role_name: pip
|
||||
author: geerlingguy
|
||||
description: Pip (Python package manager) for Linux.
|
||||
issue_tracker_url: https://github.com/geerlingguy/ansible-role-pip/issues
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 2.0
|
||||
license: "MIT"
|
||||
min_ansible_version: 2.10
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
- name: Fedora
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- name: Fedora
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- system
|
||||
- server
|
||||
- packaging
|
||||
- python
|
||||
- tools
|
||||
- pip
|
||||
- tools
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
|
||||
vars:
|
||||
pip_install_packages:
|
||||
# Test installing a specific version of a package.
|
||||
- name: ipaddress
|
||||
version: "1.0.18"
|
||||
# Test installing a package by name.
|
||||
- colorama
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=true cache_valid_time=600
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Set package name for older OSes.
|
||||
set_fact:
|
||||
pip_package: python-pip
|
||||
when: >
|
||||
(ansible_os_family == 'RedHat') and (ansible_distribution_major_version | int < 8)
|
||||
or (ansible_distribution == 'Debian') and (ansible_distribution_major_version | int < 10)
|
||||
or (ansible_distribution == 'Ubuntu') and (ansible_distribution_major_version | int < 18)
|
||||
|
||||
roles:
|
||||
- role: geerlingguy.pip
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
role_name_check: 1
|
||||
dependency:
|
||||
name: galaxy
|
||||
options:
|
||||
ignore-errors: true
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: instance
|
||||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux8}-ansible:latest"
|
||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||
cgroupns_mode: host
|
||||
privileged: true
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
# Remove EXTERNALLY-MANAGED file if we're on Debian12
|
||||
# Related issue: https://github.com/geerlingguy/ansible-role-pip/issues/57
|
||||
- name: Get python3 version installed
|
||||
ansible.builtin.command: python3 --version
|
||||
register: py3ver
|
||||
changed_when: false
|
||||
|
||||
- name: Remove EXTERNALLY-MANAGED
|
||||
ansible.builtin.file:
|
||||
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
|
||||
state: absent
|
||||
when: py3ver is defined and py3ver.stdout.find("3.11") != -1
|
|
@ -1,4 +1,10 @@
|
|||
---
|
||||
- name: Remove externally managed from Debian 12
|
||||
ansible.builtin.import_tasks: debian12.yml
|
||||
when:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version|int >= 12
|
||||
|
||||
- name: Ensure Pip is installed.
|
||||
package:
|
||||
name: "{{ pip_package }}"
|
||||
|
@ -10,4 +16,6 @@
|
|||
version: "{{ item.version | default(omit) }}"
|
||||
virtualenv: "{{ item.virtualenv | default(omit) }}"
|
||||
state: "{{ item.state | default(omit) }}"
|
||||
with_items: "{{ pip_install_packages }}"
|
||||
extra_args: "{{ item.extra_args | default(omit) }}"
|
||||
executable: "{{ item.virtualenv | default(false) | ternary(omit, pip_executable) }}"
|
||||
loop: "{{ pip_install_packages }}"
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Ansible Role tests
|
||||
|
||||
To run the test playbook(s) in this directory:
|
||||
|
||||
1. Install and start Docker.
|
||||
1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`:
|
||||
- `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/`
|
||||
1. Make the test shim executable: `chmod +x tests/test.sh`.
|
||||
1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh`
|
||||
|
||||
If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)`
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
- hosts: all
|
||||
|
||||
vars:
|
||||
pip_install_packages:
|
||||
# Test installing a specific version of a package.
|
||||
- name: ipaddress
|
||||
version: "1.0.18"
|
||||
# Test installing a package by name.
|
||||
- colorama
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=600
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
roles:
|
||||
- role_under_test
|
Loading…
Reference in New Issue