Skip to content

Commit

Permalink
merged marksteele-master
Browse files Browse the repository at this point in the history
  • Loading branch information
griggheo committed Sep 13, 2016
1 parent 7533e50 commit f719b9c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ consul_template_archive_file: "{{ consul_template_release }}.zip"
consul_template_download_url: "https://releases.hashicorp.com/consul-template/{{ consul_template_version }}/{{ consul_template_archive_file }}"
consul_template_binary: consul-template
consul_template_home: /opt/consul-template
consul_template_use_config_dir: false
consul_template_config_file_template: consul-template.cfg.j2
consul_template_config_file: consul-template.cfg
consul_template_log_file: /var/log/consul-template
Expand Down
9 changes: 2 additions & 7 deletions templates/consul-template.cfg.j2
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
consul = "{{ consul_template_consul_server }}:{{ consul_template_consul_port }}"

{% if consul_template_log_level %}
log_level = "{{consul_template_log_level}}"
{% endif %}

{% if not consul_template_config_dir %}
{% if consul_template_templates %}
{% for template in consul_template_templates %}


template {
source = "{{ consul_template_home }}/templates/{{ template.name }}"
destination = "{{ template.dest }}"
{% if template.cmd is defined %}command = "{{ template.cmd }}"{% endif %}

{% if template.perms is defined %}perms = {{ template.perms }}{% endif %}

{% if template.backup is defined %}backup = {{ template.backup|lower }}{% endif %}

}{% endfor %}
{% endif %}
{% endif %}
4 changes: 4 additions & 0 deletions templates/consul-template.service.systemd.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
Description=consul-template

[Service]
{% if consul_template_use_config_dir %}
ExecStart=/bin/sh -c "{{ consul_template_home }}/bin/{{ consul_template_binary }} -config={{ consul_template_home }}/config/ >> {{ consul_template_log_file }} 2>&1"
{% else %}
ExecStart=/bin/sh -c "{{ consul_template_home }}/bin/{{ consul_template_binary }} -config={{ consul_template_home }}/config/{{ consul_template_config_file }} >> {{ consul_template_log_file }} 2>&1"
{% endif %}

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions templates/consul-template.service.upstart.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ description "Consul Template"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [06]

{% if consul_template_use_config_dir %}
exec {{ consul_template_home }}/bin/{{ consul_template_binary }} -config={{ consul_template_home }}/config >> {{ consul_template_log_file }} 2>&1
{% else %}
exec {{ consul_template_home }}/bin/{{ consul_template_binary }} -config={{ consul_template_home }}/config/{{ consul_template_config_file }} >> {{ consul_template_log_file }} 2>&1
{% endif %}

respawn
respawn limit 10 10
Expand Down

0 comments on commit f719b9c

Please sign in to comment.