extract APT configuration into apt role
This commit is contained in:
parent
517c0e672b
commit
fae9cd9208
|
@ -11,6 +11,7 @@ Tasks are extracted in several files, included in `tasks/main.yml` :
|
||||||
|
|
||||||
## Available variables
|
## Available variables
|
||||||
|
|
||||||
|
* `apt_config` : customize apt configuration (default: `True`) ;
|
||||||
* `apt_install_basics` : change basic sources components (default: `True`) ;
|
* `apt_install_basics` : change basic sources components (default: `True`) ;
|
||||||
* `apt_basics_components` : basic sources components (default: `main`) ;
|
* `apt_basics_components` : basic sources components (default: `main`) ;
|
||||||
* `apt_install_backports` : install backports sources (default: `False`) ;
|
* `apt_install_backports` : install backports sources (default: `False`) ;
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
---
|
---
|
||||||
|
apt_config: True
|
||||||
|
apt_evolinux_config: True
|
||||||
|
apt_hooks: True
|
||||||
|
apt_remove_aptitude: True
|
||||||
|
apt_upgrade: True
|
||||||
|
|
||||||
apt_install_basics: True
|
apt_install_basics: True
|
||||||
apt_basics_components: "main"
|
apt_basics_components: "main"
|
||||||
|
|
||||||
|
|
44
apt/tasks/config.yml
Normal file
44
apt/tasks/config.yml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Evolinux config for APT
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/apt/apt.conf.d/z-evolinux.conf
|
||||||
|
line: "{{ item.line }}"
|
||||||
|
regexp: "{{ item.regexp }}"
|
||||||
|
create: yes
|
||||||
|
state: present
|
||||||
|
mode: "0640"
|
||||||
|
with_items:
|
||||||
|
- { line: "APT::Install-Recommends \"false\";", regexp: 'APT::Install-Recommends' }
|
||||||
|
- { line: "APT::Install-Suggests \"false\";", regexp: 'APT::Install-Suggests' }
|
||||||
|
when: apt_evolinux_config
|
||||||
|
|
||||||
|
- name: DPkg invoke hooks
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/apt/apt.conf.d/z-evolinux.conf
|
||||||
|
line: "{{ item }}"
|
||||||
|
create: yes
|
||||||
|
state: present
|
||||||
|
mode: "0640"
|
||||||
|
with_items:
|
||||||
|
- "DPkg::Pre-Invoke { \"df /tmp | grep -q /tmp && mount -oremount,exec /tmp || true\"; };"
|
||||||
|
- "DPkg::Pre-Invoke { \"df /usr | grep -q /usr && mount -oremount,rw /usr || true\"; };"
|
||||||
|
- "DPkg::Post-Invoke { \"df /tmp | grep -q /tmp && mount -oremount /tmp || true\"; };"
|
||||||
|
- "DPkg::Post-Invoke { \"df /usr | grep -q /usr && mount -oremount /usr || true\"; };"
|
||||||
|
when: apt_hooks
|
||||||
|
|
||||||
|
- name: Remove Aptitude
|
||||||
|
apt:
|
||||||
|
name: aptitude
|
||||||
|
state: absent
|
||||||
|
when: apt_remove_aptitude
|
||||||
|
|
||||||
|
- name: Updating APT cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Upgrading system
|
||||||
|
apt:
|
||||||
|
upgrade: dist
|
||||||
|
when: apt_upgrade
|
|
@ -7,6 +7,12 @@
|
||||||
tags:
|
tags:
|
||||||
- apt
|
- apt
|
||||||
|
|
||||||
|
- name: Custom configuration
|
||||||
|
include: config.yml
|
||||||
|
when: apt_config
|
||||||
|
tags:
|
||||||
|
- apt
|
||||||
|
|
||||||
- name: Install basics repositories
|
- name: Install basics repositories
|
||||||
include: basics.yml
|
include: basics.yml
|
||||||
when: apt_install_basics
|
when: apt_install_basics
|
||||||
|
|
Loading…
Reference in a new issue