https://github.com/artcom/ansible-role-pin-apt-package-version
Ansible role to pin the version of an APT package using APT preferences.
https://github.com/artcom/ansible-role-pin-apt-package-version
Last synced: 12 months ago
JSON representation
Ansible role to pin the version of an APT package using APT preferences.
- Host: GitHub
- URL: https://github.com/artcom/ansible-role-pin-apt-package-version
- Owner: artcom
- License: mit
- Created: 2020-09-02T13:03:28.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-11T12:33:52.000Z (almost 6 years ago)
- Last Synced: 2025-05-17T19:37:57.382Z (about 1 year ago)
- Language: Python
- Size: 10.7 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pin apt package version
Ansible role to pin the version of an apt package using apt preferences.
## Role Variables
Available variables are listed below, along with default values `(see defaults/main.yml)`:
```yaml
package_name: null
package_version: null
```
Required variables (role will fail if the variables are not set):
```yaml
package_name: "string"
package_version: "string"
```
This will create the file `/etc/apt/preferences.d/.pref` with the following content:
```
Explanation: Pin added by Ansible role "pin-apt-package-version"
Package:
Pin: version
Pin-Priority: 600
```
`package_version` should be set according to the [apt_preferences man page](http://manpages.ubuntu.com/manpages/bionic/man5/apt_preferences.5.html) and can use wildcards.
## Dependencies
None.
# Example Playbook
```yaml
- name: Pin APT package version
hosts: all
become: true
roles:
- role: pin-apt-package-version
vars:
package_name: "perl"
package_version: "5.20*"
```
## Test
### Requirements
- python >= 3.7
- docker
### Run
```bash
pip install -r requirements.txt
molecule test
```