Skip to content

Commit 3f01ed0

Browse files
committed
Performance tuning, deprecation updates, and more
- Add performance tuning configuration (thanks @t0k4rt) - Set raft multiplier to 1 - Conditionally install Python dependency baed on virtualenv or --user Addresses #129 (comment) - Update includes to import_tasks and include_tasks - Remove invalid consul_version key from configuration - Update Vagrantfile - Set client address to 0.0.0.0 so Vagrant based deploy checks now pass - Update documentation
1 parent 0641753 commit 3f01ed0

File tree

9 files changed

+68
-80
lines changed

9 files changed

+68
-80
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,14 @@ Actually add new template files :facepalm:
768768
- Consul v1.0.2
769769
- Update documentation
770770

771-
## v1.30.1 (UNRELEASED)
771+
## v1.30.1
772772

773773
- Add performance tuning configuration (thanks @t0k4rt)
774774
- Set raft multiplier to 1
775-
- Update documentation
776775
- Conditionally install Python dependency baed on virtualenv or --user
777776
Addresses https://github.com/brianshumate/ansible-consul/issues/129#issuecomment-356095611
777+
- Update includes to import_tasks and include_tasks
778+
- Remove invalid consul_version key from configuration
779+
- Update Vagrantfile
780+
- Set client address to 0.0.0.0 so Vagrant based deploy checks now pass
781+
- Update documentation

README.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ definitely known to work with the following specific software versions:
2828
* Consul: 1.0.2
2929
* Ansible: 2.4.2.0
3030
* CentOS: 7
31-
* Debian: 8
31+
* Debian: 9
3232
* FreeBSD: 11
3333
* RHEL: 7
3434
* Ubuntu: 16.04
@@ -667,6 +667,27 @@ packages with different package names.
667667
- List of OS packages to install
668668
- Default value: list
669669

670+
### `consul_performance`
671+
672+
- List of Consul performance tuning items
673+
- Default value: list
674+
675+
#### `raft_multiplier`
676+
677+
- [Raft multiplier](https://www.consul.io/docs/agent/options.html#raft_multiplier) scales key Raft timing parameters
678+
- Default value: 1
679+
680+
#### `leave_drain_time`
681+
682+
- [Node leave drain time](https://www.consul.io/docs/agent/options.html#leave_drain_time) is the dwell time for a server to honor requests while gracefully leaving
683+
684+
- Default value: 5s
685+
686+
#### `rpc_hold_timeout`
687+
688+
- [RPC hold timeout](https://www.consul.io/docs/agent/options.html#rpc_hold_timeout) is the duration that a client or server will retry internal RPC requests during leader elections
689+
- Default value: 7s
690+
670691
## Dependencies
671692

672693
Ansible requires GNU tar and this role performs some local use of the
@@ -813,21 +834,6 @@ consul3.node.consul. 0 IN A 10.1.42.230
813834
- Custom list of addresses to listen on.
814835
- Default value: *[]*
815836

816-
### `consul_performance`
817-
818-
This is a nested object of Consul performance related options.
819-
820-
#### `consul_performance.raft_multiplier`
821-
822-
This is the [raft multiplier](https://www.consul.io/docs/agent/options.html#raft_multiplier). See also [Server Performance](https://www.consul.io/docs/guides/performance.html).
823-
824-
#### `consul_performance.leave_drain_time`
825-
826-
This is the [leave drain time](https://www.consul.io/docs/agent/options.html#leave_drain_time).
827-
828-
#### `consul_performance.rpc_hold_timeout`
829-
830-
This is the [RPC hold timeout](https://www.consul.io/docs/agent/options.html#rpc_hold_timeout).
831837

832838
### iptables DNS Forwarding Support
833839

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ consul_dnsmasq_local_service: false
181181
consul_dnsmasq_listen_addresses: []
182182
consul_iptables_enable: "{{ lookup('env','CONSUL_IPTABLES_ENABLE') | default(false, true) }}"
183183

184-
# Consul performace
184+
# Performance
185185
consul_performance:
186186
raft_multiplier: 1
187187
leave_drain_time: 5s

examples/README_VAGRANT.md

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,38 @@
11
# Consul with Ansible
22

3-
This project provides documentation and a collection of scripts to help you
4-
automate the deployment of Consul using
5-
[Ansible](https://www.ansible.com/). These are the instructions for
6-
deploying a development cluster on Vagrant and VirtualBox.
3+
This project provides documentation and a collection of scripts to help you automate the deployment of Consul using [Ansible](https://www.ansible.com/). These are the instructions for deploying a development cluster on Vagrant and VirtualBox.
74

8-
The documentation and scripts are merely a starting point designed to both
9-
help familiarize you with the processes and quickly bootstrap an environment
10-
for development. You may wish to expand on them and customize
11-
them with additional features specific to your needs later.
5+
The documentation and scripts are merely a starting point designed to both help familiarize you with the processes and quickly bootstrap an environment for development. You may wish to expand on them and customize them with additional features specific to your needs later.
126

137
If you are looking for the main role documentation, it is in the [README.md](https://github.com/brianshumate/ansible-consul/blob/master/README.md).
148

159
## Vagrant Development Cluster
1610

17-
In some situations deploying a small cluster on your local development
18-
machine can be handy. This document describes such a scenario using the
19-
following technologies:
11+
In some situations deploying a small cluster on your local development machine can be handy. This document describes such a scenario using the following technologies:
2012

2113
* [Consul](https://consul.io)
2214
* [VirtualBox](https://www.virtualbox.org/)
2315
* [Vagrant](http://www.vagrantup.com/) with Ansible provisioner and
2416
supporting plugin
2517
* [Ansible](https://www.ansible.com/)
2618

27-
Each of the virtual machines for this guide are configured with
28-
1GB RAM, 2 CPU cores, and 2 network interfaces. The first interface uses
29-
NAT and has connection via the host to the outside world. The second
30-
interface is a private network and is used for Consul intra-cluster
31-
communication in addition to access from the host machine.
19+
Each of the virtual machines for this guide are configured with 1GB RAM, 2 CPU cores, and 2 network interfaces. The first interface uses NAT and has connection via the host to the outside world. The second interface is a private network and is used for Consul intra-cluster communication in addition to access from the host machine.
3220

33-
The Vagrant configuration file (`Vagrantfile`) is responsible for
34-
configuring the virtual machines and a baseline OS installation.
21+
The Vagrant configuration file (`Vagrantfile`) is responsible for configuring the virtual machines and a baseline OS installation.
3522

36-
The Ansible playbooks then further refine OS configuration, perform Consul
37-
software download, installation, configuration, and the joining of server nodes into a ready to use cluster.
23+
The Ansible playbooks then further refine OS configuration, perform Consul software download, installation, configuration, and the joining of server nodes into a ready to use cluster.
3824

3925
## Designed for Ansible Galaxy
4026

41-
This role is designed to be installed via the `ansible-galaxy` command
42-
instead of being directly run from the git repository.
27+
This role is designed to be installed via the `ansible-galaxy` command instead of being directly run from the git repository.
4328

4429
You should install it like this:
4530

4631
```
4732
ansible-galaxy install brianshumate.consul
4833
```
4934

50-
You'll want to make sure you have write access to `/etc/ansible/roles/` since
51-
that is where the role will be installed by default, or define your own
52-
Ansible role path by creating a `$HOME/.ansible.cfg` or even `./anisible.cfg`
35+
You'll want to make sure you have write access to `/etc/ansible/roles/` since that is where the role will be installed by default, or define your own Ansible role path by creating a `$HOME/.ansible.cfg` or even `./anisible.cfg`
5336
file with these contents:
5437

5538
```
@@ -61,8 +44,7 @@ Change `PATH_TO_ROLES` to a directory that you have write access to.
6144

6245
## Quick Start
6346

64-
Begin from the top level directory of this project and use the following
65-
steps to get up and running:
47+
Begin from the top level directory of this project and use the following steps to get up and running:
6648

6749
1. Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads), [Vagrant](http://downloads.vagrantup.com/), [vagrant-hosts](https://github.com/adrienthebo/vagrant-hosts), and [Ansible](http://docs.ansible.com/ansible/intro_installation.html).
6850
2. Edit `/etc/hosts` or use the included `bin/preinstall` script to add
@@ -113,8 +95,7 @@ BOX_NAME=freebsd/FreeBSD-11.0-STABLE CONSUL_IFACE=em1 vagrant up
11395
* VirtualBox version 5.1.30
11496
* Vagrant version 2.0.1
11597
* Vagrant Hosts plugin version 2.8.0
116-
2. This project uses Debian 8 (Jessie) by default, but you can choose another
117-
OS distribution with the *BOX_NAME* environment variable
98+
2. This project uses Debian 9 (Stretch) by default, but you can choose another OS distribution with the *BOX_NAME* environment variable
11899
3. The `bin/preinstall` shell script performs the following actions for you:
119100
* Adds each node's host information to the host machine's `/etc/hosts`
120101
* Optionally installs the Vagrant hosts plugin

examples/Vagrantfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SCRIPT
4040

4141
ANSIBLE_PLAYBOOK = ENV['ANSIBLE_PLAYBOOK'] || "site.yml"
4242
BOX_MEM = ENV['BOX_MEM'] || "1024"
43-
BOX_NAME = ENV['BOX_NAME'] || "debian/jessie64"
43+
BOX_NAME = ENV['BOX_NAME'] || "debian/stretch64"
4444
CLUSTER_HOSTS = ENV['CLUSTER_HOSTS'] || "vagrant_hosts"
4545
CONSUL_ACL_ENABLE = ENV['CONSUL_ACL_ENABLE'] || "false"
4646
CONSUL_ATLAS_ENABLE = ENV['CONSUL_ATLAS_ENABLE'] || "false"
@@ -139,10 +139,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
139139
# extra Ansible variables can be defined here as well. Wheeee!
140140
#
141141
ansible.extra_vars = {
142-
consul_log_level: "DEBUG"
142+
consul_log_level: "DEBUG",
143+
consul_client_address: "10.1.42.230"
143144
}
144145
ansible.playbook = ANSIBLE_PLAYBOOK
145146
ansible.limit = "all"
147+
compatibility_mode = "2.0"
146148
end
147149
end
148150
end

handlers/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# File: main.yml - Handlers for Consul
33

44
- name: restart consul
5-
include: restart_consul.yml
5+
import_tasks: restart_consul.yml
66

77
- name: start consul
8-
include: start_consul.yml
8+
import_tasks: start_consul.yml
99

1010
- name: restart dnsmasq
1111
service:

tasks/main.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
when: is_virtualenv is defined
1818

1919
- name: Include checks/asserts
20-
include: asserts.yml
20+
import_tasks: asserts.yml
2121

2222
- name: Include OS-specific variables
2323
include_vars: "{{ ansible_os_family }}.yml"
@@ -55,10 +55,10 @@
5555
tags: always
5656

5757
- name: Include user and group settings
58-
include: user_group.yml
58+
import_tasks: user_group.yml
5959

6060
- name: Include directory settings
61-
include: dirs.yml
61+
import_tasks: dirs.yml
6262

6363
- name: Check for existing Consul binary
6464
stat:
@@ -70,19 +70,19 @@
7070
consul_install_binary: "{{ consul_install_upgrade or not consul_binary_installed.stat.exists }}"
7171

7272
- name: Install OS packages and consul - locally
73-
include: install.yml
73+
include_tasks: install.yml
7474
when:
7575
- consul_install_binary | bool
7676
- not consul_install_remotely | bool
7777

7878
- name: Install OS packages and consul - remotely
79-
include: install_remote.yml
79+
include_tasks: install_remote.yml
8080
when:
8181
- consul_install_binary | bool
8282
- consul_install_remotely | bool
8383

8484
# XXX: Individual gossip tasks are deprecated and need to be removed
85-
# - include: ../tasks/encrypt_gossip.yml
85+
# - include_tasks: ../tasks/encrypt_gossip.yml
8686
- block:
8787
- block:
8888
- name: Check for gossip encryption key on previously boostrapped server
@@ -159,14 +159,14 @@
159159
- consul_encrypt_enable
160160

161161
- name: Create Consul configuration
162-
include: config.yml
162+
import_tasks: config.yml
163163

164164
- name: Create ACL configuration
165-
include: acl.yml
165+
include_tasks: acl.yml
166166
when: consul_acl_enable | bool
167167

168168
- name: Create TLS configuration
169-
include: tls.yml
169+
include_tasks: tls.yml
170170
when: consul_tls_enable | bool
171171

172172
- block:
@@ -240,7 +240,6 @@
240240
- smfmanifest | changed
241241
- ansible_os_family == "Solaris"
242242

243-
244243
- name: Start Consul
245244
service:
246245
name: consul
@@ -250,7 +249,7 @@
250249
- name: Check Consul HTTP API (via TCP socket)
251250
wait_for:
252251
delay: 15
253-
port: "{{consul_ports.http|int}}"
252+
port: "{{ consul_ports.http|int }}"
254253
host: "{{ consul_addresses.http }}"
255254
when: (consul_ports.http|int > -1) and (consul_addresses.http|ipaddr)
256255

@@ -265,10 +264,10 @@
265264
dest: "{{ consul_bootstrap_state }}"
266265
state: touch
267266

268-
- include: ../tasks/dnsmasq.yml
267+
- include_tasks: ../tasks/dnsmasq.yml
269268
when: consul_dnsmasq_enable | bool
270269

271-
- include: ../tasks/iptables.yml
270+
- include_tasks: ../tasks/iptables.yml
272271
when: consul_iptables_enable | bool
273272

274273
when: not bootstrap_state.stat.exists
@@ -310,15 +309,15 @@
310309
tags: always
311310

312311
- name: (Windows) Include directory settings
313-
include: dirs.yml
312+
import_tasks: dirs.yml
314313

315314
- name: (Windows) Check for existing Consul binary
316315
win_stat:
317316
path: "{{ consul_binary }}"
318317
register: consul_binary_installed
319318

320319
- name: (Windows) Install OS packages and consul
321-
include: install_windows.yml
320+
include_tasks: install_windows.yml
322321
when:
323322
- not consul_binary_installed.stat.exists | bool
324323

@@ -397,7 +396,7 @@
397396
- consul_encrypt_enable
398397

399398
- name: (Windows) Create Consul configuration
400-
include: config_windows.yml
399+
import_tasks: config_windows.yml
401400

402401
- name: (Windows) Ensure neither ACL nor TLS are requested
403402
fail:
@@ -406,11 +405,11 @@
406405
- (consul_acl_enable | bool) or (consul_tls_enable | bool)
407406

408407
- name: (Windows) Create ACL configuration
409-
include: acl.yml
408+
include_tasks: acl.yml
410409
when: consul_acl_enable | bool
411410

412411
- name: (Windows) Create TLS configuration
413-
include: tls.yml
412+
include_tasks: tls.yml
414413
when: consul_tls_enable | bool
415414

416415
- block:
@@ -436,17 +435,16 @@
436435
host: "{{inventory_hostname_short}}"
437436
port: 8500
438437

439-
440438
- name: (Windows) Create bootstrapped state file
441439
win_file:
442440
dest: "{{consul_bootstrap_state}}"
443441
state: touch
444442
when: ansible_os_family == "Windows"
445443

446-
- include: ../tasks/dnsmasq.yml
444+
- include_tasks: ../tasks/dnsmasq.yml
447445
when: consul_dnsmasq_enable | bool
448446

449-
- include: ../tasks/iptables.yml
447+
- include_tasks: ../tasks/iptables.yml
450448
when: consul_iptables_enable | bool
451449

452450
when: not bootstrap_state.stat.exists

templates/config.json.j2

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
"node_name": "{{ consul_node_name }}",
88
"datacenter": "{{ consul_datacenter }}",
99
"domain": "{{ consul_domain }}",
10-
"consul_version": "{{consul_version}}",
11-
{% if consul_version | version_compare('0.7.3', '>=') and
12-
consul_node_meta | length > 0 %}
10+
{% if consul_version | version_compare('0.7.3', '>=') and consul_node_meta | length > 0 %}
1311
"node_meta": {{ consul_node_meta | default({})| to_json }},
1412
{% endif %}
15-
1613
{# Performance Settings #}
1714
"performance": {{ consul_performance | to_json }},
1815

@@ -28,7 +25,7 @@
2825
"dns": "{{ consul_addresses.dns }}",
2926
"http": "{{ consul_addresses.http }}",
3027
"https": "{{ consul_addresses.https }}"
31-
28+
3229
},
3330
{## Ports Used ##}
3431
"ports": {
@@ -90,7 +87,7 @@
9087
{## LAN Join ##}
9188
"retry_interval": "{{ consul_retry_interval }}",
9289
"retry_max": {{ consul_retry_max | int }},
93-
"retry_join":
90+
"retry_join":
9491
{% for server in _consul_lan_servers %}
9592
{% set consul_join = consul_join + [ hostvars[server]['consul_advertise_address'] | default(hostvars[server]['consul_bind_address']) ] %}{% if loop.last %}
9693
{{ consul_join | map('ipwrap') | list | to_json }},

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.30.0
1+
v1.30.1

0 commit comments

Comments
 (0)