From 45d65866fd2b9b1f2b2dd96044e8f73f3c4ec17b Mon Sep 17 00:00:00 2001 From: Jesse DeFer Date: Sun, 23 Oct 2016 17:21:59 -0700 Subject: [PATCH 1/2] clean up variables --- README.md | 2 +- defaults/main.yml | 4 ++-- templates/client_config.json.j2 | 2 +- templates/server_config.json.j2 | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 825f410f..91cd7b93 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The role specifies variables in `defaults/main.yml` and `vars/*.yml`. | `consul_syslog_enable` | `true` | Log to syslog | | `consul_iface` | `eth1` | Consul network interface | | `consul_bind_address` | `127.0.0.1` | Bind address | -| `consul_bootstrap_interface` | `{{ hostvars[groups['cluster_nodes'][0]]['ansible_eth1']['ipv4']['address'] }}` | The server interface that additional server nodes will join to for bootstrapping | +| `consul_bootstrap_address` | `{{ hostvars[groups['cluster_nodes'][0]]['ansible_'+consul_iface]['ipv4']['address'] }}` | The server interface that additional server nodes will join to for bootstrapping | | `consul_dns_bind_address` | `127.0.0.1` | DNS API bind address | | `consul_http_bind_address` | `0.0.0.0` | HTTP API bind address | | `consul_https_bind_address` | `0.0.0.0` | HTTPS API bind address | diff --git a/defaults/main.yml b/defaults/main.yml index 95afd321..23b9953a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,12 +19,12 @@ consul_ui_url: "https://releases.hashicorp.com/consul/{{ consul_version }}/consu consul_ui_pkg: "{{ consul_version }}_web_ui.zip" consul_ui_sha256: "5f8841b51e0e3e2eb1f1dc66a47310ae42b0448e77df14c83bb49e0e0d5fa4b7" consul_iface: "eth1" -consul_bind_address: "{{ hostvars[inventory_hostname]['ansible_eth1']['ipv4']['address'] }}" +consul_bind_address: "{{ hostvars[inventory_hostname]['ansible_'+consul_iface]['ipv4']['address'] }}" consul_dns_bind_address: "127.0.0.1" consul_http_bind_address: "0.0.0.0" consul_https_bind_address: "0.0.0.0" consul_rpc_bind_address: "0.0.0.0" -consul_bootstrap_interface: "{{ hostvars[groups['cluster_nodes'][0]]['ansible_eth1']['ipv4']['address'] }}" +consul_bootstrap_address: "{{ hostvars[groups[consul_group_name][0]]['ansible_'+consul_iface]['ipv4']['address'] }}" consul_node_name: "{{ inventory_hostname_short }}" consul_acl_enable: "false" consul_acl_datacenter: "{{ consul_datacenter }}" diff --git a/templates/client_config.json.j2 b/templates/client_config.json.j2 index f80e327c..783718a8 100644 --- a/templates/client_config.json.j2 +++ b/templates/client_config.json.j2 @@ -20,6 +20,6 @@ "log_level": "{{ consul_log_level }}", "enable_syslog": {{ consul_syslog_enable }}, "start_join": {{ lbracket }}{% for host in groups[consul_group_name] %} - {{ comma() }}{{ quote }}{{ hostvars[host]['ansible_eth1']['ipv4']['address'] }}{{ quote }} + {{ comma() }}{{ quote }}{{ hostvars[host]['ansible_'+consul_iface]['ipv4']['address'] }}{{ quote }} {% endfor %}{{ rbracket }} } diff --git a/templates/server_config.json.j2 b/templates/server_config.json.j2 index 290f3a6a..626d50fd 100644 --- a/templates/server_config.json.j2 +++ b/templates/server_config.json.j2 @@ -19,6 +19,6 @@ "encrypt": "{{ consul_raw_key['stdout']}}", "log_level": "{{ consul_log_level }}", "enable_syslog": {{ consul_syslog_enable }}, - "start_join": {{ lbracket }}{{ quote }}{{ consul_bootstrap_interface }}{{ quote }}{{ rbracket }}, + "start_join": {{ lbracket }}{{ quote }}{{ consul_bootstrap_address }}{{ quote }}{{ rbracket }}, "ui": true } From 1a2c166ab9d13b7886c78144b432c223393bd597 Mon Sep 17 00:00:00 2001 From: asujenkinsapp Date: Sun, 23 Oct 2016 17:31:17 -0700 Subject: [PATCH 2/2] Document consul_group_name --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91cd7b93..0d944fde 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,14 @@ The role specifies variables in `defaults/main.yml` and `vars/*.yml`. | `consul_log_path` | `/var/log/consul` | Log path | | `consul_user` | `consul` | OS user | | `consul_group` | `bin` | OS group | +| `consul_group_name` | `cluster_nodes` | Inventory group name | | `consul_datacenter` | `dc1` | Datacenter label | | `consul_domain` | `consul` | Consul domain name | | `consul_log_level` | `INFO` | Log level | | `consul_syslog_enable` | `true` | Log to syslog | | `consul_iface` | `eth1` | Consul network interface | | `consul_bind_address` | `127.0.0.1` | Bind address | -| `consul_bootstrap_address` | `{{ hostvars[groups['cluster_nodes'][0]]['ansible_'+consul_iface]['ipv4']['address'] }}` | The server interface that additional server nodes will join to for bootstrapping | +| `consul_bootstrap_address` | `{{ hostvars[groups[consul_group_name][0]]['ansible_'+consul_iface]['ipv4']['address'] }}` | The server interface that additional server nodes will join to for bootstrapping | | `consul_dns_bind_address` | `127.0.0.1` | DNS API bind address | | `consul_http_bind_address` | `0.0.0.0` | HTTP API bind address | | `consul_https_bind_address` | `0.0.0.0` | HTTPS API bind address |