From 208b888ff88e28274b7e72d76aeb8230d5a822bc Mon Sep 17 00:00:00 2001 From: wangjian Date: Thu, 18 Jul 2024 16:40:04 +0800 Subject: [PATCH] add pilotgo-server role for playbook reuse --- scripts/playbook/install_PilotGo.yaml | 34 ++----------------- scripts/playbook/roles/pserver/tasks/main,yml | 31 +++++++++++++++++ 2 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 scripts/playbook/roles/pserver/tasks/main,yml diff --git a/scripts/playbook/install_PilotGo.yaml b/scripts/playbook/install_PilotGo.yaml index 2f383b0c..70ac89ad 100644 --- a/scripts/playbook/install_PilotGo.yaml +++ b/scripts/playbook/install_PilotGo.yaml @@ -7,36 +7,6 @@ roles: - redis - mysql - - tasks: - - 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 - shell: sed -i '/^http_server:/,+1 s/0\.0\.0\.0/{{ groups['standalone'][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 - - name: change PilotGo config - shell: sed -i '/^mysql:/,+1 s/localhost/{{ groups['standalone'][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['standalone'][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 + - pserver + \ No newline at end of file diff --git a/scripts/playbook/roles/pserver/tasks/main,yml b/scripts/playbook/roles/pserver/tasks/main,yml new file mode 100644 index 00000000..901ef650 --- /dev/null +++ b/scripts/playbook/roles/pserver/tasks/main,yml @@ -0,0 +1,31 @@ +--- +- 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 + shell: sed -i '/^http_server:/,+1 s/0\.0\.0\.0/{{ groups['standalone'][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 +- name: change PilotGo config + shell: sed -i '/^mysql:/,+1 s/localhost/{{ groups['standalone'][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['standalone'][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 -- Gitee