adds consul configuration files
This commit is contained in:
		
							parent
							
								
									4112d38dd9
								
							
						
					
					
						commit
						2185a79d8f
					
				
					 3 changed files with 29 additions and 4 deletions
				
			
		| 
						 | 
					@ -10,5 +10,9 @@ addresses {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ports {
 | 
					ports {
 | 
				
			||||||
  grpc  = 8502
 | 
					  grpc_tls  = 8502
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ui_config {
 | 
				
			||||||
 | 
					  enabled = true
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,7 @@ encrypt = "{{ consul_generated_encrypt_key }}"
 | 
				
			||||||
verify_incoming = true
 | 
					verify_incoming = true
 | 
				
			||||||
verify_outgoing = true
 | 
					verify_outgoing = true
 | 
				
			||||||
verify_server_hostname = true
 | 
					verify_server_hostname = true
 | 
				
			||||||
bind_addr = "{{ GetPrivateInterfaces | include \"network\" \"10.10.0.0/24\" | attr \"address\" }}"
 | 
					bind_addr = "{% raw %}{{ GetPrivateInterfaces | include \"network\" \"10.10.0.0/24\" | attr \"address\" }}{% endraw %}"
 | 
				
			||||||
client_addr = "0.0.0.0"
 | 
					client_addr = "0.0.0.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ca_file = "/etc/consul.d/consul-agent-ca.pem"
 | 
					ca_file = "/etc/consul.d/consul-agent-ca.pem"
 | 
				
			||||||
| 
						 | 
					@ -15,8 +15,9 @@ auto_encrypt {
 | 
				
			||||||
  allow_tls = true
 | 
					  allow_tls = true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO: add jinja template to add all except destination host address here
 | 
					# This ugly line is to get the IP addresses of the other consul servers, excluding the current host.
 | 
				
			||||||
retry_join = []
 | 
					# Consul cannot join itself, so we need to exclude the current host.
 | 
				
			||||||
 | 
					retry_join = ["{{ groups.nomad|difference([inventory_hostname])| map('extract', hostvars, ['ansible_host'])|join('","') }}"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
acl {
 | 
					acl {
 | 
				
			||||||
  enabled = false
 | 
					  enabled = false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										20
									
								
								ansible/templates/consul.service
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								ansible/templates/consul.service
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,20 @@
 | 
				
			||||||
 | 
					[Unit]
 | 
				
			||||||
 | 
					Description="HashiCorp Consul - A service mesh solution"
 | 
				
			||||||
 | 
					Documentation=https://www.consul.io/
 | 
				
			||||||
 | 
					Requires=network-online.target
 | 
				
			||||||
 | 
					After=network-online.target
 | 
				
			||||||
 | 
					ConditionFileNotEmpty=/etc/consul.d/consul.hcl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Service]
 | 
				
			||||||
 | 
					EnvironmentFile=-/etc/consul.d/consul.env
 | 
				
			||||||
 | 
					User=consul
 | 
				
			||||||
 | 
					Group=consul
 | 
				
			||||||
 | 
					ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d/
 | 
				
			||||||
 | 
					ExecReload=/bin/kill --signal HUP $MAINPID
 | 
				
			||||||
 | 
					KillMode=process
 | 
				
			||||||
 | 
					KillSignal=SIGTERM
 | 
				
			||||||
 | 
					Restart=on-failure
 | 
				
			||||||
 | 
					LimitNOFILE=65536
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Install]
 | 
				
			||||||
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
		Loading…
	
		Reference in a new issue