DB 에이전트 설치 방식 변경

This commit is contained in:
ByeonJungHun
2024-01-19 10:06:35 +09:00
parent 2a62963b9c
commit b16fca2fbd
22 changed files with 231 additions and 412 deletions

View File

@@ -16,27 +16,21 @@
- name: "Check dsk-postgres-agent"
include_tasks: dsk-postgres-agent.yml
when: '"dsk-postgres-agent" in datasaker_agents'
- name: "Check dsk-plan-postgres-agent"
include_tasks: dsk-plan-postgres-agent.yml
when: '"dsk-plan-postgres-agent" in datasaker_agents'
when:
- '"dsk-postgres-agent" in datasaker_agents'
- '"database" in group_names'
- name: "Check dsk-mysql-agent"
include_tasks: dsk-mysql-agent.yml
when: '"dsk-mysql-agent" in datasaker_agents'
- name: "Check dsk-plan-mysql-agent"
include_tasks: dsk-plan-mysql-agent.yml
when: '"dsk-plan-mysql-agent" in datasaker_agents'
when:
- '"dsk-mysql-agent" in datasaker_agents'
- '"database" in group_names'
- name: "Check dsk-maria-agent"
include_tasks: dsk-maria-agent.yml
when: '"dsk-maria-agent" in datasaker_agents'
- name: "Check dsk-plan-maria-agent"
include_tasks: dsk-plan-maria-agent.yml
when: '"dsk-plan-maria-agent" in datasaker_agents'
when:
- '"dsk-maria-agent" in datasaker_agents'
- '"database" in group_names'
- name: "Check dsk-redis-agent"
include_tasks: dsk-redis-agent.yml

View File

@@ -75,6 +75,20 @@
with_items:
- "{{ datasaker_agents }}"
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- name: "Install datasaker database agent"
apt:
name: "{{ item }}"
state: latest
update_cache: yes
with_items:
- "{{ datasaker_agents }}"
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- "'database' in group_names"
- name: "Check datasaker Agent"
include_tasks: check-agent.yml
@@ -99,4 +113,18 @@
state: restarted
with_items:
- "{{ datasaker_agents }}"
ignore_errors: true
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- name: "Restart dsk-database-agent service"
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: restarted
with_items:
- "{{ datasaker_agents }}"
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- "'database' in group_names"

View File

@@ -8,7 +8,6 @@
mode: '0755'
with_items:
- "{{ datasaker_docker_path }}/agent/dsk-maria-agent"
- "{{ datasaker_docker_path }}/agent/dsk-plan-maria-agent"
- name: "Create agent config"
ansible.builtin.file:
@@ -20,16 +19,6 @@
src: docker-maria-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-docker-maria-config.yml"
- name: "Create agent config"
ansible.builtin.file:
path: "{{ datasaker_docker_path }}/dsk-docker-plan-maria-config.yml"
state: touch
- name: "Setting plan-dsk-maria-agent config"
template:
src: docker-plan-maria-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-docker-plan-maria-config.yml"
- name: "Run dsk-maria-agent container"
docker_container:
name: dsk-docker-maria-agent
@@ -42,18 +31,4 @@
volumes:
- "{{ datasaker_docker_path }}:/var/datasaker/"
- "{{ datasaker_docker_global_config }}:/etc/datasaker/global-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-docker-maria-config.yml:/etc/datasaker/dsk-maria-agent/agent-config.yml:ro"
- name: "Run dsk-plan-maria-agent container"
docker_container:
name: dsk-docker-plan-maria-agent
image: "datasaker/dsk-plan-maria-agent:{{ plan_maria_agent_image_tag }}"
state: started
restart_policy: "{{ plan_maria_agent_restart_policy }}"
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-docker-plan-maria-config.yml:/etc/datasaker/dsk-plan-maria-agent/agent-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-docker-maria-config.yml:/etc/datasaker/dsk-maria-agent/agent-config.yml:ro"

View File

@@ -8,7 +8,6 @@
mode: '0755'
with_items:
- "{{ datasaker_docker_path }}/agent/dsk-mysql-agent"
- "{{ datasaker_docker_path }}/agent/dsk-plan-mysql-agent"
- name: "Create agent config"
ansible.builtin.file:
@@ -20,16 +19,6 @@
src: docker-mysql-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-docker-mysql-config.yml"
- name: "Create agent config"
ansible.builtin.file:
path: "{{ datasaker_docker_path }}/dsk-docker-plan-mysql-config.yml"
state: touch
- name: "Setting plan-dsk-mysql-agent config"
template:
src: docker-plan-mysql-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-docker-plan-mysql-config.yml"
- name: "Run dsk-mysql-agent container"
docker_container:
name: dsk-docker-mysql-agent
@@ -42,18 +31,4 @@
volumes:
- "{{ datasaker_docker_path }}:/var/datasaker/"
- "{{ datasaker_docker_global_config }}:/etc/datasaker/global-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-docker-mysql-config.yml:/etc/datasaker/dsk-mysql-agent/agent-config.yml:ro"
- name: "Run dsk-plan-mysql-agent container"
docker_container:
name: dsk-docker-plan-mysql-agent
image: "datasaker/dsk-plan-mysql-agent:{{ plan_mysql_agent_image_tag }}"
state: started
restart_policy: "{{ plan_mysql_agent_restart_policy }}"
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-docker-plan-mysql-config.yml:/etc/datasaker/dsk-plan-mysql-agent/agent-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-docker-mysql-config.yml:/etc/datasaker/dsk-mysql-agent/agent-config.yml:ro"

View File

@@ -8,7 +8,6 @@
mode: '0755'
with_items:
- "{{ datasaker_docker_path }}/agent/dsk-postgres-agent"
- "{{ datasaker_docker_path }}/agent/dsk-plan-postgres-agent"
- name: "Create agent config"
ansible.builtin.file:
@@ -20,16 +19,6 @@
src: docker-postgres-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-docker-postgres-config.yml"
- name: "Create agent config"
ansible.builtin.file:
path: "{{ datasaker_docker_path }}/dsk-docker-plan-postgres-config.yml"
state: touch
- name: "Setting plan-dsk-postgres-agent config"
template:
src: docker-plan-postgres-agent-config.yml.j2
dest: "{{ datasaker_docker_path }}/dsk-docker-plan-postgres-config.yml"
- name: "Run dsk-postgres-agent container"
docker_container:
name: dsk-docker-postgres-agent
@@ -45,18 +34,4 @@
volumes:
- "{{ datasaker_docker_path }}:/var/datasaker/"
- "{{ datasaker_docker_global_config }}:/etc/datasaker/global-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-docker-postgres-config.yml:/etc/datasaker/dsk-postgres-agent/agent-config.yml:ro"
- name: "Run dsk-plan-postgres-agent container"
docker_container:
name: dsk-docker-plan-postgres-agent
image: "datasaker/dsk-plan-postgres-agent:{{ plan_postgres_agent_image_tag }}"
state: started
restart_policy: "{{ plan_postgres_agent_restart_policy }}"
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-docker-plan-postgres-config.yml:/etc/datasaker/dsk-plan-postgres-agent/agent-config.yml:ro"
- "{{ datasaker_docker_path }}/dsk-docker-postgres-config.yml:/etc/datasaker/dsk-postgres-agent/agent-config.yml:ro"

View File

@@ -1,20 +0,0 @@
---
- name: "Make agent Directory"
ansible.builtin.file:
path: "{{ datasaker_host_path }}/{{ item }}"
state: directory
recurse: yes
owner: root
group: root
with_items:
- "dsk-plan-maria-agent"
- name: "Create agent config"
ansible.builtin.file:
path: "{{ datasaker_host_path }}/dsk-plan-maria-agent/agent-config.yml"
state: touch
- name: "Setting dsk-plan-maria-agent config"
template:
src: plan-maria-agent-config.yml.j2
dest: "{{ datasaker_host_path }}/dsk-plan-maria-agent/agent-config.yml"

View File

@@ -1,20 +0,0 @@
---
- name: "Make agent Directory"
ansible.builtin.file:
path: "{{ datasaker_host_path }}/{{ item }}"
state: directory
recurse: yes
owner: root
group: root
with_items:
- "dsk-plan-mysql-agent"
- name: "Create agent config"
ansible.builtin.file:
path: "{{ datasaker_host_path }}/dsk-plan-mysql-agent/agent-config.yml"
state: touch
- name: "Setting dsk-plan-mysql-agent config"
template:
src: plan-mysql-agent-config.yml.j2
dest: "{{ datasaker_host_path }}/dsk-plan-mysql-agent/agent-config.yml"

View File

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

View File

@@ -48,6 +48,23 @@
- Reload systemd configuration
- Restart {{ item }} service
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- name: "Install datasaker database agent"
yum:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- "{{ datasaker_agents }}"
notify:
- Reload systemd configuration
- Restart {{ item }} service
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- "'database' in group_names"
- name: "Check datasaker Agent"
include_tasks: check-agent.yml
@@ -67,4 +84,18 @@
enabled: true
with_items:
- "{{ datasaker_agents }}"
ignore_errors: true
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- name: "Restart dsk-agent database service"
systemd_service:
state: restarted
name: "{{ item }}"
enabled: true
with_items:
- "{{ datasaker_agents }}"
ignore_errors: true
when:
- "item != 'dsk-maria-agent' and item != 'dsk-mysql-agent' and item != 'dsk-postgres-agent'"
- "'database' in group_names"