51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
---
|
|
# Tasks for InfluxDB role
|
|
- getent:
|
|
database: passwd
|
|
key: "{{ influx_user }}"
|
|
split: ":"
|
|
|
|
- name: Pull InfluxDB image
|
|
docker_image:
|
|
name: "{{ influx_image }}"
|
|
source: pull
|
|
force_source: yes
|
|
|
|
- name: Ensure Influx Directory exists
|
|
file:
|
|
path: "{{ influx_directory }}"
|
|
state: directory
|
|
group: "{{ influx_user }}"
|
|
owner: "{{ influx_user }}"
|
|
mode: 0755
|
|
|
|
- name: Ensure Influx Data Directory exists
|
|
file:
|
|
path: "{{ influx_directory }}/data"
|
|
state: directory
|
|
group: "{{ influx_user }}"
|
|
owner: "{{ influx_user }}"
|
|
mode: 0755
|
|
|
|
- name: Ensure Influx Config Directory exists
|
|
file:
|
|
path: "{{ influx_directory }}/config"
|
|
state: directory
|
|
group: "{{ influx_user }}"
|
|
owner: "{{ influx_user }}"
|
|
mode: 0755
|
|
|
|
- name: Create InfluxDB container
|
|
docker_container:
|
|
name: "{{ influx_container }}"
|
|
image: "{{ influx_image }}"
|
|
state: started
|
|
restart_policy: "unless-stopped"
|
|
user: "{{ getent_passwd[influx_user][1] }}:{{ getent_passwd[influx_user][2] }}"
|
|
published_ports:
|
|
- 127.0.0.1:8088:8086
|
|
volumes:
|
|
- "{{ influx_directory }}/data:/var/lib/influxdb2"
|
|
- "{{ influx_directory }}/config:/etc/influxdb2"
|
|
|