buluma.update_pip_packages

Ansible Role update_pip_packages

This role helps you to find and update pip packages.

GitHub Version Issues Pull Requests Downloads
github Version Issues PullRequests Ansible Role

Example Playbook

Here's an example you can use, taken from molecule/default/converge.yml. It is tested on every push, pull request, and release.

---
- name: converge
  hosts: all
  become: true
  gather_facts: true

  pre_tasks:
    - name: Update apt cache.
      apt: update_cache=yes cache_valid_time=600
      when: ansible_os_family == 'Debian'
      changed_when: false

    - name: Check if python3.11 EXTERNALLY-MANAGED file exists
      ansible.builtin.stat:
        path: /usr/lib/python3.11/EXTERNALLY-MANAGED
      register: externally_managed_file_py311

    - name: Rename python3.11 EXTERNALLY-MANAGED file if it exists
      ansible.builtin.command:
        cmd: mv /usr/lib/python3.11/EXTERNALLY-MANAGED /usr/lib/python3.11/EXTERNALLY-MANAGED.old
      when: externally_managed_file_py311.stat.exists
      args:
        creates: /usr/lib/python3.11/EXTERNALLY-MANAGED.old

    - name: Check if python3.12 EXTERNALLY-MANAGED file exists
      ansible.builtin.stat:
        path: /usr/lib/python3.12/EXTERNALLY-MANAGED
      register: externally_managed_file_py312

    - name: Rename python3.12 EXTERNALLY-MANAGED file if it exists
      ansible.builtin.command:
        cmd: mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.old
      when: externally_managed_file_py312.stat.exists
      args:
        creates: /usr/lib/python3.12/EXTERNALLY-MANAGED.old

  roles:
    - role: buluma.update_pip_packages
      update_pip_package_ignore:
        - libcomps
        - PyGObject
        - pygobject
        - pyxdg
        - resolvelib
        - dbus-python
        - setuptools

Before running this, make sure your machine is prepared. In CI, this is done using molecule/default/prepare.yml:

---
- name: prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: buluma.bootstrap
    - role: buluma.epel
    - role: buluma.buildtools
    - role: buluma.python_pip
      python_pip_modules:
        - name: ansible

You can also find a full explanation and example on how to use these roles.

Role Variables

Default values for the variables can be found in defaults/main.yml:

---
# defaults file for update_pip_packages

# A list of pip executables that will be used to get the packages.
# Full path or just the name of the executable.
# This role finds pip and pip3 installations, but you can add custom executables here.
update_pip_packages_clients: []

# You can specify a list of packages to ignore. Packages listed here won’t be updated.
# update_pip_package_ignore:
#   - some_pip_package

Requirements

State of Used Roles

These roles help to prepare a system. You can use other methods to prepare your system.

Requirement GitHub Version
buluma.bootstrap Ansible Molecule Version
buluma.epel Ansible Molecule Version
buluma.python_pip Ansible Molecule Version
buluma.buildtools Ansible Molecule Version

Context

This role is part of many compatible roles. You can check the documentation of these roles for further details.

Here’s a look at the related roles:

dependencies

Compatibility

This role has been tested with these container images:

Container Tags
Debian all
EL 8
Fedora all
opensuse all

You need at least Ansible version 2.12. Tests have been carried out on:

  • The previous version.
  • The current version.
  • The development version.

If you encounter any issues, please report them on GitHub.

Changelog

For the Role History.

License

Licensed under Apache-2.0.

Author Information

Created by Shadow Walker.

Informazioni sul progetto

Find and update pip packages.

Installa
ansible-galaxy install buluma.update_pip_packages
Licenza
apache-2.0
Download
5.3k
Proprietario
DevOps Engineer