Manage default preferences file.
This commit is contained in:
		
							parent
							
								
									0f4a1360d1
								
							
						
					
					
						commit
						4a6b980918
					
				| 
						 | 
				
			
			@ -5,3 +5,4 @@
 | 
			
		|||
* Remove the default `/etc/apt/sources.list` file.
 | 
			
		||||
* Manage Stretch repositories.
 | 
			
		||||
* Update Apt if any repositories modifications.
 | 
			
		||||
* Manage default preferences file.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								README.md
								
								
								
								
							
							
						
						
									
										10
									
								
								README.md
								
								
								
								
							| 
						 | 
				
			
			@ -4,6 +4,8 @@
 | 
			
		|||
2. [Role Variables](#role-variables)
 | 
			
		||||
3. [Example Playbook](#example-playbook)
 | 
			
		||||
4. [Configuration](#configuration)
 | 
			
		||||
    * [Sources List](#sources-list)
 | 
			
		||||
    * [Preferences](#preferences)
 | 
			
		||||
5. [Development](#development)
 | 
			
		||||
6. [License](#license)
 | 
			
		||||
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_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_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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +41,12 @@ Manage Debian's sources.list :
 | 
			
		|||
* Add Stretch repositories.
 | 
			
		||||
* Update Apt if any repositories modifications.
 | 
			
		||||
 | 
			
		||||
### Preferences
 | 
			
		||||
 | 
			
		||||
* Set the preferences for all repositories, default to :
 | 
			
		||||
  - Stretch - 310.
 | 
			
		||||
  - Stretch Backports - 300.
 | 
			
		||||
 | 
			
		||||
## 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…
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,3 +5,6 @@ apt_src_list_manage: true
 | 
			
		|||
apt_purge_src_list_file: 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'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,12 @@
 | 
			
		|||
---
 | 
			
		||||
# tasks file for apt
 | 
			
		||||
 | 
			
		||||
# Default preferences file
 | 
			
		||||
- name: CONFIG default preferences
 | 
			
		||||
  template:
 | 
			
		||||
    src: '{{ apt_default_pref_tpl }}'
 | 
			
		||||
    dest: '{{ apt_default_pref_path }}'
 | 
			
		||||
 | 
			
		||||
# Sources list
 | 
			
		||||
## Purge sources.list file
 | 
			
		||||
- name: CONFIG remove sources.list 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 %}
 | 
			
		||||
		Reference in New Issue