From d3333ab7ce3bd9eeaa95892c94ced439e699c03a Mon Sep 17 00:00:00 2001 From: wangjian Date: Wed, 27 Nov 2024 10:13:44 +0800 Subject: [PATCH] add pilotgo agent install --- playbook/groups_vars/all | 3 ++- playbook/host-multi-machine | 8 ++++++++ playbook/roles/pilotgo-agent/tasks/main.yml | 13 +++++++++++++ playbook/roles/pilotgo/tasks/main.yml | 8 ++++---- .../templates/pilotgo-agent/config_agent.yaml.j2 | 8 ++++++++ 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 playbook/roles/pilotgo-agent/tasks/main.yml create mode 100644 playbook/templates/pilotgo-agent/config_agent.yaml.j2 diff --git a/playbook/groups_vars/all b/playbook/groups_vars/all index 1fb59b7..a2cbdd2 100644 --- a/playbook/groups_vars/all +++ b/playbook/groups_vars/all @@ -1,3 +1,4 @@ --- mysql_password: "PilotGo13579!" -redis_password: "PilotGo13579!" \ No newline at end of file +redis_password: "PilotGo13579!" +pilotgo_agent_config: /opt/PilotGo/agent/config_agent.yaml \ No newline at end of file diff --git a/playbook/host-multi-machine b/playbook/host-multi-machine index 6ef0026..ca7c71c 100644 --- a/playbook/host-multi-machine +++ b/playbook/host-multi-machine @@ -9,3 +9,11 @@ [topo] 4.4.4.4 + +[pilotgo-agent] +5.5.5.5 +6.6.6.6 + +[topo-agent] +7.7.7.7 +8.8.8.8 \ No newline at end of file diff --git a/playbook/roles/pilotgo-agent/tasks/main.yml b/playbook/roles/pilotgo-agent/tasks/main.yml new file mode 100644 index 0000000..5d19b19 --- /dev/null +++ b/playbook/roles/pilotgo-agent/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: install pilotgo-agent + dnf: + name: PilotGo-agent + 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 agent config + template: src=templates/pilotgo-agent/config_agent.yaml.j2 dest={{ pilotgo_agent_config }} \ No newline at end of file diff --git a/playbook/roles/pilotgo/tasks/main.yml b/playbook/roles/pilotgo/tasks/main.yml index 901ef65..3917288 100644 --- a/playbook/roles/pilotgo/tasks/main.yml +++ b/playbook/roles/pilotgo/tasks/main.yml @@ -10,11 +10,11 @@ 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['standalone'][0] }}/' /opt/PilotGo/server/config_server.yaml + 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['standalone'][0] }}/' /opt/PilotGo/server/config_server.yaml + 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['standalone'][0] }}/' /opt/PilotGo/server/config_server.yaml + 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 @@ -22,7 +22,7 @@ line: ' password: {{ mysql_password }}' backrefs: yes - name: change PilotGo config - shell: sed -i '/^redis:/,+1 s/localhost/{{ groups['standalone'][0] }}/' /opt/PilotGo/server/config_server.yaml + 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 diff --git a/playbook/templates/pilotgo-agent/config_agent.yaml.j2 b/playbook/templates/pilotgo-agent/config_agent.yaml.j2 new file mode 100644 index 0000000..57b5fcd --- /dev/null +++ b/playbook/templates/pilotgo-agent/config_agent.yaml.j2 @@ -0,0 +1,8 @@ +server: + addr: {{ groups['pilotgo'][0] }}:8879 +log: + level: debug + driver: file #可选stdout和file。stdout:输出到终端控制台;file:输出到path下的指定文件。 + path: ./log/pilotgo_agent.log + max_file: 3 + max_size: 10485760 -- Gitee