From fb5db983cef7e65ef7b2149732260cdea76f01bd Mon Sep 17 00:00:00 2001 From: fumingwei Date: Fri, 21 May 2021 18:38:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=A8=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=9D=BF=E4=B8=8A=E6=A0=B9=E6=8D=AE=E6=9D=BF=E5=8D=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=8D=A1=E6=A7=BD=E8=8E=B7=E5=8F=96keepalive=20ip?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../files/init_runtime/tasks/init_runtime.yml | 41 +++++++++++++++++++ tsg-9140-scripts/roles/mrzcpd/tasks/main.yml | 4 +- ...g_9140.j2 => mrglobal.conf.tsg_9140.j2.j2} | 4 +- tsg-9140-scripts/roles/sapp/tasks/main.yml | 4 +- .../{gdev.conf.j2 => gdev.conf.j2.j2} | 4 +- 5 files changed, 51 insertions(+), 6 deletions(-) rename tsg-9140-scripts/roles/mrzcpd/templates/tsg_9140/{mrglobal.conf.tsg_9140.j2 => mrglobal.conf.tsg_9140.j2.j2} (94%) rename tsg-9140-scripts/roles/sapp/templates/{gdev.conf.j2 => gdev.conf.j2.j2} (60%) diff --git a/tsg-9140-scripts/roles/init_runtime/files/init_runtime/tasks/init_runtime.yml b/tsg-9140-scripts/roles/init_runtime/files/init_runtime/tasks/init_runtime.yml index c66daca1..ae23dd20 100644 --- a/tsg-9140-scripts/roles/init_runtime/files/init_runtime/tasks/init_runtime.yml +++ b/tsg-9140-scripts/roles/init_runtime/files/init_runtime/tasks/init_runtime.yml @@ -3,6 +3,41 @@ vars_files: - '{{var_files_path}}' tasks: + - name: "init_runtime: obtain result_exec_obtain_keepalive_subnet" + shell: ipmitool picmg addrinfo | grep "Hardware Address" | sed 's/^Hardware Address.*0x4\(.*\)/\1/' | awk '{print strtonum("0x"$1)+16'} + register: result_exec_obtain_keepalive_subnet + + - name: "init_runtime: output results that executes command that gets the result_exec_obtain_keepalive_subnet" + debug: + msg: "{{ result_exec_obtain_keepalive_subnet }}" + + - name: "init_runtime: check result_exec_obtain_keepalive_subnet" + assert: + that: + - result_exec_obtain_keepalive_subnet.rc == 0 + - result_exec_obtain_keepalive_subnet.failed == False + - result_exec_obtain_keepalive_subnet.stdout_lines | length == 1 + - result_exec_obtain_keepalive_subnet.stdout_lines[0] | int >= 16 + - result_exec_obtain_keepalive_subnet.stdout_lines[0] | int <= 31 + fail_msg: "error:{{ result_exec_obtain_keepalive_subnet.stderr }},stdout:{{ result_exec_obtain_keepalive_subnet.stdout_lines }}" + success_msg: "{{ result_exec_obtain_keepalive_subnet.stdout_lines[0] }}" + + - name: "init_runtime: Set fact for field keepalive_subnet_ip" + set_fact: + keepalive_subnet_ip: "{{ result_exec_obtain_keepalive_subnet.stdout_lines[0] }}" + + - name: "init_runtime: template gdev.conf file" + template: + src: "../templates/gdev.conf.j2" + dest: /home/mesasoft/sapp_run/etc/gdev.conf + tags: sapp + + - name: "init_runtime: template mrglobal.conf file" + template: + src: "../templates/mrglobal.conf.j2" + dest: /opt/mrzcpd/etc/mrglobal.conf + tags: mrzcpd + - name: "init_runtime: template certstore configure file" template: src: "../templates/cert_store.ini.j2" @@ -51,6 +86,12 @@ dest: /opt/tsg/tfe/conf/pangu/pangu_pxy.conf tags: tfe + - name: "Restart mrzcpd" + systemd: + name: mrzcpd + state: restarted + tags: mrzcpd + - name: "Restart certstore" systemd: name: certstore diff --git a/tsg-9140-scripts/roles/mrzcpd/tasks/main.yml b/tsg-9140-scripts/roles/mrzcpd/tasks/main.yml index 0d56363a..16a08c52 100644 --- a/tsg-9140-scripts/roles/mrzcpd/tasks/main.yml +++ b/tsg-9140-scripts/roles/mrzcpd/tasks/main.yml @@ -12,8 +12,8 @@ - name: "update mrglobal.conf - TSG9140" template: - src: "{{ role_path }}/templates/tsg_9140/mrglobal.conf.tsg_9140.j2" - dest: /opt/mrzcpd/etc/mrglobal.conf + src: "{{ role_path }}/templates/tsg_9140/mrglobal.conf.tsg_9140.j2.j2" + dest: /opt/tsg/init_runtime/templates/mrglobal.conf.j2 ##################### mrzcpd ##################### - name: "enable mrenv" diff --git a/tsg-9140-scripts/roles/mrzcpd/templates/tsg_9140/mrglobal.conf.tsg_9140.j2 b/tsg-9140-scripts/roles/mrzcpd/templates/tsg_9140/mrglobal.conf.tsg_9140.j2.j2 similarity index 94% rename from tsg-9140-scripts/roles/mrzcpd/templates/tsg_9140/mrglobal.conf.tsg_9140.j2 rename to tsg-9140-scripts/roles/mrzcpd/templates/tsg_9140/mrglobal.conf.tsg_9140.j2.j2 index 9a0b0c7c..4a9b3fa6 100644 --- a/tsg-9140-scripts/roles/mrzcpd/templates/tsg_9140/mrglobal.conf.tsg_9140.j2 +++ b/tsg-9140-scripts/roles/mrzcpd/templates/tsg_9140/mrglobal.conf.tsg_9140.j2.j2 @@ -7,7 +7,9 @@ sz_buffer=32 mtu=4096 clear_tx_flags=1 hw_strip_crc=1 -in_addr=10.254.19.1 +{% raw %} +in_addr={{ keepalive_subnet_ip }} +{% endraw %} in_mask=255.255.255.252 #rssmode=3 diff --git a/tsg-9140-scripts/roles/sapp/tasks/main.yml b/tsg-9140-scripts/roles/sapp/tasks/main.yml index 10f67f0c..e10f0e99 100644 --- a/tsg-9140-scripts/roles/sapp/tasks/main.yml +++ b/tsg-9140-scripts/roles/sapp/tasks/main.yml @@ -60,8 +60,8 @@ - name: Template the gdev.conf template: - src: "{{ role_path }}/templates/gdev.conf.j2" - dest: /home/mesasoft/sapp_run/etc/gdev.conf + src: "{{ role_path }}/templates/gdev.conf.j2.j2" + dest: /opt/tsg/init_runtime/templates/gdev.conf.j2 tags: template - name: "sapp: service adapts runtimes" diff --git a/tsg-9140-scripts/roles/sapp/templates/gdev.conf.j2 b/tsg-9140-scripts/roles/sapp/templates/gdev.conf.j2.j2 similarity index 60% rename from tsg-9140-scripts/roles/sapp/templates/gdev.conf.j2 rename to tsg-9140-scripts/roles/sapp/templates/gdev.conf.j2.j2 index 2e125c8f..0fe0755c 100644 --- a/tsg-9140-scripts/roles/sapp/templates/gdev.conf.j2 +++ b/tsg-9140-scripts/roles/sapp/templates/gdev.conf.j2.j2 @@ -1,5 +1,7 @@ [Module] pcapdevice={{ nic_mgr.name }} sendto_gdev_card={{ nic_mgr.name }} -sendto_gdev_ip={{ inline_device_config.keepalive_ip }} +{% raw %} +sendto_gdev_ip={{ keepalive_subnet_ip }} +{% endraw %} gdev_status_switch=1