7400 adapt:修改tsg_sn role用来适配tsg 7400
This commit is contained in:
BIN
ansible/roles/tsg_sn/files/cmm_api_tst
Normal file
BIN
ansible/roles/tsg_sn/files/cmm_api_tst
Normal file
Binary file not shown.
22
ansible/roles/tsg_sn/files/tsg7400_obtain_sn_from_mxn.sh
Normal file
22
ansible/roles/tsg_sn/files/tsg7400_obtain_sn_from_mxn.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f "/opt/tsg/tsg-os-provision/cmm_api_tst" ];then
|
||||
echo "not found cmm_api_tst!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/opt/tsg/tsg-os-provision/cmm_api_tst 9 1 1 127.0.0.1 | tee chid.id
|
||||
if [ $? != 0 ]; then
|
||||
echo "cmm_api_tst failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CHID=`cat chid.id | sed -n '1p' | awk -F ":" '{print $2}' | sed 's/ //g'`
|
||||
CHIDL=`echo $CHID | awk '{print length($0)}'`
|
||||
|
||||
if [ $CHIDL != 20 ];then
|
||||
echo "CHID length is not 20!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "{\"sn\": \"$CHID\"}" > /opt/tsg/etc/tsg_sn.json
|
||||
@@ -3,4 +3,15 @@
|
||||
template:
|
||||
src: "{{ role_path }}/templates/tsg_sn.json.j2.j2"
|
||||
dest: /opt/tsg/tsg-os-provision/templates/tsg_sn.json.j2
|
||||
tags: template
|
||||
tags: template
|
||||
when: PROFILE_ID == '9000-NPB-P01R01'
|
||||
|
||||
- name: "Template the tsg_sn.json.j2.j2"
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: /opt/tsg/tsg-os-provision/
|
||||
mode: 0755
|
||||
with_items:
|
||||
- "{{ role_path }}/files/tsg7400_obtain_sn_from_mxn.sh"
|
||||
- "{{ role_path }}/files/cmm_api_tst"
|
||||
when: PROFILE_ID == '7400-MCN0-P01R01' or PROFILE_ID == '7400-MCN123-P01R01'
|
||||
@@ -7,6 +7,7 @@
|
||||
- {role: tsg-os-provision, tags: tsg-os-provision}
|
||||
- {role: system-init, tags: system-init}
|
||||
- {role: system-init-7400-mcn0, tags: system-init-7400-mcn0}
|
||||
- {role: tsg_sn, tags: tsg_sn}
|
||||
- {role: tsg-diagnose, tags: tsg-diagnose}
|
||||
|
||||
- hosts: 7400-MCN123-P01R01
|
||||
@@ -17,4 +18,5 @@
|
||||
roles:
|
||||
- {role: tsg-os-provision, tags: tsg-os-provision}
|
||||
- {role: system-init, tags: system-init}
|
||||
- {role: system-init-7400-mcn123, tags: system-init-7400-mcn123}
|
||||
- {role: system-init-7400-mcn123, tags: system-init-7400-mcn123}
|
||||
- {role: tsg_sn, tags: tsg_sn}
|
||||
Reference in New Issue
Block a user