Skip to content

Commit

Permalink
Set the apt cache time as a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjj committed Jun 1, 2014
1 parent 7cc3b80 commit 8aa8d26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ nginx_ssl_local_path: ~/dev/secrets/
# What are the file names for both your cert and key?
nginx_ssl_cert_name: sslcert.crt
nginx_ssl_key_name: sslkey.key
# The amount in seconds to cache apt-update.
apt_cache_valid_time: 86400
```

## Example playbook without ssl
Expand Down
4 changes: 3 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ nginx_ssl_session_timeout: 10m

nginx_ssl_local_path: ~/dev/testproject/secrets/
nginx_ssl_cert_name: sslcert.crt
nginx_ssl_key_name: sslkey.key
nginx_ssl_key_name: sslkey.key

apt_cache_valid_time: 86400
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: ensure ansible's apt_repository dependency is installed
apt: pkg=python-apt state=latest update_cache=true cache_valid_time=86400
apt: pkg=python-apt state=latest update_cache=true cache_valid_time={{ apt_cache_valid_time }}

- name: ensure nginx apt repository is up to date
apt_repository: repo='ppa:nginx/stable'

- name: ensure nginx latest stable is installed
apt: pkg=nginx state=latest update_cache=true cache_valid_time=86400
apt: pkg=nginx state=latest update_cache=true cache_valid_time={{ apt_cache_valid_time }}
notify:
- restart nginx

Expand Down

0 comments on commit 8aa8d26

Please sign in to comment.