Skip to content

Commit

Permalink
fix: handle undefined variables in config
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Mar 3, 2017
1 parent 63387ea commit 90417d2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
server_scripts_version: v0.2.24
server_scripts_version: v0.2.25
server_scripts_install_path: /usr/share/server-scripts
server_scripts_logs_base_path: /var/log/server-scripts

Expand All @@ -8,7 +8,7 @@ server_scripts_detect_viruses_path: /home
#server_scripts_mailto: [email protected] # required
server_scripts_dbdump_dir: /var/backups/sql
server_scripts_dbdump_log: "{{ server_scripts_logs_base_path }}/mysql_backup.log"
#server_scripts_dbdump_remote_user: backup # required
server_scripts_dbdump_remote_user: backup # required
#server_scripts_dbdump_remote_host: backup.remote.com # required
server_scripts_dbdump_remote_dir: "{{ server_scripts_dbdump_dir }}/{{ ansible_fqdn }}"
server_scripts_dbdump_excluded_dbs: "_test$"
Expand Down
5 changes: 0 additions & 5 deletions molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ docker:

ansible:
playbook: tests/playbook.yml
group_vars:
all:
server_scripts_mailto: [email protected]
server_scripts_dbdump_remote_host: backup.remote.com
server_scripts_dbdump_remote_user: backup
6 changes: 6 additions & 0 deletions templates/server-scripts.conf.j2
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# {{ ansible_managed }}
# all
{% if server_scripts_mailto is defined %}
MAILTO="{{ server_scripts_mailto }}"
{% endif %}

# dbdump, dbundump
DB_BACKUPS_ROOT="{{ server_scripts_dbdump_dir }}"
DB_BACKUPS_LOG="{{ server_scripts_dbdump_log }}"

{% if server_scripts_dbdump_remote_user is defined %}
DB_BACKUPS_REMOTE_USER="{{ server_scripts_dbdump_remote_user }}"
{% endif %}
{% if server_scripts_dbdump_remote_host is defined %}
DB_BACKUPS_REMOTE_HOST="{{ server_scripts_dbdump_remote_host }}"
{% endif %}
DB_BACKUPS_REMOTE_DIR="{{ server_scripts_dbdump_remote_dir }}"

DB_BACKUPS_EXCLUDED_DBS="{{ server_scripts_dbdump_excluded_dbs }}"
Expand Down

0 comments on commit 90417d2

Please sign in to comment.