This repository has been archived on 2020-12-09. You can view files and clone it, but cannot push or open issues or pull requests.
ansible.pkg_utils/tasks/main.yml

68 lines
1.5 KiB
YAML

---
# tasks file for pkg_utils
- name: Load specific OS vars
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution|lower }}.yml"
- "{{ ansible_os_family|lower }}.yml"
# packages {{{
- name: Ensure useful packages
apt:
name: '{{ item }}'
state: '{{ pkg_utils_new_state }}'
with_items:
- '{{ pkg_utils_new_list }}'
- name: Remove useless packages
apt:
name: '{{ item }}'
state: '{{ pkg_utils_old_state }}'
with_items:
- '{{ pkg_utils_old_list }}'
when: pkg_utils_old_manage
# }}}
# configuration {{{
- name: CONFIG {{ pkg_utils_default_editor_name }} as default editor
alternatives:
name: editor
path: '{{ pkg_utils_default_editor_path }}'
priority: 80
when: pkg_utils_default_editor_manage
- name: CONFIG updatedb
template:
src: '{{ pkg_utils_updatedb_conf_tpl }}'
dest: '{{ pkg_utils_updatedb_conf_path }}'
owner: root
group: root
mode: 0644
backup: true
notify: update mlocate db
# }}}
# purge log {{{
- name: Find /var/log/installer
find:
path: /var/log/
patterns: 'installer'
age: '{{ pkg_utils_purge_installer_age }}'
register: findresult
when: pkg_utils_purge_installer_log
- name: Remove /var/log/installer older than {{ pkg_utils_purge_installer_age }}
file:
path: "{{ item.path }}"
state: absent
recurse: yes
with_items: '{{ findresult.files }}'
when: pkg_utils_purge_installer_log
# }}}