Skip to content

Commit

Permalink
Added apt clean-up, updated Readme and defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
pjan committed Mar 13, 2014
1 parent dec80ac commit 95d7c67
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
## Ansibles - apt [![Build Status](https://travis-ci.org/Ansibles/apt.png)](https://travis-ci.org/Ansibles/apt)

Update and manage the apt-cache
Ansible role which executes apt-get update to ensure the local APT package cache is up to date. At the same time, it cleans it from packages and .deb files which are no longer needed.


#### Variables

```yaml
apt_cache_valid_time: # time (in seconds) that the apt cache stays valid
apt_install_recommends: # true/false - whether or not to install the "recommended" packages
apt_install_suggests: # true/false - whether or not to install the "suggested" packages
apt_reset_source_list: no # reset the /etc/apt/sources.list to the default
apt_cache_valid_time: 3600 # Time (in seconds) the apt cache stays valid
apt_install_recommends: yes # whether or not to install the "recommended" packages
apt_install_suggests: yes # whether or not to install the "suggested" packages
```
#### License
Licensed under the MIT License. See the LICENSE file for details.
#### Feedback, bug-reports, requests, ...
Are [welcome](https://github.com/ansibles/apt/issues)!
7 changes: 4 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# file: apt/defaults/main.yml

apt_cache_valid_time: 3600
apt_install_recommends: true
apt_install_suggests: true
apt_reset_source_list: no # reset the /etc/apt/sources.list to the default
apt_cache_valid_time: 3600 # Time (in seconds) the apt cache stays valid
apt_install_recommends: yes # whether or not to install the "recommended" packages
apt_install_suggests: yes # whether or not to install the "suggested" packages
1 change: 0 additions & 1 deletion handlers/main.yml

This file was deleted.

2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

galaxy_info:
author: pjan vandaele
description: Update and manage the apt-cache
description: Manages apt and executes apt-get update to ensure the local APT package cache is up to date.
min_ansible_version: 1.4
license: MIT
platforms:
Expand Down
15 changes: 11 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
# file: apt/tasks/main.yml

- name: Aptitude | Update the sources list (/etc/apt/sources.list)
- name: APT | Reset the sources list (/etc/apt/sources.list)
copy:
src: etc_apt_sources.list
dest: /etc/apt/sources.list
owner: root
group: root
mode: 0644
when: apt_reset_source_list

- name: Aptitude | Update the apt cache
- name: APT | Update the apt cache
apt:
update_cache: yes
cache_valid_time: "{{apt_cache_valid_time}}"

- name: Aptitude | Update the general configuration (/etc/apt/apt.conf.ds/10general)
- name: APT | Remove packages that are no longer needed for dependencies
shell: apt-get -y autoremove

- name: APT | Remove .deb files for packages no longer on your system
shell: apt-get -y autoclean

- name: APT | Update the general configuration (/etc/apt/apt.conf.ds/10general)
template:
src: etc_apt_apt.conf.d_10general.j2
dest: /etc/apt/apt.conf.d/10general
owner: root
group: root
mode: 0644

- name: Aptitude | Make sure the required packages are installed
- name: APT | Make sure the required packages are installed
apt:
pkg: "{{item}}"
state: present
Expand Down
4 changes: 2 additions & 2 deletions templates/etc_apt_apt.conf.d_10general.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APT::Install-Recommends "{{ apt_install_recommends }}";
APT::Install-Suggests "{{ apt_install_suggests }}";
APT::Install-Recommends "{{apt_install_recommends}}";
APT::Install-Suggests "{{apt_install_suggests}}";

APT::Get::Show-Upgraded "true";

0 comments on commit 95d7c67

Please sign in to comment.