feat: initial cross-distro package management role
Supports apt, dnf, yum, pacman, apk and zypper. Variables cover install, remove, upgrade, cache refresh and autoremove.
This commit is contained in:
43
README.md
Normal file
43
README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# ansible-role-packages
|
||||
|
||||
Manages Linux packages across distributions using the native package manager.
|
||||
|
||||
Supported package managers: `apt`, `dnf`, `yum`, `pacman`, `apk`, `zypper`.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Ansible >= 2.14
|
||||
- `community.general` collection (required for Arch, Alpine, openSUSE targets)
|
||||
|
||||
## Role Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|---|---|---|
|
||||
| `packages_install` | `[]` | List of packages to install |
|
||||
| `packages_remove` | `[]` | List of packages to remove |
|
||||
| `packages_state` | `present` | State for installed packages: `present` or `latest` |
|
||||
| `packages_upgrade` | `false` | Upgrade all packages on the system |
|
||||
| `packages_update_cache` | `true` | Refresh the package cache before operations |
|
||||
| `packages_cache_valid_time` | `3600` | Maximum cache age in seconds before forcing a refresh (apt only) |
|
||||
| `packages_autoremove` | `false` | Remove unused dependencies after operations (apt, dnf only) |
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```yaml
|
||||
- hosts: servers
|
||||
roles:
|
||||
- role: ansible-role-packages
|
||||
vars:
|
||||
packages_install:
|
||||
- curl
|
||||
- git
|
||||
- vim
|
||||
packages_remove:
|
||||
- telnet
|
||||
packages_update_cache: true
|
||||
packages_upgrade: false
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user