mirror of
https://github.com/natelandau/ansible-homelab-config.git
synced 2025-11-18 01:43:40 -05:00
Consul updates
- Docker compose file uses Consul version - add environment variable to disable chmod on Docker container start https://github.com/hashicorp/docker-consul/issues/20 - Update consul permissions on disk
This commit is contained in:
@@ -148,7 +148,7 @@
|
|||||||
when:
|
when:
|
||||||
- ansible_os_family == 'Debian'
|
- ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: "set owner of files to {{ ansible_user_uid }}:{{ ansible_user_gid }} (MacOSX)"
|
- name: "set owner of files to {{ ansible_user_uid }}:{{ ansible_user_gid }}"
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ consul_opt_dir }}"
|
path: "{{ consul_opt_dir }}"
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
group: "{{ ansible_user_gid }}"
|
group: "{{ ansible_user_gid }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
when:
|
when:
|
||||||
- ansible_os_family != 'Debian'
|
- mac_intel or mac_arm or inventory_hostname == 'synology'
|
||||||
|
|
||||||
- name: "Template out Consul configuration file"
|
- name: "Template out Consul configuration file"
|
||||||
block:
|
block:
|
||||||
@@ -184,10 +184,30 @@
|
|||||||
when:
|
when:
|
||||||
- ansible_os_family == 'Debian'
|
- ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: "set owner of files to {{ ansible_user_uid }}:{{ ansible_user_gid }}"
|
||||||
|
become: true
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ interpolated_consul_configuration_dir }}"
|
||||||
|
owner: "{{ ansible_user_uid }}"
|
||||||
|
group: "{{ ansible_user_gid }}"
|
||||||
|
recurse: true
|
||||||
|
when:
|
||||||
|
- mac_intel or mac_arm or inventory_hostname == 'synology'
|
||||||
|
|
||||||
|
- name: "set owner of root consul dir to {{ ansible_user_uid }}:{{ ansible_user_gid }} (synology)"
|
||||||
|
become: true
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /volume1/docker/consul/
|
||||||
|
owner: "{{ ansible_user_uid }}"
|
||||||
|
group: "{{ ansible_user_gid }}"
|
||||||
|
recurse: true
|
||||||
|
when:
|
||||||
|
- inventory_hostname == 'synology'
|
||||||
|
|
||||||
- name: "Install Consul binary"
|
- name: "Install Consul binary"
|
||||||
block:
|
block:
|
||||||
- name: "set fact: need install consul?"
|
- name: "set fact: need install consul?"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
need_consul_install: false
|
need_consul_install: false
|
||||||
when:
|
when:
|
||||||
- consul_download_uri is defined
|
- consul_download_uri is defined
|
||||||
@@ -200,7 +220,7 @@
|
|||||||
- consul_download_uri is defined
|
- consul_download_uri is defined
|
||||||
|
|
||||||
- name: "set fact: need consul install?"
|
- name: "set fact: need consul install?"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
need_consul_install: true
|
need_consul_install: true
|
||||||
when:
|
when:
|
||||||
- consul_download_uri is defined
|
- consul_download_uri is defined
|
||||||
@@ -218,7 +238,7 @@
|
|||||||
- not need_consul_install
|
- not need_consul_install
|
||||||
|
|
||||||
- name: "set fact: need consul install?"
|
- name: "set fact: need consul install?"
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
need_consul_install: true
|
need_consul_install: true
|
||||||
when:
|
when:
|
||||||
- consul_download_uri is defined
|
- consul_download_uri is defined
|
||||||
@@ -277,7 +297,7 @@
|
|||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "launchctl load -w {{ consul_plist_macos }}"
|
cmd: "launchctl load -w {{ consul_plist_macos }}"
|
||||||
when:
|
when:
|
||||||
- ansible_os_family == 'Darwin'
|
- mac_intel or mac_arm
|
||||||
- "'nostart' not in ansible_run_tags"
|
- "'nostart' not in ansible_run_tags"
|
||||||
|
|
||||||
- name: start Consul (Debian)
|
- name: start Consul (Debian)
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ version: '3.9'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
consul:
|
consul:
|
||||||
image: consul:latest
|
image: consul:{{ consul_version }}
|
||||||
hostname: consul
|
hostname: consul
|
||||||
container_name: consul
|
container_name: consul
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
|
environment:
|
||||||
|
- CONSUL_DISABLE_PERM_MGMT=
|
||||||
volumes:
|
volumes:
|
||||||
- /volume1/docker/consul/data:/consul/data
|
- /volume1/docker/consul/data:/consul/data
|
||||||
- /volume1/docker/consul/config:/consul/config
|
- /volume1/docker/consul/config:/consul/config
|
||||||
|
|||||||
Reference in New Issue
Block a user