diff --git a/playbook/groups_vars/all b/playbook/groups_vars/all index 1fb59b79bb6b9e35544e3cfefc9d3d4136086764..a2cbdd26a84990f913e415d37851d7b831a29a20 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 6ef00266dd9393a0a9bf3c5f6059e2f6f3493227..ca7c71c08951fd364ebc60c9af12b28497477773 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 0000000000000000000000000000000000000000..5d19b1901ec731a4851d83bab1ec82d411e37fb1 --- /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 901ef6507ec3eb5915ece0fa16649ca7ff59f78e..3917288159b3a20816a0af26298dffe13def5d2c 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 0000000000000000000000000000000000000000..57b5fcd3b078a002828609157ddd5ec4cb19242d --- /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