template 추가
This commit is contained in:
@@ -31,3 +31,4 @@ dsk_public_gpg_key: "https://dsk-agent-s3.s3.ap-northeast-2.amazonaws.com/dsk-ag
|
||||
|
||||
|
||||
datasaker_agents: []
|
||||
|
||||
|
||||
20
tasks/check-agent.yml
Normal file
20
tasks/check-agent.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Check dsk-node-agent
|
||||
include_tasks: dsk-node-agent.yml
|
||||
when: '"dsk-node-agent" in datasaker_agents'
|
||||
|
||||
- name: Check dsk-trace-agent
|
||||
include_tasks: dsk-trace-agent.yml
|
||||
when: '"dsk-trace-agent" in datasaker_agents'
|
||||
|
||||
- name: Check dsk-log-agent
|
||||
include_tasks: dsk-log-agent.yml
|
||||
when: '"dsk-log-agent" in datasaker_agents'
|
||||
|
||||
- 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'
|
||||
@@ -1,26 +1,4 @@
|
||||
---
|
||||
# - name: test
|
||||
# debug:
|
||||
# msg: "{{ item }}"
|
||||
# with_items:
|
||||
# - "{{ datagate_trace_url }}"
|
||||
# - "{{ datagate_trace_port }}"
|
||||
# - "{{ datagate_trace_timeout }}"
|
||||
# - "{{ datagate_manifes_url }}"
|
||||
# - "{{ datagate_manifest_port }}"
|
||||
# - "{{ datagate_manifest_timeout }}"
|
||||
# - "{{ datagate_metric_url }}"
|
||||
# - "{{ datagate_metric_port }}"
|
||||
# - "{{ datagate_metric_timeout }}"
|
||||
# - "{{ datagate_plan_url }}"
|
||||
# - "{{ datagate_plan_port }}"
|
||||
# - "{{ datagate_plan_timeout }}"
|
||||
# - "{{ datagate_loggate_url }}"
|
||||
# - "{{ datagate_loggate_port }}"
|
||||
# - "{{ datagate_loggate_timeout }}"
|
||||
# - "{{ datasaker_api_url }}"
|
||||
# - "{{ datasaker_api_send_interval }}"
|
||||
|
||||
- name: "Setting global-config"
|
||||
template:
|
||||
src: global-config.yml.j2
|
||||
@@ -38,7 +16,7 @@
|
||||
dest: "{{ tempdir.path }}/datasaker.gpg.key"
|
||||
force: yes
|
||||
|
||||
- name: "Ensure downloaded file for {{ key_fingerprint }} is a binary keyring"
|
||||
- name: "Ensure downloaded file for binary keyring"
|
||||
shell: "cat {{ tempdir.path }}/datasaker.gpg.key | sudo gpg --import --batch --no-default-keyring --keyring {{ apt_usr_share_keyring }}"
|
||||
|
||||
- name: "copy keyring to trusted keyring"
|
||||
@@ -53,19 +31,16 @@
|
||||
path: "{{ tempdir.path }}"
|
||||
state: absent
|
||||
|
||||
#- name: Import datasaker GPG key
|
||||
# apt_key:
|
||||
# url: https://dsk-agent-s3.s3.ap-northeast-2.amazonaws.com/dsk-agent-s3/public/public.gpg.key
|
||||
# state: present
|
||||
# become: true
|
||||
|
||||
- name: Add datasaker repository
|
||||
- name: "Add datasaker repository"
|
||||
apt_repository:
|
||||
repo: "deb [signed-by={{ apt_usr_share_keyring }}] https://nexus.exem-oss.org/repository/debian-repos/ ubuntu main"
|
||||
state: present
|
||||
filename: datasaker.list
|
||||
|
||||
- name: Install required packages
|
||||
- name: "Check datasaker Agent"
|
||||
include_tasks: check-agent.yml
|
||||
|
||||
- name: "Install datasaker agent"
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
@@ -74,3 +49,12 @@
|
||||
- "{{ datasaker_agents }}"
|
||||
notify:
|
||||
- Restart {{ item }} service
|
||||
|
||||
# - name: "Ensure datasaker agent is running"
|
||||
# service:
|
||||
# name: "{{ item }}"
|
||||
# state: started
|
||||
# enabled: yes
|
||||
# with_items:
|
||||
# - "{{ datasaker_agents }}"
|
||||
|
||||
|
||||
15
tasks/dsk-log-agent.yml
Normal file
15
tasks/dsk-log-agent.yml
Normal 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-log-agent"
|
||||
|
||||
- name: "Setting dsk-log-agent config"
|
||||
template:
|
||||
src: log-agent-config.yml.j2
|
||||
dest: "/etc/datasaker/dsk-log-agent/agent-config.yml"
|
||||
15
tasks/dsk-node-agent.yml
Normal file
15
tasks/dsk-node-agent.yml
Normal 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-node-agent"
|
||||
|
||||
- name: "Setting dsk-node-agent config"
|
||||
template:
|
||||
src: node-agent-config.yml.j2
|
||||
dest: "/etc/datasaker/dsk-node-agent/agent-config.yml"
|
||||
15
tasks/dsk-plan-postgres-agent.yml
Normal file
15
tasks/dsk-plan-postgres-agent.yml
Normal 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-plan-postgres-agent"
|
||||
|
||||
- name: "Setting dsk-plan-postgres-agent config"
|
||||
template:
|
||||
src: plan-postgres-agent-config.yml.j2
|
||||
dest: "/etc/datasaker/dsk-plan-postgres-agent/agent-config.yml"
|
||||
15
tasks/dsk-trace-agent.yml
Normal file
15
tasks/dsk-trace-agent.yml
Normal 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-trace-agent"
|
||||
|
||||
- name: "Setting dsk-trace-agent config"
|
||||
template:
|
||||
src: trace-agent-config.yml.j2
|
||||
dest: "/etc/datasaker/dsk-trace-agent/agent-config.yml"
|
||||
12
tasks/main copy.yml
Normal file
12
tasks/main copy.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Include Gather Ansible Facts task on Ansible >= 2.10
|
||||
include_tasks: gather-facts.yml
|
||||
when: ansible_version.major >= 2 and ansible_version.minor >= 10
|
||||
|
||||
- name: Include Datasaker Add Repository
|
||||
include_tasks: dsk-common.yml
|
||||
when: ansible_facts.os_family == "Debian"
|
||||
|
||||
- name: Include Datasaker Host Agent Install
|
||||
include_tasks: dsk-debian-pkg.yml
|
||||
when: ansible_facts.os_family == "Debian"
|
||||
@@ -9,4 +9,4 @@
|
||||
|
||||
- name: Include Datasaker Host Agent Install
|
||||
include_tasks: dsk-debian-pkg.yml
|
||||
when: ansible_facts.os_family == "Debian"
|
||||
when: ansible_facts.os_family == "Debian"
|
||||
|
||||
35
templates/log-agent-config.yml.j2
Normal file
35
templates/log-agent-config.yml.j2
Normal file
@@ -0,0 +1,35 @@
|
||||
agent:
|
||||
metadata:
|
||||
agent_name: "{{ log_agent_name | default('dsk-log-agent') }}"
|
||||
cluster_id: "{{ log_agent_cluster_id | default('unknown') }}"
|
||||
environment: "{{ log_agent_environment | default('etc') }}"
|
||||
collect:
|
||||
- paths:
|
||||
{% if paths is defined and paths | length > 0 %}
|
||||
{% for path in paths %}
|
||||
- "{{ path | default('') }}"
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
- /var/log/*/*.log
|
||||
{% endif %}
|
||||
{% if exclude_paths is defined and exclude_paths | length > 0 %}
|
||||
exclude_paths:
|
||||
{% for exclude_path in exclude_paths %}
|
||||
- "{{ exclude_path | default('') }}"
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
exclude_paths: []
|
||||
{% endif %}
|
||||
{% if keywords is defined and keywords | length > 0 %}
|
||||
keywords:
|
||||
{% for keyword in keywords %}
|
||||
- "{{ keyword | default('') }}"
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
keywords: []
|
||||
{% endif %}
|
||||
tag: "{{ log_agent_tag | default('sample') }}"
|
||||
service:
|
||||
name: "{{ log_agent_service_name | default('test') }}"
|
||||
category: "{{ log_agent_service_category | default('etc') }}"
|
||||
type: "{{ log_agent_service_type | default('etc') }}"
|
||||
37
templates/log-agent-config.yml.j2_bak
Normal file
37
templates/log-agent-config.yml.j2_bak
Normal file
@@ -0,0 +1,37 @@
|
||||
agent:
|
||||
metadata:
|
||||
agent_name: "{{ log_agent_name | default('dsk-log-agent') }}"
|
||||
cluster_id: "{{ log_agent_cluster_id | default('unknown') }}"
|
||||
environment: "{{ log_agent_environment | default('etc') }}"
|
||||
collect:
|
||||
- paths:
|
||||
{% if paths is defined and paths | length > 0 %}
|
||||
{% for path in paths %}
|
||||
- "{{ path | default('') }}"
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
- /var/log/*/*.log
|
||||
{% endif %}
|
||||
|
||||
{% if exclude_paths is defined and exclude_paths | length > 0 %}
|
||||
exclude_paths:
|
||||
{% for exclude_path in exclude_paths %}
|
||||
- "{{ exclude_path | default('') }}"
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
exclude_paths: []
|
||||
{% endif %}
|
||||
|
||||
{% if keywords is defined and keywords | length > 0 %}
|
||||
keywords:
|
||||
{% for keyword in keywords %}
|
||||
- "{{ keyword | default('') }}"
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
keywords: []
|
||||
{% endif %}
|
||||
tag: "{{ log_agent_tag | default('sample') }}"
|
||||
service:
|
||||
name: "{{ log_agent_service_name | default('test') }}"
|
||||
category: "{{ log_agent_service_category | default('etc') }}"
|
||||
type: "{{ log_agent_service_type | default('etc') }}"
|
||||
18
templates/node-agent-config.yml.j2
Normal file
18
templates/node-agent-config.yml.j2
Normal file
@@ -0,0 +1,18 @@
|
||||
agent:
|
||||
metadata:
|
||||
# agent_name: my-dsk-node-agent
|
||||
# cluster_id: my-cluster
|
||||
option:
|
||||
exporter_config:
|
||||
command: "dsk-node-exporter"
|
||||
port: 19110
|
||||
args:
|
||||
- --collector.filesystem.ignored-mount-points="^/(dev|proc|sys|run|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/)"
|
||||
- --collector.tcpstat
|
||||
scrape_interval: 15s
|
||||
scrape_timeout: 5s
|
||||
scrape_configs:
|
||||
- job_name: dsk-node-agent
|
||||
url: localhost:19110
|
||||
filtering_configs:
|
||||
rule: drop
|
||||
18
templates/plan-postgres-agent-config.yml.j2
Normal file
18
templates/plan-postgres-agent-config.yml.j2
Normal file
@@ -0,0 +1,18 @@
|
||||
agent:
|
||||
metadata:
|
||||
agent_name: "{{ plan_postgres_agent_name | default('dsk-plan-postgres-agent') }}"
|
||||
cluster_id: "{{ plan_postgres_agent_cluster_id | default('REPLACE_CLUSTER_ID') }}"
|
||||
data_source_name:
|
||||
user: "{{ plan_postgres_user_name | default('') }}"
|
||||
password: "{{ plan_postgres_user_password | default('') }}"
|
||||
address: "{{ plan_postgres_database_address | default('') }}"
|
||||
port: "{{ plan_postgres_database_port | default('') }}"
|
||||
DBName: "{{ plan_postgres_database_name | default('') }}"
|
||||
explain:
|
||||
scrape_interval: "{{ plan_postgres_scrape_interval | default('30s') }}"
|
||||
scrape_timeout: "{{ plan_postgres_scrape_timeout | default('5s') }}"
|
||||
slow_query_standard: "{{ plan_postgres_slow_query_standard | default('5s') }}"
|
||||
executor_number: "{{ plan_postgres_executor_number | default('10') }}"
|
||||
sender_number: "{{ plan_postgres_sender_number | default('10') }}"
|
||||
activity_query_buffer: "{{ plan_postgres_activity_query_buffer | default('50') }}"
|
||||
plan_sender_buffer: "{{ plan_postgres_plan_sender_buffer | default('50') }}"
|
||||
5
templates/trace-agent-config.yml.j2
Normal file
5
templates/trace-agent-config.yml.j2
Normal file
@@ -0,0 +1,5 @@
|
||||
agent:
|
||||
metadata:
|
||||
option:
|
||||
agent_name: "{{ trace_agent_name | default('trace-agent') }}"
|
||||
cluster_id: "{{ trace_agent_cluster_id | default('unknown_cluster') }}"
|
||||
Reference in New Issue
Block a user