This commit is contained in:
havelight-ee
2023-06-21 17:38:49 +09:00
parent a4a3c489da
commit a209a9b25c
10 changed files with 123 additions and 47 deletions

View File

@@ -26,6 +26,7 @@
command: "-global.config=/etc/datasaker/global-config.yml -agent.config=/etc/datasaker/dsk-log-agent/agent-config.yml -mount.volume=true"
volumes:
- "{{ datasaker_docker_path }}:/var/datasaker/"
- "/var/lib/docker/containers/:/var/datasaker/log/:ro"
- "{{ datasaker_docker_global_config }}:/etc/datasaker/global-config.yml:ro"
- "{{ datasaker_docker_path }}/log-agent-config.yml:/etc/datasaker/dsk-log-agent/agent-config.yml:ro"
- "{{ item }}"
loop: "{{ custom_log_volume | default(['{{ docker_default_path }}:/var/log/sample/:ro']) }}"

View File

@@ -1,2 +1,52 @@
---
- name: "Create datasaker local directory"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{datasaker_docker_user}}"
group: "{{datasaker_docker_group}}"
mode: '0755'
with_items:
- "{{ datasaker_docker_path }}/agent/dsk-postgres-agent"
- "{{ datasaker_docker_path }}/agent/dsk-plan-postgres-agent"
- name: "Setting dsk-postgres-agent config"
template:
src: postgres-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-postgres-config.yml"
- name: "Setting plan-dsk-postgres-agent config"
template:
src: plan-postgres-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-plan-postgres-config.yml"
- name: "Run dsk-postgres-agent container"
docker_container:
name: dsk-postgres-agent
image: datasaker/dsk-postgres-agent:rel0.1.2
state: started
restart_policy: always
detach: true
env:
DKS_LOG_LEVEL: "info"
DATA_SOURCE_USER: "{{ postgres_user_name | default('') }}"
DATA_SOURCE_PASS: "{{ postgres_user_password | default('') }}"
DATA_SOURCE_URI: "{{ postgres_database_address | default('') }}:{{ postgres_database_port | default('') }}?sslmode=disable"
volumes:
- "{{ datasaker_docker_path }}:/var/datasaker/"
- "{{ datasaker_docker_global_config }}:/etc/datasaker/global-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-postgres-config.yml:/etc/datasaker/dsk-postgres-agent/agent-config.yml:ro"
- name: "Run dsk-plan-postgres-agent container"
docker_container:
name: dsk-plan-postgres-agent
image: datasaker/dsk-plan-postgres-agent:latest
state: started
restart_policy: always
detach: true
env:
DKS_LOG_LEVEL: "info"
volumes:
- "{{ datasaker_docker_path }}:/var/datasaker/"
- "{{ datasaker_docker_global_config }}:/etc/datasaker/global-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-plan-postgres-config.yml:/etc/datasaker/dsk-plan-postgres-agent/agent-config.yml:ro"

View File

@@ -0,0 +1,15 @@
---
- name: "Make agent Directory"
ansible.builtin.file:
path: "/etc/datasaker/{{ item }}"
state: directory
recurse: yes
owner: root
group: root
with_items:
- "dsk-postgres-agent"
- name: "Setting dsk-postgres-agent config"
template:
src: postgres-agent-config.yml.j2
dest: "/etc/datasaker/dsk-postgres-agent/agent-config.yml"

View File

@@ -64,4 +64,14 @@
name: "{{datasaker_docker_group}}"
state: absent
when: datasaker_clean == True
ignore_errors: yes
ignore_errors: yes
- name: "Remove datasaker_docker_directory"
ansible.builtin.file:
name: "{{ item }}"
state: absent
when: datasaker_clean == True
ignore_errors: yes
with_items:
- "{{ datasaker_docker_config_path }}"
- "{{ datasaker_docker_path }}"