refactor:重构tsg-os-provison

This commit is contained in:
fumingwei
2021-07-12 10:56:39 +08:00
parent ed8f80c15d
commit f7c876678a
13 changed files with 30 additions and 94 deletions

View File

@@ -28,12 +28,12 @@
- name: "template adapt_tera_network_setting.sh when NPB device is tera"
template:
src: ../templates/adapt_tera_network_setting.sh.j2
dest: /opt/tsg/tsg-os-provision/adapt_tera_network_setting.sh
dest: /opt/tsg/tsg-os-provision/exec/adapt_tera_network_setting.sh
mode: 0755
when: npb_device == 'tera'
- name: "execute adapt_tera_network_setting.sh when NPB device is tera"
shell: /opt/tsg/tsg-os-provision/adapt_tera_network_setting.sh
shell: /opt/tsg/tsg-os-provision/exec/adapt_tera_network_setting.sh
register: result_exec_adapt_tera_network_setting
when: npb_device == 'tera'
@@ -163,7 +163,7 @@
state: directory
- name: "tsg-os-provision: obtain sn from mxn and write sn to tsg_sn.json"
shell: /opt/tsg/tsg-os-provision/obtain_sn.sh 192.168.100.5
shell: /opt/tsg/tsg-os-provision/exec/obtain_sn.sh 192.168.100.5
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

@@ -31,7 +31,7 @@
success_msg: "{{ result_exec_setup_policy_log_nic_network.stdout_lines }}"
- name: "tsg-os-provision: obtain sn from mxn and write sn to tsg_sn.json"
shell: /opt/tsg/tsg-os-provision/obtain_sn.sh 192.168.100.5
shell: /opt/tsg/tsg-os-provision/exec/obtain_sn.sh 192.168.100.5
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

@@ -9,7 +9,7 @@
state: directory
- name: "tsg-os-provision: obtain sn"
shell: /opt/tsg/tsg-os-provision/obtain_sn.sh 127.0.0.1
shell: /opt/tsg/tsg-os-provision/exec/obtain_sn.sh 127.0.0.1
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

@@ -1,75 +0,0 @@
version: 1
cm:
policy_server:
address: "127.0.0.1"
port_range: 7002
port_num: 1
db_static: 0
db_dynamic: 1
sentry_url: http://127.0.0.1:9000/api/2/minidump/?sentry_key=3203b43fd5384a7dbe6a48ecb1f3c595
data_center:
name: City instance
id: 1
olap:
kafka_broker:
address_list: ['1.1.1.1:9092','2.2.2.2:9092']
hos_server:
address: "127.0.0.1"
port: 9098
app_sketch:
broker:
address: "127.0.0.1"
port: 1883
cache:
hos:
address: "127.0.0.1"
port: 9090
# npb_device value in [inline_device, tera,direct]
npb_device: inline_device
tera_steering_group:
- internal:
vlan_id: 1301
keepalive:
ipv4: 127.0.0.1/24
ipv6: 'fe80\:\:1/64'
external:
vlan_id: 1302
keepalive:
ipv4: 127.0.0.1/24
ipv6: 'fe80\:\:2/64'
- internal:
vlan_id: 1201
keepalive:
ipv4: 127.0.0.1/24
ipv6: 'fe80\:\:3/64'
external:
vlan_id: 1202
keepalive:
ipv4: 127.0.0.1/24
ipv6: 'fe80\:\:4/64'
inline_device_settings:
keepalive:
ip: 127.0.0.1
mask: 255.255.255.0
feature:
enable_policy_local_cache: 1
network_setting:
nic_policy_log:
ipv4: 127.0.0.1/24
ipv6: 'fe80\:\:5/64'
gateway_ipv4: 191.168.1.1

View File

@@ -1,8 +0,0 @@
---
- hosts: provision
vars_files:
- '{{var_files_path}}'
tasks:
- name: "tsg-os-provision: Nothing to do, exit error code"
fail:
msg: "Error: There are nothing to do,maybe some errors occurred during the os-building..."

View File

@@ -1,9 +1,28 @@
- name: "tsg-os-provision: copy tsg-os-provision scripts to dest"
- name: "tsg-os-provision: build tsg-os-provision directory and sub directory"
file:
path: "{{ item }}"
state: directory
with_items:
- "/opt/tsg/tsg-os-provision/"
- "/opt/tsg/tsg-os-provision/files/"
- "/opt/tsg/tsg-os-provision/tasks/"
- "/opt/tsg/tsg-os-provision/templates/"
- "/opt/tsg/tsg-os-provision/exec/"
- name: "tsg-os-provision: copy hosts file dest"
copy:
src: "{{ role_path }}/files/tsg-os-provision"
dest: /opt/tsg/
src: "{{ role_path }}/files/hosts"
dest: /opt/tsg/tsg-os-provision/hosts
mode: 0644
- name: "tsg-os-provision: template network settings shell"
copy:
src: "{{ role_path }}/files/network_settings/{{ item }}"
dest: "/opt/tsg/tsg-os-provision/templates/"
with_items:
- adapt_tera_network_setting.sh.j2
- setup_policy_log_nic_network.sh.j2
- name: "tsg-os-provision: copy tasks file that excutes provision to dest - tsg9140"
copy:
src: "{{ role_path }}/files/tasks/provision.yml.9000NPBP01R01"

View File

@@ -7,12 +7,12 @@ if [ $ip_of_obtain_sn == '127.0.0.1' ];then
exit 0
fi
if [ ! -f "/opt/tsg/tsg-os-provision/cmm_api_tst" ];then
if [ ! -f "/opt/tsg/tsg-os-provision/exec/cmm_api_tst" ];then
echo "not found cmm_api_tst!"
exit 1
fi
/opt/tsg/tsg-os-provision/cmm_api_tst 9 1 1 $ip_of_obtain_sn | tee chid.id
/opt/tsg/tsg-os-provision/exec/cmm_api_tst 9 1 1 $ip_of_obtain_sn | tee chid.id
if [ $? != 0 ]; then
echo "cmm_api_tst failed!"
exit 1

View File

@@ -2,7 +2,7 @@
- name: "deploy obtain sn"
copy:
src: "{{ item }}"
dest: /opt/tsg/tsg-os-provision/
dest: /opt/tsg/tsg-os-provision/exec/
mode: 0755
with_items:
- "{{ role_path }}/files/obtain_sn.sh"