diff --git a/apt/README.md b/apt/README.md index ec4da5b6..f3a8b13f 100644 --- a/apt/README.md +++ b/apt/README.md @@ -11,6 +11,7 @@ Tasks are extracted in several files, included in `tasks/main.yml` : ## Available variables +* `apt_config` : customize apt configuration (default: `True`) ; * `apt_install_basics` : change basic sources components (default: `True`) ; * `apt_basics_components` : basic sources components (default: `main`) ; * `apt_install_backports` : install backports sources (default: `False`) ; diff --git a/apt/defaults/main.yml b/apt/defaults/main.yml index 4e1cee3d..c648c3c5 100644 --- a/apt/defaults/main.yml +++ b/apt/defaults/main.yml @@ -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_basics_components: "main" diff --git a/apt/tasks/config.yml b/apt/tasks/config.yml new file mode 100644 index 00000000..264e8dd7 --- /dev/null +++ b/apt/tasks/config.yml @@ -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 diff --git a/apt/tasks/main.yml b/apt/tasks/main.yml index af7980c8..72960d02 100644 --- a/apt/tasks/main.yml +++ b/apt/tasks/main.yml @@ -7,6 +7,12 @@ tags: - apt +- name: Custom configuration + include: config.yml + when: apt_config + tags: + - apt + - name: Install basics repositories include: basics.yml when: apt_install_basics