7400 adapt:修改tsg-os-provision role用来适配tsg 7400

This commit is contained in:
fumingwei
2021-06-17 10:33:38 +08:00
parent b09a8165f3
commit 13eb434fc3
7 changed files with 319 additions and 105 deletions

View File

@@ -0,0 +1,115 @@
---
- hosts: provision
vars_files:
- '{{var_files_path}}'
tasks:
- name: "tsg-os-provision: Template the asymmetric_presence_layer.conf.j2"
template:
src: ../templates/asymmetric_presence_layer.conf.j2
dest: /home/mesasoft/sapp_run/etc/asymmetric_presence_layer.conf
tags: sapp
- name: "tsg-os-provision: Template the conflist.inf"
template:
src: ../templates/conflist.inf.j2
dest: /home/mesasoft/sapp_run/plug/conflist.inf
tags: sapp
- name: "tsg-os-provision: necessary_plug_list.conf"
template:
src: ../templates/necessary_plug_list.conf.j2
dest: /home/mesasoft/sapp_run/etc/necessary_plug_list.conf
tags: sapp
- name: "tsg-os-provision: vlan_flipping_map.conf"
template:
src: ../templates/vlan_flipping_map.conf.j2
dest: /home/mesasoft/sapp_run/etc/vlan_flipping_map.conf
tags: sapp
- name: "tsg-os-provision: template gdev.conf file"
template:
src: "../templates/gdev.conf.j2"
dest: /home/mesasoft/sapp_run/etc/gdev.conf
tags: sapp
- name: "tsg-os-provision: template mrglobal.conf file"
template:
src: "../templates/mrglobal.conf.j2"
dest: /opt/mrzcpd/etc/mrglobal.conf
tags: mrzcpd
- name: "tsg-os-provision: template certstore configure file"
template:
src: "../templates/cert_store.ini.j2"
dest: /opt/tsg/certstore/conf/cert_store.ini
tags: certstore
- name: "tsg-os-provision: Template the tsgconf/main.conf"
template:
src: "../templates/main.conf.j2"
dest: /home/mesasoft/sapp_run/tsgconf/main.conf
tags: firewall
- name: "tsg-os-provision: Template the tsgconf/maat.conf"
template:
src: "../templates/maat.conf.j2"
dest: /home/mesasoft/sapp_run/tsgconf/maat.conf
tags: firewall
- name: "tsg-os-provision: Template the conf/capture_packet_plug.conf"
template:
src: "../templates/capture_packet_plug.conf.j2"
dest: /home/mesasoft/sapp_run/conf/capture_packet_plug.conf
tags: firewall
- name: "tsg-os-provision: Template the sapp.toml"
template:
src: "../templates/sapp.toml.j2"
dest: /home/mesasoft/sapp_run/etc/sapp.toml
tags: sapp
- name: "tsg-os-provision: Templates telegraf.conf"
template:
src: "../templates/telegraf_statistic.conf.j2"
dest: /etc/telegraf/telegraf_statistic.conf
tags: telegraf_statistic
- name: "mkdir /opt/tsg/etc/"
file:
path: /opt/tsg/etc
state: directory
- name: "tsg-os-provision: obtain sn from mxn and write sn to tsg_sn.json"
shell: /opt/tsg/tsg-os-provision/tsg7400_obtain_sn_from_mxn.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"
assert:
that:
- result_exec_obtain_keepalive_subnet.rc == 0
- result_exec_obtain_keepalive_subnet.failed == False
fail_msg: "error:{{ result_exec_obtain_keepalive_subnet.stderr }},stdout:{{ result_exec_obtain_keepalive_subnet.stdout_lines }}"
success_msg: "Successded: obtain the sn from mxn and write sn into tsg_sn.json"
- name: "tsg-os-provision: template the tsg_device_tag"
template:
src: "../templates/tsg_device_tag.json.j2"
dest: /opt/tsg/etc/tsg_device_tag.json
tags: tsg_device_tag
- name: "Template the maat-redis.conf"
template:
src: "/opt/tsg/tsg-os-provision/templates/gdev.conf.j2"
dest: /etc/maat-redis.conf
tags: maat-redis
- name: 'tsg-os-provision: execute command - systemctl daemon-reload'
systemd:
daemon_reload: yes
- name: "tsg-os-provision: snapshot the stage2 config files"
copy:
src: /data/tsg-os-provision/provision.yml
dest: /data/tsg-os-provision/provision.yml.snapshot

View File

@@ -0,0 +1,48 @@
---
- hosts: provision
vars_files:
- '{{var_files_path}}'
tasks:
- name: "mkdir /opt/tsg/etc/"
file:
path: /opt/tsg/etc
state: directory
- name: "tsg-os-provision: obtain sn from mxn and write sn to tsg_sn.json"
shell: /opt/tsg/tsg-os-provision/tsg7400_obtain_sn_from_mxn.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"
assert:
that:
- result_exec_obtain_keepalive_subnet.rc == 0
- result_exec_obtain_keepalive_subnet.failed == False
fail_msg: "error:{{ result_exec_obtain_keepalive_subnet.stderr }},stdout:{{ result_exec_obtain_keepalive_subnet.stdout_lines }}"
success_msg: "Successded: obtain the sn from mxn and write sn into tsg_sn.json"
- name: "tsg-os-provision: template the tsg_device_tag"
template:
src: "../templates/tsg_device_tag.json.j2"
dest: /opt/tsg/etc/tsg_device_tag.json
tags: tsg_device_tag
- name: "tsg-os-provision: template the tfe.conf"
template:
src: "../templates/tfe.conf.j2"
dest: /opt/tsg/tfe/conf/tfe/tfe.conf
tags: tfe
- name: "tsg-os-provision: template the pangu_pxy.conf"
template:
src: "../templates/pangu_pxy.conf.j2"
dest: /opt/tsg/tfe/conf/pangu/pangu_pxy.conf
tags: tfe
- name: 'tsg-os-provision: execute command - systemctl daemon-reload'
systemd:
daemon_reload: yes
- name: "tsg-os-provision: snapshot the stage2 config files"
copy:
src: /data/tsg-os-provision/provision.yml
dest: /data/tsg-os-provision/provision.yml.snapshot

View File

@@ -0,0 +1,113 @@
---
- hosts: provision
vars_files:
- '{{var_files_path}}'
tasks:
- name: "tsg-os-provision: 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: "tsg-os-provision: output results that executes command that gets the result_exec_obtain_keepalive_subnet"
debug:
msg: "{{ result_exec_obtain_keepalive_subnet }}"
- name: "tsg-os-provision: 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: "tsg-os-provision: Set fact for field keepalive_subnet_ip"
set_fact:
keepalive_subnet_ip: "{{ result_exec_obtain_keepalive_subnet.stdout_lines[0] }}"
- name: "tsg-os-provision: template gdev.conf file"
template:
src: "../templates/gdev.conf.j2"
dest: /home/mesasoft/sapp_run/etc/gdev.conf
tags: sapp
- name: "tsg-os-provision: template mrglobal.conf file"
template:
src: "../templates/mrglobal.conf.j2"
dest: /opt/mrzcpd/etc/mrglobal.conf
tags: mrzcpd
- name: "tsg-os-provision: template certstore configure file"
template:
src: "../templates/cert_store.ini.j2"
dest: /opt/tsg/certstore/conf/cert_store.ini
tags: certstore
- name: "tsg-os-provision: Template the tsgconf/main.conf"
template:
src: "../templates/main.conf.j2"
dest: /home/mesasoft/sapp_run/tsgconf/main.conf
tags: firewall
- name: "tsg-os-provision: Template the tsgconf/maat.conf"
template:
src: "../templates/maat.conf.j2"
dest: /home/mesasoft/sapp_run/tsgconf/maat.conf
tags: firewall
- name: "tsg-os-provision: Template the conf/capture_packet_plug.conf"
template:
src: "../templates/capture_packet_plug.conf.j2"
dest: /home/mesasoft/sapp_run/conf/capture_packet_plug.conf
tags: firewall
- name: "tsg-os-provision: Template the sapp.toml"
template:
src: "../templates/sapp.toml.j2"
dest: /home/mesasoft/sapp_run/etc/sapp.toml
tags: sapp
- name: "tsg-os-provision: Templates telegraf.conf"
template:
src: "../templates/telegraf_statistic.conf.j2"
dest: /etc/telegraf/telegraf_statistic.conf
tags: telegraf_statistic
- name: "tsg-os-provision: template the tfe.conf"
template:
src: "../templates/tfe.conf.j2"
dest: /opt/tsg/tfe/conf/tfe/tfe.conf
tags: tfe
- name: "tsg-os-provision: template the pangu_pxy.conf"
template:
src: "../templates/pangu_pxy.conf.j2"
dest: /opt/tsg/tfe/conf/pangu/pangu_pxy.conf
tags: tfe
- name: "mkdir /opt/tsg/etc/"
file:
path: /opt/tsg/etc
state: directory
- name: "tsg-os-provision: template the tsg_device_tag"
template:
src: "../templates/tsg_device_tag.json.j2"
dest: /opt/tsg/etc/tsg_device_tag.json
tags: tsg_device_tag
- name: "tsg-os-provision: template the tsg_sn"
template:
src: "../templates/tsg_sn.json.j2"
dest: /opt/tsg/etc/tsg_sn.json
tags: tsg_sn
- name: 'tsg-os-provision: execute command - systemctl daemon-reload'
systemd:
daemon_reload: yes
- name: "tsg-os-provision: snapshot the stage2 config files"
copy:
src: /data/tsg-os-provision/provision.yml
dest: /data/tsg-os-provision/provision.yml.snapshot

View File

@@ -34,4 +34,22 @@ pangu_pxy:
address: "10.9.62.253"
port: 9090
tsg_sn: "CBT2201925000002"
tsg_sn: "CBT2201925000002"
# NPB_device value in [inline_device, tera]
NPB_device: inline_device
access_vlan_id_list:
- 1000
- 1001
keep_alive: 127.0.0.1
inline_device_config:
keepalive_ip: 127.0.0.1
eepalive_mask: 255.255.255.0
maat_redis_city_server:
address: "10.4.62.253"
port: 7002

View File

@@ -3,107 +3,6 @@
vars_files:
- '{{var_files_path}}'
tasks:
- name: "tsg-os-provision: 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: "tsg-os-provision: output results that executes command that gets the result_exec_obtain_keepalive_subnet"
debug:
msg: "{{ result_exec_obtain_keepalive_subnet }}"
- name: "tsg-os-provision: 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: "tsg-os-provision: Set fact for field keepalive_subnet_ip"
set_fact:
keepalive_subnet_ip: "{{ result_exec_obtain_keepalive_subnet.stdout_lines[0] }}"
- name: "tsg-os-provision: template gdev.conf file"
template:
src: "../templates/gdev.conf.j2"
dest: /home/mesasoft/sapp_run/etc/gdev.conf
tags: sapp
- name: "tsg-os-provision: template mrglobal.conf file"
template:
src: "../templates/mrglobal.conf.j2"
dest: /opt/mrzcpd/etc/mrglobal.conf
tags: mrzcpd
- name: "tsg-os-provision: template certstore configure file"
template:
src: "../templates/cert_store.ini.j2"
dest: /opt/tsg/certstore/conf/cert_store.ini
tags: certstore
- name: "tsg-os-provision: Template the tsgconf/main.conf"
template:
src: "../templates/main.conf.j2"
dest: /home/mesasoft/sapp_run/tsgconf/main.conf
tags: firewall
- name: "tsg-os-provision: Template the tsgconf/maat.conf"
template:
src: "../templates/maat.conf.j2"
dest: /home/mesasoft/sapp_run/tsgconf/maat.conf
tags: firewall
- name: "tsg-os-provision: Template the conf/capture_packet_plug.conf"
template:
src: "../templates/capture_packet_plug.conf.j2"
dest: /home/mesasoft/sapp_run/conf/capture_packet_plug.conf
tags: firewall
- name: "tsg-os-provision: Template the sapp.toml"
template:
src: "../templates/sapp.toml.j2"
dest: /home/mesasoft/sapp_run/etc/sapp.toml
tags: sapp
- name: "tsg-os-provision: Templates telegraf.conf"
template:
src: "../templates/telegraf_statistic.conf.j2"
dest: /etc/telegraf/telegraf_statistic.conf
tags: telegraf_statistic
- name: "tsg-os-provision: template the tfe.conf"
template:
src: "../templates/tfe.conf.j2"
dest: /opt/tsg/tfe/conf/tfe/tfe.conf
tags: tfe
- name: "tsg-os-provision: template the pangu_pxy.conf"
template:
src: "../templates/pangu_pxy.conf.j2"
dest: /opt/tsg/tfe/conf/pangu/pangu_pxy.conf
tags: tfe
- name: "mkdir /opt/tsg/etc/"
file:
path: /opt/tsg/etc
state: directory
- name: "tsg-os-provision: template the tsg_device_tag"
template:
src: "../templates/tsg_device_tag.json.j2"
dest: /opt/tsg/etc/tsg_device_tag.json
tags: tsg_device_tag
- name: "tsg-os-provision: template the tsg_sn"
template:
src: "../templates/tsg_sn.json.j2"
dest: /opt/tsg/etc/tsg_sn.json
tags: tsg_sn
- name: "tsg-os-provision: snapshot the stage2 config files"
copy:
src: /data/tsg-os-provision/provision.yml
dest: /data/tsg-os-provision/provision.yml.snapshot
- 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

@@ -4,6 +4,27 @@
dest: /opt/tsg/
mode: 0644
- name: "tsg-os-provision: copy tasks file that excutes provision to dest - tsg9140"
copy:
src: "{{ role_path }}/files/provision_tasks_files/provision_tsg9140.yml"
dest: /opt/tsg/tsg-os-provision/tasks/provision.yml
mode: 0644
when: PROFILE_ID == '9000-NPB-P01R01'
- name: "tsg-os-provision: copy tasks file that excutes provision to dest - tsg7400 mcn0"
copy:
src: "{{ role_path }}/files/provision_tasks_files/provision_tsg7400_firewall.yml"
dest: /opt/tsg/tsg-os-provision/tasks/provision.yml
mode: 0644
when: PROFILE_ID == '7400-MCN0-P01R01'
- name: "tsg-os-provision: copy tasks file that excutes provision to dest - tsg7400 mcn1 mcn2 mcn3"
copy:
src: "{{ role_path }}/files/provision_tasks_files/provision_tsg7400_proxy.yml"
dest: /opt/tsg/tsg-os-provision/tasks/provision.yml
mode: 0644
when: PROFILE_ID == '7400-MCN123-P01R01'
- name: "tsg-os-provision: copy tsg-os-provision-convertor.service file to dest"
copy:
src: "{{ role_path }}/files/tsg-os-provision-convertor.service"