Skip to content

Commit

Permalink
Merge pull request #14 from groggemans/sensible-defaults
Browse files Browse the repository at this point in the history
Added sensible default values
  • Loading branch information
holms committed May 8, 2016
2 parents ce4ede8 + 4d52e40 commit cbc63a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Role Variables
--------------


|Variable name | Variable value
|--------------|---------------
|*hostname* |new hostname (not FQDN, before first dot)
|*fqdn* | new domain name
| Variable name | Variable value | Default |
|---------------|----------------|---------|
|*hostname* | hostname (eg. vm1) | `inventory_hostname_short` |
|*fqdn* | domain name (eg. vm1.test.com) | `inventory_hostname` |

Example
-------
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
fqdn: "{{ inventory_hostname }}"
hostname: "{{ inventory_hostname_short }}"
10 changes: 0 additions & 10 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
- name: fqdn | Check for FQDN variable presence
fail:
msg: "FQDN variable is not set!"
when: fqdn|default(False) == False

- name: fqdn | Check for hostname variable presence
fail:
msg: "Hostname variable is not set!"
when: hostname|default(False) == False

- name: fqdn | Configure Debian
include: debian.yml
when: ansible_distribution in [ 'Debian', 'Ubuntu' ]
Expand Down

0 comments on commit cbc63a5

Please sign in to comment.