cellinfo
/
ansible.apt
Archived
2
0
Fork 0

Manage default preferences file.

This commit is contained in:
Jeremy Gardais 2017-08-16 15:55:10 +02:00
parent 0f4a1360d1
commit 4a6b980918
5 changed files with 33 additions and 0 deletions

View File

@ -5,3 +5,4 @@
* Remove the default `/etc/apt/sources.list` file. * Remove the default `/etc/apt/sources.list` file.
* Manage Stretch repositories. * Manage Stretch repositories.
* Update Apt if any repositories modifications. * Update Apt if any repositories modifications.
* Manage default preferences file.

View File

@ -4,6 +4,8 @@
2. [Role Variables](#role-variables) 2. [Role Variables](#role-variables)
3. [Example Playbook](#example-playbook) 3. [Example Playbook](#example-playbook)
4. [Configuration](#configuration) 4. [Configuration](#configuration)
* [Sources List](#sources-list)
* [Preferences](#preferences)
5. [Development](#development) 5. [Development](#development)
6. [License](#license) 6. [License](#license)
7. [Author Information](#author-information) 7. [Author Information](#author-information)
@ -17,6 +19,8 @@ Manage APT repos, preferences and configuration for IPR's servers.
* **apt_src_list_manage**: If apt sources list files should be managed [default: `true`]. * **apt_src_list_manage**: If apt sources list files should be managed [default: `true`].
* **apt_purge_src_list_file**: If the default sources.file must be absent [default: `true`]. * **apt_purge_src_list_file**: If the default sources.file must be absent [default: `true`].
* **apt_stretch_manage**: If Stretch configuration should be managed [default: `true`]. * **apt_stretch_manage**: If Stretch configuration should be managed [default: `true`].
* **apt_default_pref_path**: Path to set the default preferences file for all repositories [default: `'/etc/apt/preferences.d/default.pref'`].
* **apt_default_pref_tpl**: Template used to generate the previous config file [default: `'etc/apt/preferences.d/default.pref.j2'`].
## Example Playbook ## Example Playbook
@ -37,6 +41,12 @@ Manage Debian's sources.list:
* Add Stretch repositories. * Add Stretch repositories.
* Update Apt if any repositories modifications. * Update Apt if any repositories modifications.
### Preferences
* Set the preferences for all repositories, default to:
- Stretch - 310.
- Stretch Backports - 300.
## Development ## Development
This source code comes from our [Gogs instance][apt source] and the [Github repo][apt github] exist just to be able to send the role to Ansible Galaxy… This source code comes from our [Gogs instance][apt source] and the [Github repo][apt github] exist just to be able to send the role to Ansible Galaxy…

View File

@ -5,3 +5,6 @@ apt_src_list_manage: true
apt_purge_src_list_file: true apt_purge_src_list_file: true
apt_stretch_manage: true apt_stretch_manage: true
apt_default_pref_path: '/etc/apt/preferences.d/default.pref'
apt_default_pref_tpl: 'etc/apt/preferences.d/default.pref.j2'

View File

@ -1,6 +1,12 @@
--- ---
# tasks file for apt # tasks file for apt
# Default preferences file
- name: CONFIG default preferences
template:
src: '{{ apt_default_pref_tpl }}'
dest: '{{ apt_default_pref_path }}'
# Sources list # Sources list
## Purge sources.list file ## Purge sources.list file
- name: CONFIG remove sources.list file - name: CONFIG remove sources.list file

View File

@ -0,0 +1,13 @@
# {{ ansible_managed }}
{% if apt_stretch_manage %}
Explanation: Packages from Stretch (Stable)
Package: *
Pin: release o=Debian,a=stable,n=stretch,l=Debian
Pin-Priority: 310
Explanation: Packages from Stretch (Stable)
Package: *
Pin: release o=Debian Backports,a=stretch-backports,n=stretch-backports,l=Debian Backports
Pin-Priority: 300
{% endif %}