Skip to content

Instantly share code, notes, and snippets.

@shantanoo-desai
Last active August 29, 2022 13:31
Show Gist options
  • Save shantanoo-desai/13dd1c5609bbe32142ef073d29f53a75 to your computer and use it in GitHub Desktop.
Save shantanoo-desai/13dd1c5609bbe32142ef073d29f53a75 to your computer and use it in GitHub Desktop.
version: "3"
services:
chronograf:
image: chronograf:{{ services.chronograf.version }}
container_name: chronograf
{% if 'influxdb' in services %}
depends_on:
- influxdb
{% endif %}
environment:
- BASE_PATH=/chronograf
{% if 'influxdb' in services %}
- INFLUXDB_URL=http://influxdb:8086
{% endif %}
hostname: chronograf
labels:
- "traefik.enable=true"
- "traefik.http.routers.chronograf-router=chronograf-router@file"
- "traefik.http.routers.chronograf-router.service=chronograf@file"
security_opt:
- "no-new-privileges:true"
volumes:
- chronograf:/var/lib/chronograf
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
volumes:
chronograf:
version: "3"
services:
influxdb:
container_name: influxdb
image: influxdb:{{ services.influxdb.version }}
environment:
- INFLUXDB_HTTP_AUTH_ENABLED=true
- INFLUXDB_REPORTING_DISABLED=true
- INFLUXDB_DATA_QUERY_LOG_ENABLED=false
- INFLUXDB_HTTP_LOG_ENABLED=false
- INFLUXDB_CONTINUOUS_QUERIES_LOG_ENABLED=false
hostname: populo-influxdb
security_opt:
- "no-new-privileges:true"
volumes:
- influxdb:/var/lib/influxdb
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
volumes:
influxdb:
TASK [pacedge : Copy Services Compose Files] *********************************************************************************************************************************************************
ok: [localhost] => (item=chronograf)
ok: [localhost] => (item=influxdb)
TASK [pacedge : Docker Compose with multiple Compose Files (v2)] *************************************************************************************************************************************
ok: [localhost] => (item=influxdb)
failed: [localhost] (item=chronograf) => {"ansible_loop_var": "item", "changed": false, "item": "chronograf", "msg": "Configuration error - Service 'chronograf' depends on service 'influxdb' which is undefined."}
PLAY RECAP *******************************************************************************************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
---
- host: all
tasks:
- name: Copy Services Compose Files
template:
src: "services/docker-compose.{{ item }}.yml.j2"
dest: "/home/test/influxstack/docker-compose.{{ item }}.yml"
with_items:
- "{{ services.keys() }}"
- name: Docker Compose with multiple Compose Files (v2)
community.docker.docker_compose:
project_name: influxstack
project_src: /home/test/influxstack
files:
- "docker-compose.{{ item }}.yml"
state: present
with_items:
- "{{ services.keys() | sort(reverse=True) }}" # Try bringing influxdb up first since chronograf depends on it!
@shantanoo-desai
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment