From ac9bda2802842fe1f4ccb78769ce48b27afb2be3 Mon Sep 17 00:00:00 2001 From: wangjian Date: Wed, 4 Dec 2024 11:26:54 +0800 Subject: [PATCH] optimize pilotgo config modify method --- playbook/groups_vars/all | 1 + playbook/roles/pilotgo/tasks/main.yml | 20 +--------- .../templates/pilotgo/config_server.yaml.j2 | 39 +++++++++++++++++++ 3 files changed, 41 insertions(+), 19 deletions(-) create mode 100755 playbook/templates/pilotgo/config_server.yaml.j2 diff --git a/playbook/groups_vars/all b/playbook/groups_vars/all index 41df52f..4c738eb 100644 --- a/playbook/groups_vars/all +++ b/playbook/groups_vars/all @@ -4,6 +4,7 @@ mysql_password: "PilotGo13579!" redis_password: "PilotGo13579!" neo4j_username: neo4j neo4j_password: PilotGo13579! +pilotgo_config: /opt/PilotGo/server/config_server.yaml pilotgo_agent_config: /opt/PilotGo/agent/config_agent.yaml pilotgo_topo_config: /opt/PilotGo/plugin/topology/server/topo_server.yaml pilotgo_topo_agent_config: /opt/PilotGo/plugin/topology/agent/topo_agent.yaml \ No newline at end of file diff --git a/playbook/roles/pilotgo/tasks/main.yml b/playbook/roles/pilotgo/tasks/main.yml index 3917288..0f205e2 100644 --- a/playbook/roles/pilotgo/tasks/main.yml +++ b/playbook/roles/pilotgo/tasks/main.yml @@ -10,22 +10,4 @@ msg: 'dnf install PilotGo-server failed' when: pilotgo_info.rc != 0 - name: change PilotGo config - shell: sed -i '/^http_server:/,+1 s/0\.0\.0\.0/{{ groups['pilotgo'][0] }}/' /opt/PilotGo/server/config_server.yaml -- name: change PilotGo config - shell: sed -i '/^socket_server:/,+1 s/0\.0\.0\.0/{{ groups['pilotgo'][0] }}/' /opt/PilotGo/server/config_server.yaml -- name: change PilotGo config - shell: sed -i '/^mysql:/,+1 s/localhost/{{ groups['pilotgo'][0] }}/' /opt/PilotGo/server/config_server.yaml -- name: change passwd - lineinfile: - path: /opt/PilotGo/server/config_server.yaml - regexp: '^#?password' - line: ' password: {{ mysql_password }}' - backrefs: yes -- name: change PilotGo config - shell: sed -i '/^redis:/,+1 s/localhost/{{ groups['pilotgo'][0] }}/' /opt/PilotGo/server/config_server.yaml -- name: change passwd - lineinfile: - path: /opt/PilotGo/server/config_server.yaml - regexp: '^#?redis_pwd' - line: ' redis_pwd: {{ redis_password }}' - backrefs: yes \ No newline at end of file + template: src=templates/pilotgo/config_server.yaml.j2 dest={{ pilotgo_config }} \ No newline at end of file diff --git a/playbook/templates/pilotgo/config_server.yaml.j2 b/playbook/templates/pilotgo/config_server.yaml.j2 new file mode 100755 index 0000000..48374a8 --- /dev/null +++ b/playbook/templates/pilotgo/config_server.yaml.j2 @@ -0,0 +1,39 @@ +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: + host_name: {{ groups['mysql'][0] }} + # this is the username of database + user_name: root + password: "{{ mysql_password }}" + data_base: PilotGo + port: 3306 +redis: + redis_conn: {{ groups['redis'][0] }}:6379 + use_tls: false + redis_pwd: "{{ redis_password }}" + defaultDB: 0 + # redis连接超时时间.默认5s + dialTimeout: 5s + # 是否启用redis + enableRedis: true +storage: + # 文件服务存储路径 + path: "/opt/PilotGo/server/resource" -- Gitee