diff --git a/scripts/playbook/group_vars/all b/scripts/playbook/group_vars/all index 0d9ebf23349883bf758671da8f6c244a08bebe23..c32e4ad32cfcf5e91ce85edad26b6612d98d1a51 100644 --- a/scripts/playbook/group_vars/all +++ b/scripts/playbook/group_vars/all @@ -1,3 +1,4 @@ --- redis_password: "PilotGo13579!" -mysql_password: "PilotGo13579!" \ No newline at end of file +mysql_password: "PilotGo13579!" +pserver_config: /opt/PilotGo/server/config_server.yaml \ No newline at end of file diff --git a/scripts/playbook/roles/pserver/tasks/main,yml b/scripts/playbook/roles/pserver/tasks/main,yml index a8f9cf72dd3c18ff4f23515a53ed977a07b68ea3..3c0b66078f58e50d05eea17232f9ec838fc817c9 100644 --- a/scripts/playbook/roles/pserver/tasks/main,yml +++ b/scripts/playbook/roles/pserver/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/{{ ansible_default_ipv4['address'] }}/' /opt/PilotGo/server/config_server.yaml -- name: change PilotGo config - shell: sed -i '/^socket_server:/,+1 s/0\.0\.0\.0/{{ ansible_default_ipv4['address'] }}/' /opt/PilotGo/server/config_server.yaml -- name: change PilotGo config - shell: sed -i '/^mysql:/,+1 s/localhost/{{ ansible_default_ipv4['address'] }}/' /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/{{ ansible_default_ipv4['address'] }}/' /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/pserver/config_server.yaml.j2 dest={{ pserver_config }} \ No newline at end of file diff --git a/scripts/playbook/templates/pserver/config_server.yaml.j2 b/scripts/playbook/templates/pserver/config_server.yaml.j2 new file mode 100755 index 0000000000000000000000000000000000000000..b852c53fccfff44636fbd31eb7423ca8ec506fae --- /dev/null +++ b/scripts/playbook/templates/pserver/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"