Compare commits

...

53 Commits

Author SHA1 Message Date
Jeff Geerling
d5d1d2e4dd
Merge pull request #64 from dmotte/pr-fix-executable-virtualenv
Omit executable if item.virtualenv is defined
2024-03-09 13:59:21 -06:00
dmotte
105436e80f Omit executable if item.virtualenv is defined 2024-03-09 14:01:37 +01:00
Jeff Geerling
59700c8f1f Bump CI workflow versions. 2024-01-24 22:51:24 -06:00
Jeff Geerling
69ce0d8149 Getting a version number changes nothing. 2024-01-24 22:48:16 -06:00
Jeff Geerling
f120430ad6 Make local dev with molecule a little easier. 2024-01-24 22:06:46 -06:00
Jeff Geerling
adac76a28c
Merge pull request #63 from blakeashleyjr/patch-1
Update README.md to fix single-letter typo
2023-11-27 22:11:48 -06:00
Blake Ashley
fcc23775fe
Update README.md to fix single-letter typo
Correct packge to package
2023-11-27 17:24:07 -08:00
Jeff Geerling
832e5ce6ed
Merge pull request #62 from zloveless/hack/deb12-externally-managed
Check major version before trying to remove externally managed.
2023-10-29 15:05:25 -05:00
Zack Lovelelss
6c927a7881 Check major version before trying to remove externally managed. 2023-10-28 03:59:33 +00:00
Jeff Geerling
13c187c5f8 PR #58 follow-up. 2023-10-20 20:58:08 -05:00
Jeff Geerling
160021b3d5
Merge pull request #58 from barnabasbusa/master
fix: remove EXERTNALLY-MANAGED on Debian12
2023-10-20 20:51:14 -05:00
Barnabas Busa
7886617de5
bump actions versions, as they dropping support soon 2023-08-11 10:34:25 +02:00
Barnabas Busa
9de8ba5c86
bump actions versions, as they dropping support soon 2023-08-11 10:32:40 +02:00
Barnabas Busa
12de34e3a9
fix yamllint 2023-08-11 10:27:36 +02:00
Barnabas Busa
088273d11b
move the external managed task into a subtask, update ci to run newer images 2023-08-11 10:24:46 +02:00
Barnabas Busa
2aef145841
fix: remove EXERTNALLY-MANAGED on Debian12 2023-08-07 15:22:46 +02:00
Jeff Geerling
65c354cc65 Stale bot is now Stale GitHub Action. 2023-07-10 17:48:41 -05:00
Jeff Geerling
641cee6b62 Remove official support for RHEL. Rocky/Alma/Stream support is best-effort. 2023-06-23 10:57:26 -05:00
Jeff Geerling
2cd2805307 Fix Molecule CI workflow since docker plugin has moved. 2023-04-20 17:28:14 -05:00
Jeff Geerling
456566abab Fix Molecule CI workflow for Ubuntu 22.04 GitHub Actions. 2022-12-06 18:24:34 -06:00
Jeff Geerling
0360ca42ee
Merge pull request #48 from speechmatics/extra-args
Add support for extra_args
2022-08-25 15:23:44 -05:00
David Gray
21455b6dba Add support for extra_args
'extra_args' has been available since 1.0 of ansible.builtin and this
module already uses 'executable' which was added in 1.3 so this should
be perfectly safe to add.
2022-08-25 15:14:14 +01:00
Jeff Geerling
248ac65fbb Add role_name_check skipping to all molecule test suites. 2022-06-01 22:21:33 -05:00
Jeff Geerling
3dea9f6772 Update release workflow for more consistency. 2021-12-27 11:36:00 -06:00
Jeff Geerling
6e819c0e97 Make sure bugs aren't automatically closed. 2021-08-23 08:54:12 -05:00
Jeff Geerling
eab20180c2 Switch to Rocky Linux 8 for RHEL-like tests. 2021-07-02 10:00:06 -05:00
Jeff Geerling
c935c92c04
Merge pull request #43 from NiftyMist/typo-fix
corrected typo in readme
2021-05-29 17:17:57 -05:00
Jeff Geerling
5f4ab60283
Merge pull request #42 from fgierlinger/patch-1
Migrating from with_X to loop
2021-05-29 17:17:43 -05:00
Jeff Geerling
24aff0960e Remove ansible-lint from roles. 2021-03-15 09:29:19 -05:00
Jeff Geerling
c44d7cd4da Make ansible-lint work again. 2021-02-22 16:16:26 -06:00
Dylan Mitchell
04add7b4c5 corrected typo in readme 2021-02-08 06:39:38 -05:00
fgierlinger
f5212246e6
Migrating from with_X to loop
Fixes #36
2021-01-26 21:58:56 +01:00
Jeff Geerling
fd6d58a571 Dump Travis CI and move to GitHub Actions. 2020-11-05 15:53:20 -06:00
Jeff Geerling
8bafb13646 Switch to travis-ci.com. 2020-10-26 20:12:04 -05:00
Jeff Geerling
5ec66573d5 Make sure docker driver is installed with molecule. 2020-10-15 17:05:49 -05:00
Jeff Geerling
a2c8e54a56 Ignore the tyranny of ansible-lint rule 106. 2020-08-20 19:23:53 -05:00
Jeff Geerling
81ac0c6238 Upgrade Travis CI docker version to fix Molecule tests. 2020-08-12 14:56:51 -05:00
Jeff Geerling
f748c258b6 PR #30 follow-up: Default to python3-pip. 2020-07-22 12:01:53 -05:00
Jeff Geerling
87d185606e
Merge pull request #30 from fgierlinger/master
Add support for centos8
2020-07-22 11:55:46 -05:00
fgierlinger
212fff0df3 galaxy: add Centos 8 and 7 to supported platforms 2020-05-17 20:25:28 +02:00
fgierlinger
080746e32a Include OS specific variables
The package naming for pip has changed in centos8. Previously the pip
package was called python-pip for python2 and python3-pip for python3.
In CentOS 8 the packages are now called python2-pip for python2 ad
python3-pip for python3.
2020-05-17 20:25:28 +02:00
fgierlinger
b348af1dcb Add centos8 to travis build matrix 2020-04-24 18:46:45 +02:00
Jeff Geerling
ca07424814 Add probot/stale configuration to repository for stale issues. 2020-03-05 10:45:47 -06:00
Jeff Geerling
56f900dbb6 Make sure molecule lint script has set -e option. 2020-02-24 09:46:12 -06:00
Jeff Geerling
cee6952975 Update molecule configuration to work with 3.0. 2020-02-20 15:56:01 -06:00
Jeff Geerling
bf2faee13d Update molecule configuration to work with 3.0. 2020-02-20 14:30:12 -06:00
Jeff Geerling
210c71981b Update molecule configuration to work with 3.0. 2020-02-20 14:24:10 -06:00
Jeff Geerling
020cbad256 YAML syntax fix. 2019-12-11 10:40:04 -06:00
Jeff Geerling
01d46fa4b9
Create FUNDING.yml 2019-12-11 09:50:08 -06:00
Jeff Geerling
ea930cc060 PR #19 follow-up: Adjust license field to read 'MIT'. 2019-10-23 09:59:49 -05:00
Jeff Geerling
6b7c9941ef
Merge pull request #19 from ericsysmin/patch-1
Added role name as galaxy wants now
2019-10-23 09:58:58 -05:00
Jeff Geerling
6e93443a3f Remove unused tests. 2019-05-16 22:22:59 -05:00
Eric Anderson
9549761093
Added role name as galaxy wants now 2018-11-11 10:26:37 -08:00
16 changed files with 208 additions and 71 deletions

3
.ansible-lint Normal file
View File

@ -0,0 +1,3 @@
skip_list:
- 'yaml'
- 'role-name'

4
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,4 @@
# These are supported funding model platforms
---
github: geerlingguy
patreon: geerlingguy

71
.github/workflows/ci.yml vendored Normal file
View File

@ -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 }}

40
.github/workflows/release.yml vendored Normal file
View File

@ -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)

34
.github/workflows/stale.yml vendored Normal file
View File

@ -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 }}

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
*.retry *.retry
*/__pycache__ */__pycache__
*.pyc *.pyc
.cache

View File

@ -1,29 +0,0 @@
---
language: python
services: docker
env:
global:
- ROLE_NAME: pip
matrix:
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: fedora29
- MOLECULE_DISTRO: ubuntu1804
- MOLECULE_DISTRO: debian9
install:
# Install test dependencies.
- pip install molecule docker
before_script:
# Use actual Ansible Galaxy role name for the project directory.
- cd ../
- mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME
- cd geerlingguy.$ROLE_NAME
script:
# Run tests.
- molecule test
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -1,6 +1,10 @@
--- ---
extends: default extends: default
rules: rules:
line-length: line-length:
max: 120 max: 120
level: warning level: warning
ignore: |
.github/workflows/stale.yml

View File

@ -1,6 +1,6 @@
# Ansible Role: Pip (for Python) # 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. An Ansible Role that installs [Pip](https://pip.pypa.io) on Linux.
@ -12,11 +12,11 @@ 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`): 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: 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`. 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`.
@ -39,7 +39,7 @@ A list of packages to install with pip. Examples below:
- name: docker - name: docker
state: absent state: absent
# Or update a package ot the latest version. # Or update a package to the latest version.
- name: docker - name: docker
state: latest state: latest
@ -51,6 +51,10 @@ A list of packages to install with pip. Examples below:
- name: docker - name: docker
virtualenv: /my_app/venv 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 ## Dependencies
None. None.

View File

@ -1,6 +1,6 @@
--- ---
# For Python 3, use python3-pip. # 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_executable: "{{ 'pip3' if pip_package.startswith('python3') else 'pip' }}"
pip_install_packages: [] pip_install_packages: []

View File

@ -2,16 +2,14 @@
dependencies: [] dependencies: []
galaxy_info: galaxy_info:
role_name: pip
author: geerlingguy author: geerlingguy
description: Pip (Python package manager) for Linux. description: Pip (Python package manager) for Linux.
issue_tracker_url: https://github.com/geerlingguy/ansible-role-pip/issues issue_tracker_url: https://github.com/geerlingguy/ansible-role-pip/issues
company: "Midwestern Mac, LLC" company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)" license: "MIT"
min_ansible_version: 2.0 min_ansible_version: 2.10
platforms: platforms:
- name: EL
versions:
- all
- name: Fedora - name: Fedora
versions: versions:
- all - all

View File

@ -16,5 +16,13 @@
apt: update_cache=true cache_valid_time=600 apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian' 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: roles:
- role: geerlingguy.pip - role: geerlingguy.pip

View File

@ -1,29 +1,21 @@
--- ---
role_name_check: 1
dependency: dependency:
name: galaxy name: galaxy
options:
ignore-errors: true
driver: driver:
name: docker name: docker
lint:
name: yamllint
options:
config-file: molecule/default/yaml-lint.yml
platforms: platforms:
- name: instance - name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux8}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""} command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true privileged: true
pre_build_image: true pre_build_image: true
provisioner: provisioner:
name: ansible name: ansible
lint:
name: ansible-lint
playbooks: playbooks:
converge: ${MOLECULE_PLAYBOOK:-playbook.yml} converge: ${MOLECULE_PLAYBOOK:-converge.yml}
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8

View File

@ -1,14 +0,0 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_hosts_file(host):
f = host.file('/etc/hosts')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'

13
tasks/debian12.yml Normal file
View File

@ -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

View File

@ -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. - name: Ensure Pip is installed.
package: package:
name: "{{ pip_package }}" name: "{{ pip_package }}"
@ -10,5 +16,6 @@
version: "{{ item.version | default(omit) }}" version: "{{ item.version | default(omit) }}"
virtualenv: "{{ item.virtualenv | default(omit) }}" virtualenv: "{{ item.virtualenv | default(omit) }}"
state: "{{ item.state | default(omit) }}" state: "{{ item.state | default(omit) }}"
executable: "{{ pip_executable }}" extra_args: "{{ item.extra_args | default(omit) }}"
with_items: "{{ pip_install_packages }}" executable: "{{ item.virtualenv | default(false) | ternary(omit, pip_executable) }}"
loop: "{{ pip_install_packages }}"