feature:新增9140环境获取设备sn的脚本

This commit is contained in:
fumingwei
2021-07-12 15:15:46 +08:00
parent 897ab39991
commit 7941d86ad1
4 changed files with 27 additions and 6 deletions

View File

@@ -9,7 +9,7 @@
state: directory
- name: "tsg-os-provision: obtain sn"
shell: /opt/tsg/tsg-os-provision/exec/obtain_sn.sh 127.0.0.1
shell: /opt/tsg/tsg-os-provision/exec/obtain_sn.sh
register: result_exec_obtain_sn_and_write_sn_in_file
- name: "tsg-os-provision: check result_exec_obtain_sn_and_write_sn_in_file"

View File

@@ -0,0 +1,13 @@
#!/bin/bash -x
output=`sshpass -p eb-20170122 ssh root@10.254.17.1 "ipmitool fru | awk 'NR==12'"`
if [ -z "$output" ];then
echo "{\"sn\": \"unknown\"}" > /opt/tsg/etc/tsg_sn.json
exit 0
fi
sn=`echo $output | awk '{print $4}'`
if [ -z "$sn" ];then
echo "{\"sn\": \"unknown\"}" > /opt/tsg/etc/tsg_sn.json
exit 0
fi
echo "{\"sn\": \"$sn\"}" > /opt/tsg/etc/tsg_sn.json

View File

@@ -1,9 +1,17 @@
---
- name: "deploy obtain sn"
- name: "deploy obtain sn tsg-7400"
copy:
src: "{{ item }}"
dest: /opt/tsg/tsg-os-provision/exec/
src: "{{ role_path }}/files/{{ item.src }}"
dest: "/opt/tsg/tsg-os-provision/exec/{{ item.dest }}"
mode: 0755
with_items:
- "{{ role_path }}/files/obtain_sn.sh"
- "{{ role_path }}/files/cmm_api_tst"
- { "src": "obtain_sn.sh.TSG7400", "dest": "obtain_sn.sh" }
- { "src": "cmm_api_tst", "dest": "cmm_api_tst" }
when: PROFILE_ID == '7400-MCN0-P01R01' or PROFILE_ID == '7400-MCN123-P01R01'
- name: "deploy obtain sn - tsg-9140"
copy:
src: "{{ role_path }}/files/obtain_sn.sh.TSG9140"
dest: /opt/tsg/tsg-os-provision/exec/obtain_sn.sh
mode: 0755
when: PROFILE_ID == '9000-NPB-P01R01'