bugfix:修改init容器由执行ansible脚本变为shell脚本
This commit is contained in:
@@ -166,7 +166,6 @@
|
||||
- install_config/group_vars/HAL_TSGXNXR620G40R01P0906.yml
|
||||
- install_config/group_vars/rpm_version.yml
|
||||
roles:
|
||||
- {role: tsg-os-provision, tags: tsg-os-provision}
|
||||
- {role: container-tools-install, tags: container-tools-install}
|
||||
- {role: tsg_sn, tags: tsg_sn}
|
||||
|
||||
|
||||
@@ -1,26 +1,3 @@
|
||||
- name: "install ansible"
|
||||
yum:
|
||||
name: ansible
|
||||
conf_file: "{{ rpm_repo_config_path }}"
|
||||
state: present
|
||||
when: PROFILE_ID == 'TSG-X-NXR620G40-R01-P0906-init'
|
||||
|
||||
- name: "Generate ansiblg.cfg after ansible upgrade in rockylinux8"
|
||||
shell: ansible-config init --disabled > /etc/ansible/ansible.cfg
|
||||
when: PROFILE_ID == 'TSG-X-NXR620G40-R01-P0906-init'
|
||||
|
||||
- name: 'change ansible hash_behaviour value replace to merge'
|
||||
lineinfile:
|
||||
path: /etc/ansible/ansible.cfg
|
||||
backrefs: yes
|
||||
regexp: "^(.*hash_behaviour.*=.*replace.*)$"
|
||||
line: '\1\nhash_behaviour = merge'
|
||||
when: PROFILE_ID == 'TSG-X-NXR620G40-R01-P0906-init'
|
||||
|
||||
- name: 'install psutil'
|
||||
shell: pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple psutil
|
||||
when: PROFILE_ID == 'TSG-X-NXR620G40-R01-P0906-init'
|
||||
|
||||
- name: "install tcpdump"
|
||||
yum:
|
||||
name: tcpdump
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
mkdir -p /target_config/opt/tsg/etc
|
||||
mkdir -p /target_config/etc/default
|
||||
chmod 0755 /opt/tsg/tsg-os-provision/scripts/obtain_sn.sh
|
||||
/opt/tsg/tsg-os-provision/scripts/obtain_sn.sh
|
||||
ip tuntap add mode tap ctrl_mock
|
||||
ifconfig ctrl_mock up
|
||||
ifconfig ctrl_mock $NODE_IP/32
|
||||
ifconfig ctrl_mock mtu 2000
|
||||
{{ if eq .Values.proxy.enable .Values.define_enable_val_yes }}
|
||||
ip tuntap add dev tap0 mode tap multi_queue
|
||||
chmod 0755 /opt/tsg/tfe/tfe-env-start.sh
|
||||
/opt/tsg/tfe/tfe-env-start.sh
|
||||
{{- end }}
|
||||
mount -o remount,rw /sys
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
- hosts: provision
|
||||
tasks:
|
||||
- name: "mkdir /opt/tsg/exporter/"
|
||||
file:
|
||||
path: {{`"{{ item }}"`}}
|
||||
state: directory
|
||||
with_items:
|
||||
- /target_config/opt/tsg/etc
|
||||
- /target_config/etc/default
|
||||
|
||||
- name: "get sn"
|
||||
shell: /opt/tsg/tsg-os-provision/scripts/obtain_sn.sh
|
||||
|
||||
- name: "create tap device ctrl_mock"
|
||||
shell: ip tuntap add mode tap ctrl_mock; ifconfig ctrl_mock up; ifconfig ctrl_mock $NODE_IP/32; ifconfig ctrl_mock mtu 2000
|
||||
|
||||
{{ if eq .Values.proxy.enable .Values.define_enable_val_yes }}
|
||||
- name: "create tap device tap0"
|
||||
shell: ip tuntap add dev tap0 mode tap multi_queue
|
||||
|
||||
- name: "execute tfe-env shell"
|
||||
shell: /opt/tsg/tfe/tfe-env-start.sh
|
||||
{{- end }}
|
||||
@@ -4,4 +4,4 @@ metadata:
|
||||
name: provisioninit-{{ .Release.Name }}
|
||||
namespace: default
|
||||
data:
|
||||
provision.yml: {{ tpl (.Files.Get "conf/provision.yml") . | quote }}
|
||||
provision-init.sh: {{ tpl (.Files.Get "conf/provision-init.sh") . | quote }}
|
||||
|
||||
@@ -175,7 +175,7 @@ spec:
|
||||
- name: tsg-init
|
||||
image: docker.io/library/tsg-init:{{ .Chart.AppVersion }}
|
||||
imagePullPolicy: Never
|
||||
command: ["/bin/bash","-c","ansible-playbook -i /opt/tsg/tsg-os-provision/hosts /opt/tsg/tsg-os-provision/tasks/provision.yml ; mount -o remount,rw /sys"]
|
||||
command: ["/bin/bash","-c","/opt/tsg/provision-init.sh"]
|
||||
securityContext:
|
||||
privileged: true
|
||||
env:
|
||||
@@ -185,8 +185,8 @@ spec:
|
||||
fieldPath: status.hostIP
|
||||
volumeMounts:
|
||||
- name: provisioninit
|
||||
mountPath: "/opt/tsg/tsg-os-provision/tasks/provision.yml"
|
||||
subPath: "provision.yml"
|
||||
mountPath: "/opt/tsg/provision-init.sh"
|
||||
subPath: "provision-init.sh"
|
||||
- name: config-volume
|
||||
mountPath: /target_config
|
||||
|
||||
@@ -217,6 +217,7 @@ spec:
|
||||
name: sapp-{{ .Release.Name }}
|
||||
- name: provisioninit
|
||||
configMap:
|
||||
defaultMode: 493
|
||||
name: provisioninit-{{ .Release.Name }}
|
||||
- name: config-volume
|
||||
emptyDir: {}
|
||||
|
||||
Reference in New Issue
Block a user