From e4ce580944e82691dc6060e451b30798eda62122 Mon Sep 17 00:00:00 2001 From: wangjian Date: Wed, 4 Dec 2024 11:14:47 +0800 Subject: [PATCH] add pilotgo standalone and multi deploy methods --- playbook/group_vars/all | 5 +- playbook/host-multi-machine | 20 ++++++-- playbook/multi-machine.yml | 7 +++ playbook/roles/pilotgo/tasks/main.yml | 13 +++++ playbook/standalone.yml | 1 + .../templates/pilotgo/config_server.yaml.j2 | 51 +++++++++++++++++++ 6 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 playbook/roles/pilotgo/tasks/main.yml create mode 100755 playbook/templates/pilotgo/config_server.yaml.j2 diff --git a/playbook/group_vars/all b/playbook/group_vars/all index 3cbac5e..1a42c0d 100644 --- a/playbook/group_vars/all +++ b/playbook/group_vars/all @@ -3,4 +3,7 @@ password_for_all_es_users: Kylinmanager13579! needSSL: true kibana_ssl_crt_file: /opt/kibana/config/certs/kibana-server/kibana-server.crt kibana_ssl_key_file: /opt/kibana/config/certs/kibana-server/kibana-server.key -kibana_elastic_ca_file: /opt/kibana/config/certs/kibana/elasticsearch-ca.pem \ No newline at end of file +kibana_elastic_ca_file: /opt/kibana/config/certs/kibana/elasticsearch-ca.pem +redis_password: "PilotGo13579!" +mysql_password: "PilotGo13579!" +pilotgo_config: /opt/PilotGo/server/config_server.yaml \ No newline at end of file diff --git a/playbook/host-multi-machine b/playbook/host-multi-machine index e39d925..8256666 100644 --- a/playbook/host-multi-machine +++ b/playbook/host-multi-machine @@ -1,11 +1,23 @@ [elasticsearch] -10.41.160.165 +1.1.1.1 [kibana] -10.41.160.165 +2.2.2.2 [fleet] -10.41.160.164 +3.3.3.3 [filebeat] -10.41.160.165 \ No newline at end of file +4.4.4.4 + +[pilotgo] +5.5.5.5 + +[pilotgo-agent] +5.5.6.6 + +[elk] +6.6.6.6 + +[elk-agent] +6.6.7.7 \ No newline at end of file diff --git a/playbook/multi-machine.yml b/playbook/multi-machine.yml index b8fd15e..853212f 100644 --- a/playbook/multi-machine.yml +++ b/playbook/multi-machine.yml @@ -120,3 +120,10 @@ roles: - filebeat + +- name: pilotgo install + hosts: pilotgo + remote_user: root + + roles: + - pilotgo \ No newline at end of file diff --git a/playbook/roles/pilotgo/tasks/main.yml b/playbook/roles/pilotgo/tasks/main.yml new file mode 100644 index 0000000..0f205e2 --- /dev/null +++ b/playbook/roles/pilotgo/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: install pilotgo-server + dnf: + name: PilotGo-server + state: present + register: pilotgo_info + ignore_errors: yes +- name: exit when pilotgo-server fail install + fail: + msg: 'dnf install PilotGo-server failed' + when: pilotgo_info.rc != 0 +- name: change PilotGo config + template: src=templates/pilotgo/config_server.yaml.j2 dest={{ pilotgo_config }} \ No newline at end of file diff --git a/playbook/standalone.yml b/playbook/standalone.yml index eb50964..d32ff47 100644 --- a/playbook/standalone.yml +++ b/playbook/standalone.yml @@ -3,6 +3,7 @@ remote_user: root roles: + - pilotgo - elasticsearch - kibana - fleet diff --git a/playbook/templates/pilotgo/config_server.yaml.j2 b/playbook/templates/pilotgo/config_server.yaml.j2 new file mode 100755 index 0000000..b852c53 --- /dev/null +++ b/playbook/templates/pilotgo/config_server.yaml.j2 @@ -0,0 +1,51 @@ +http_server: + addr: 0.0.0.0:8888 + session_count: 100 + session_max_age: 1800 + # if true, will start pprof on :6060 + debug: false + use_https: false + cert_file: "" + key_file: "" +socket_server: + addr: 0.0.0.0:8879 +jwt: + secret_key: "" +log: + level: debug + # 可选stdout和file.stdout:输出到终端控制台;file:输出到path下的指定文件。 + driver: file + path: ./log/pilotgo_server.log + max_file: 1 + max_size: 10485760 +mysql: + {% if groups | length == 1 %} + + host_name: {{ groups['standalone'][0] }} + {% else %} + + host_name: {{ groups['mysql'][0] }} + {% endif %} + # this is the username of database + user_name: root + password: "{{ mysql_password }}" + data_base: PilotGo + port: 3306 +redis: + {% if groups | length == 1 %} + + redis_conn: {{ groups['standalone'][0] }}:6379 + {% else %} + + redis_conn: {{ groups['redis'][0] }}:6379 + {% endif %} + use_tls: false + redis_pwd: "{{ redis_password }}" + defaultDB: 0 + # redis连接超时时间.默认5s + dialTimeout: 5s + # 是否启用redis + enableRedis: true +storage: + # 文件服务存储路径 + path: "/opt/PilotGo/server/resource" -- Gitee