Skip to content

Commit

Permalink
Make Upstart start/stop conditions configurable and fix RedHat values
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Robinson committed Aug 29, 2016
1 parent 4fd976c commit 177f3ad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions defaults/main.yml
Expand Up @@ -60,6 +60,10 @@ consul_use_systemd: false
consul_use_upstart: true
consul_use_initd: false

# Upstart start/stop conditions can vary by distribution and environment
consul_upstart_start_on: start on runlevel [345]
consul_upstart_stop_on: stop on runlevel [!345]

consul_is_server: false

consul_domain: consul.
Expand Down
5 changes: 5 additions & 0 deletions tasks/main.yml
@@ -1,4 +1,9 @@
---
- name: gather OS specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version}}.yml"
- "{{ ansible_os_family }}.yml"
- include: install.yml
- { include: install-ui.yml, when: consul_is_ui == true }
- { include: install-cli.yml, when: consul_install_consul_cli == true }
Expand Down
4 changes: 2 additions & 2 deletions templates/consul.conf.j2
@@ -1,8 +1,8 @@
# Consul Agent (Upstart unit)
description "Consul Agent"

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
start on {{ consul_upstart_start_on }}
stop on {{ consul_upstart_stop_on }}

script
{% if consul_dynamic_bind %}
Expand Down
2 changes: 2 additions & 0 deletions vars/Debian.yml
@@ -0,0 +1,2 @@
consul_upstart_start_on: (local-filesystems and net-device-up IFACE!=lo)
consul_upstart_stop_on: runlevel [016]
2 changes: 2 additions & 0 deletions vars/RedHat.yml
@@ -0,0 +1,2 @@
consul_upstart_start_on: (runlevel [345] and started network)
consul_upstart_stop_on: (runlevel [!345] or stopping network)

0 comments on commit 177f3ad

Please sign in to comment.