From f301aaba048bdaf27fd4b1955728479f43dbcf41 Mon Sep 17 00:00:00 2001 From: songyanchao Date: Thu, 29 Jul 2021 23:26:57 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(TSG-9140):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0mgmt1=E7=BD=91=E5=8D=A1=E8=87=AA=E5=8A=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AEIP=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加eth_pf_mgmt1自动配置10.253.x.x网段IP的脚本,可以通过3200单独连接 --- ansible/roles/system-init-9140/tasks/main.yml | 7 +++++++ .../templates/if-pre-up.toml.j2 | 1 + .../templates/ifcfg-eth_pf_mgmt1.toml.j2 | 2 +- .../templates/setup.eth_pf_mgmt1.ips.toml.j2 | 18 ++++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 ansible/roles/system-init-9140/templates/setup.eth_pf_mgmt1.ips.toml.j2 diff --git a/ansible/roles/system-init-9140/tasks/main.yml b/ansible/roles/system-init-9140/tasks/main.yml index bccd873c..7c70b45f 100644 --- a/ansible/roles/system-init-9140/tasks/main.yml +++ b/ansible/roles/system-init-9140/tasks/main.yml @@ -81,6 +81,13 @@ mode: 0777 tags: template +- name: "copy eth_pf_mgmt1.ips cfg" + template: + src: "{{ role_path }}/templates/setup.eth_pf_mgmt1.ips.toml.j2" + dest: /sbin/setup.eth_pf_mgmt1.ips + mode: 0777 + tags: template + - name: "copy setup.eth_vf_tfe.ips" template: src: "{{ role_path }}/templates/setup.eth_vf_tfe.ips.toml.j2" diff --git a/ansible/roles/system-init-9140/templates/if-pre-up.toml.j2 b/ansible/roles/system-init-9140/templates/if-pre-up.toml.j2 index d1758e81..6dce8c0c 100644 --- a/ansible/roles/system-init-9140/templates/if-pre-up.toml.j2 +++ b/ansible/roles/system-init-9140/templates/if-pre-up.toml.j2 @@ -7,6 +7,7 @@ then logger "$0 called for interface named $INF with $STA ..." case "$INF" in eth_pf_mgmt0) logger "Setting $STA $INF ipaddr ..."; /sbin/setup.eth_pf_mgmt0.ips $INF $STA;; + eth_pf_mgmt1) logger "Setting $STA $INF ipaddr ..."; /sbin/setup.eth_pf_mgmt1.ips $INF $STA;; eth_vf_tfe) logger "Setting $STA $INF RPS ..."; /sbin/setup.eth_vf_tfe.ips $INF $STA;; esac fi diff --git a/ansible/roles/system-init-9140/templates/ifcfg-eth_pf_mgmt1.toml.j2 b/ansible/roles/system-init-9140/templates/ifcfg-eth_pf_mgmt1.toml.j2 index 6fd7dd19..fff6fcc0 100644 --- a/ansible/roles/system-init-9140/templates/ifcfg-eth_pf_mgmt1.toml.j2 +++ b/ansible/roles/system-init-9140/templates/ifcfg-eth_pf_mgmt1.toml.j2 @@ -11,4 +11,4 @@ IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eth_pf_mgmt1 DEVICE=eth_pf_mgmt1 -ONBOOT=no \ No newline at end of file +ONBOOT=yes \ No newline at end of file diff --git a/ansible/roles/system-init-9140/templates/setup.eth_pf_mgmt1.ips.toml.j2 b/ansible/roles/system-init-9140/templates/setup.eth_pf_mgmt1.ips.toml.j2 new file mode 100644 index 00000000..7629a413 --- /dev/null +++ b/ansible/roles/system-init-9140/templates/setup.eth_pf_mgmt1.ips.toml.j2 @@ -0,0 +1,18 @@ +#!/bin/bash + +INF="$1" +STA="$2" + +logger "$0 called for interface named $INF with $STA ..." + +if [ "$INF" == "eth_pf_mgmt1" ] +then + logger "$0: Interface $INF with $STA ,Set $INF ipaddr ..." + output=$(ipmitool picmg addrinfo) + echo $output + substr=${output:22:1} + echo $substr + num=$((16#${substr}+16)) + ipaddr='10.253.'$num'.1' + ifconfig eth_pf_mgmt1 $ipaddr netmask 255.255.0.0 +fi \ No newline at end of file