Skip to content

Commit

Permalink
include distribution specific vars from files
Browse files Browse the repository at this point in the history
  • Loading branch information
exploide committed Apr 1, 2017
1 parent da5a673 commit 1ca3e00
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
8 changes: 8 additions & 0 deletions tasks/include-vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Load a variable file based on the OS type, or a default if not found.
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "default.yml"
10 changes: 0 additions & 10 deletions tasks/install-with-package.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
- name: Define certbot_package (Ubuntu 16.04).
set_fact:
certbot_package: letsencrypt
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '16.04'

- name: Define certbot_package.
set_fact:
certbot_package: certbot
when: certbot_package is undefined

- name: Install Certbot.
package: "name={{ certbot_package }} state=present"

Expand Down
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
- include: include-vars.yml

- include: install-with-package.yml
when: not certbot_install_from_source

Expand Down
1 change: 1 addition & 0 deletions vars/Ubuntu-16.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
certbot_package: letsencrypt
2 changes: 2 additions & 0 deletions vars/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
certbot_package: certbot

0 comments on commit 1ca3e00

Please sign in to comment.