diff --git a/ansible/roles/traffic-engine/files/helm/templates/_config.tpl b/ansible/roles/traffic-engine/files/helm/templates/_config.tpl index 465f6dc7..4a1072f3 100644 --- a/ansible/roles/traffic-engine/files/helm/templates/_config.tpl +++ b/ansible/roles/traffic-engine/files/helm/templates/_config.tpl @@ -571,3 +571,9 @@ enable_breakpad_upload=0 - name: dev-shm mountPath: /dev/shm {{- end -}} + +{{- define "traffic-engine.telegraf.read.device-id" -}} + export device_id=`ipmitool fru list |grep 'Product Serial' | awk '{ print $4}'` + if [ -z "$device_id" ]; then export device_id="unknown"; fi + echo "export device_id=${device_id}" > /etc/profile.d/device_id.sh +{{- end -}} \ No newline at end of file diff --git a/ansible/roles/traffic-engine/files/helm/templates/deployment-firewall.yaml b/ansible/roles/traffic-engine/files/helm/templates/deployment-firewall.yaml index 22983160..bab9ef87 100644 --- a/ansible/roles/traffic-engine/files/helm/templates/deployment-firewall.yaml +++ b/ansible/roles/traffic-engine/files/helm/templates/deployment-firewall.yaml @@ -99,7 +99,12 @@ spec: - name: telegraf image: "registry.gdnt-cloud.website/tsg-telegraf:{{ .Chart.AppVersion }}" imagePullPolicy: Never - command: ["/usr/bin/telegraf", "-config", "/etc/telegraf/telegraf_statistic.conf", "-config-directory", "/etc/telegraf/telegraf_statistic.d"] + command: + - "bash" + - "-ec" + - | + {{ template "traffic-engine.telegraf.read.device-id" . }} + /usr/bin/telegraf -config /etc/telegraf/telegraf_statistic.conf -config-directory /etc/telegraf/telegraf_statistic.d securityContext: privileged: true volumeMounts: @@ -117,7 +122,12 @@ spec: - name: telegraf-security image: "registry.gdnt-cloud.website/tsg-telegraf:{{ .Chart.AppVersion }}" imagePullPolicy: Never - command: ["/usr/bin/telegraf", "-config", "/etc/telegraf/telegraf_security.conf", "-config-directory", "/etc/telegraf/telegraf_statistic.d"] + command: + - "bash" + - "-ec" + - | + {{ template "traffic-engine.telegraf.read.device-id" . }} + /usr/bin/telegraf -config /etc/telegraf/telegraf_security.conf -config-directory /etc/telegraf/telegraf_statistic.d securityContext: privileged: true volumeMounts: diff --git a/ansible/roles/traffic-engine/files/helm/templates/deployment-proxy.yaml b/ansible/roles/traffic-engine/files/helm/templates/deployment-proxy.yaml index 74c5b3ac..c299537b 100644 --- a/ansible/roles/traffic-engine/files/helm/templates/deployment-proxy.yaml +++ b/ansible/roles/traffic-engine/files/helm/templates/deployment-proxy.yaml @@ -141,7 +141,12 @@ spec: - name: telegraf-proxy image: "registry.gdnt-cloud.website/tsg-telegraf:{{ .Chart.AppVersion }}" imagePullPolicy: Never - command: ["/usr/bin/telegraf", "-config", "/etc/telegraf/telegraf_proxy.conf", "-config-directory", "/etc/telegraf/telegraf_statistic.d"] + command: + - "bash" + - "-ec" + - | + {{ template "traffic-engine.telegraf.read.device-id" . }} + /usr/bin/telegraf -config /etc/telegraf/telegraf_proxy.conf -config-directory /etc/telegraf/telegraf_statistic.d securityContext: privileged: true volumeMounts: diff --git a/ansible/roles/traffic-engine/files/helm/templates/deployment-service-chaining.yaml b/ansible/roles/traffic-engine/files/helm/templates/deployment-service-chaining.yaml index 0ca5838d..6ca54a65 100644 --- a/ansible/roles/traffic-engine/files/helm/templates/deployment-service-chaining.yaml +++ b/ansible/roles/traffic-engine/files/helm/templates/deployment-service-chaining.yaml @@ -131,7 +131,12 @@ spec: - name: telegraf-sce image: "registry.gdnt-cloud.website/tsg-telegraf:{{ .Chart.AppVersion }}" imagePullPolicy: Never - command: ["/usr/bin/telegraf", "-config", "/etc/telegraf/telegraf_sce.conf", "-config-directory", "/etc/telegraf/telegraf_statistic.d"] + command: + - "bash" + - "-ec" + - | + {{ template "traffic-engine.telegraf.read.device-id" . }} + /usr/bin/telegraf -config /etc/telegraf/telegraf_sce.conf -config-directory /etc/telegraf/telegraf_statistic.d securityContext: privileged: true volumeMounts: diff --git a/ansible/roles/traffic-engine/files/helm/templates/deployment-shaping.yaml b/ansible/roles/traffic-engine/files/helm/templates/deployment-shaping.yaml index bc08ab79..155b7f13 100644 --- a/ansible/roles/traffic-engine/files/helm/templates/deployment-shaping.yaml +++ b/ansible/roles/traffic-engine/files/helm/templates/deployment-shaping.yaml @@ -104,7 +104,12 @@ spec: - name: telegraf-shaping image: "registry.gdnt-cloud.website/tsg-telegraf:{{ .Chart.AppVersion }}" imagePullPolicy: Never - command: ["/usr/bin/telegraf", "-config", "/etc/telegraf/telegraf_shaping.conf", "-config-directory", "/etc/telegraf/telegraf_statistic.d"] + command: + - "bash" + - "-ec" + - | + {{ template "traffic-engine.telegraf.read.device-id" . }} + /usr/bin/telegraf -config /etc/telegraf/telegraf_shaping.conf -config-directory /etc/telegraf/telegraf_statistic.d securityContext: privileged: true volumeMounts: