Commit 0252a426 authored by sergio-tarazona's avatar sergio-tarazona
Browse files

new oai-helm procedure created

parent 537efb33
Pipeline #6135 passed with stage
in 2 minutes and 20 seconds
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "eechart.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{ include "eechart.labels" . | indent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: "vnf-snmp-mibs-{{ .Values.global.osm.vnf_id | lower}}"
data:
{{ (.Files.Glob "snmp/mibs/**").AsConfig | indent 2 }}
\ No newline at end of file
apiVersion: v1
kind: Secret
metadata:
name: {{ include "eechart.fullname" . }}
type: Opaque
data:
mysql_host: {{ .Values.mysql.fullnameOverride | b64enc | quote }}
mysql_user: {{ "root" | b64enc | quote }}
mysql_password: {{ .Values.mysql.auth.rootPassword | b64enc | quote }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "eechart.fullname" . }}
labels:
{{ include "eechart.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: grpc
protocol: TCP
name: grpc
selector:
app.kubernetes.io/name: {{ include "eechart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "eechart.serviceAccountName" . }}
labels:
{{ include "eechart.labels" . | indent 4 }}
{{- end -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "eechart.fullname" . }}
labels:
{{ include "eechart.labels" . | indent 4 }}
spec:
serviceName: {{ include "eechart.fullname" . }}
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "eechart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "eechart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
vnf: {{ .Values.global.osm.vnf_id | lower}}
spec:
imagePullSecrets:
- name: regcred
serviceAccountName: {{ template "eechart.serviceAccountName" . }}
securityContext:
runAsUser: 0
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ include "eechart.fullname" . }}
ports:
- name: grpc
containerPort: 50051
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: osm-ee
mountPath: /app/storage
- name: osm-ee-source
mountPath: /app/EE/osm_ee/vnf
- name: snmp-config-volume
mountPath: /etc/snmp_exporter
- name: vnf-mibs
mountPath: /root/.snmp/mibs
- name: vnf-generator
mountPath: /app/vnf/generator
volumes:
- name: osm-ee-source
configMap:
name: {{ include "eechart.fullname" . }}
- name: snmp-config-volume
hostPath:
path: "/var/lib/osm/snmp_exporter/{{ .Values.global.osm.vnf_id | lower }}/"
- name: vnf-mibs
configMap:
name: "vnf-snmp-mibs-{{ .Values.global.osm.vnf_id | lower}}"
- name: vnf-generator
configMap:
name: "vnf-snmp-generator-{{ .Values.global.osm.vnf_id | lower}}"
- name: osm-ee
hostPath:
path: /var/lib/osm/osm/osm_osm_packages/_data
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "eechart.fullname" . }}-test-connection"
labels:
{{ include "eechart.labels" . | indent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "eechart.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
global:
osm:
vnf_id: AVNFId
# Default values for eechart.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: opensourcemano/api-fe
tag: latest
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: false
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name:
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 50050
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
mysql:
auth:
rootPassword: "123456"
fullnameOverride: "eechart-mysql"
vnfd:
description: gnbsim VNF with 2 networks attached
df:
- id: default-df
instantiation-level:
- id: default-instantiation-level
vdu-level:
- number-of-instances: 1
vdu-id: gnbsim-VM
vdu-profile:
- id: gnbsim-VM
min-number-of-instances: 1
lcm-operations-configuration:
operate-vnf-op-config:
day1-2:
- config-primitive:
- execution-environment-primitive: gnbsim_up
execution-environment-ref: gnbsim
name: gnbsim_up
parameter:
- data-type: STRING
name: file
- execution-environment-primitive: gnbsim_down
execution-environment-ref: gnbsim
name: gnbsim_down
parameter:
- data-type: STRING
name: file
- execution-environment-primitive: send_command
execution-environment-ref: gnbsim
name: send_command
parameter:
- data-type: STRING
name: file
# - execution-environment-primitive: run_script
# execution-environment-ref: gnbsim
# name: run_script
# parameter:
# - data-type: STRING
# name: file
# - data-type: STRING
# name: parameters
# - execution-environment-primitive: ansible_playbook
# execution-environment-ref: gnbsim
# name: ansible_playbook
# parameter:
# - data-type: STRING
# name: playbook-name
# - data-type: STRING
# name: app
# - execution-environment-primitive: ping
# execution-environment-ref: gnbsim
# name: ping
# - execution-environment-primitive: http_check
# execution-environment-ref: gnbsim
# name: http_check
# - execution-environment-primitive: touch
# execution-environment-ref: gnbsim
# name: touch
# parameter:
# - data-type: STRING
# name: file
# - execution-environment-primitive: check_database
# execution-environment-ref: gnbsim
# name: check_database
config-access:
ssh-access:
default-user: ubuntu
required: true
execution-environment-list:
- external-connection-point-ref: vnf-mgmt-ext
helm-chart: eechart
id: gnbsim
id: gnbsim-vnf
initial-config-primitive:
- execution-environment-ref: gnbsim
name: config
parameter:
- name: ssh-hostname
value: <rw_mgmt_ip>
- name: ssh-username
value: ubuntu
seq: 1
- execution-environment-ref: gnbsim
name: run_script
parameter:
- name: file
value: install_docker.sh
seq: 2
- execution-environment-ref: gnbsim
name: copy_files
parameter:
- name: file
value: docker-compose-gnbsim.yaml
seq: 3
# - execution-environment-ref: gnbsim
# name: ansible_playbook
# parameter:
# - name: playbook-name
# value: playbook.yaml
# - name: app
# value: ntp
# seq: 3
# - execution-environment-ref: gnbsim
# name: ping
# seq: 4
# - execution-environment-ref: gnbsim
# name: http_check
# seq: 5
# - execution-environment-ref: gnbsim
# name: touch
# parameter:
# - name: file
# value: myfile.txt
# seq: 3
# - execution-environment-ref: gnbsim
# name: check_database
# seq: 7
ext-cpd:
- id: vnf-mgmt-ext
int-cpd:
cpd: vdu-eth0-int
vdu-id: gnbsim-VM
- id: vnf-internal-ext
int-cpd:
cpd: vdu-eth1-int
vdu-id: gnbsim-VM
id: gnbsim-vnf
mgmt-cp: vnf-mgmt-ext
product-name: gnbsim-vnf
sw-image-desc:
- id: ubuntu20.04
image: ubuntu20.04
name: ubuntu20.04
- id: ubuntu20.04-azure
name: ubuntu20.04-azure
image: Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest
vim-type: azure
- id: ubuntu20.04-gcp
name: ubuntu20.04-gcp
image: ubuntu-os-cloud:image-family:ubuntu-2004-lts
vim-type: gcp
vdu:
- id: gnbsim-VM
int-cpd:
- id: vdu-eth0-int
virtual-network-interface-requirement:
- name: vdu-eth0
position: 0
virtual-interface:
type: PARAVIRT
- id: vdu-eth1-int
virtual-network-interface-requirement:
- name: vdu-eth1
position: 1
virtual-interface:
type: PARAVIRT
- id: vdu-eth2-int
virtual-network-interface-requirement:
- name: vdu-eth2
position: 2
virtual-interface:
type: PARAVIRT
name: gnbsim-VM
supplemental-boot-data:
boot-data-drive: true
sw-image-desc: ubuntu20.04
alternative-sw-image-desc:
- ubuntu20.04-azure
- ubuntu20.04-gcp
virtual-compute-desc: gnbsim-VM-compute
virtual-storage-desc:
- gnbsim-VM-storage
version: 1.0
virtual-compute-desc:
- id: gnbsim-VM-compute
virtual-cpu:
num-virtual-cpu: 1
virtual-memory:
size: 4.0
virtual-storage-desc:
- id: gnbsim-VM-storage
size-of-storage: 20
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
apiVersion: v1
appVersion: "1.0"
description: OSM EE helm chart
name: eechart
version: 0.1.0
version: '3.8'
services:
gnbsim:
container_name: gnbsim
image: rohankharade/gnbsim:latest
privileged: true
environment:
- MCC=208
- MNC=95
- GNBID=1
- TAC=0x0001
- SST=222
- SD=00007b
- PagingDRX=v32
- RANUENGAPID=0
- IMEISV=35609204079514
- MSIN=0000000031
- RoutingIndicator=1234
- ProtectionScheme=null
- KEY=0C0A34601D4F07677303652C0462535B
- OPc=63bfa50ee6523365ff14c1f45f88737d
- DNN=default
- URL=http://www.asnt.org:8080/
- NRCellID=1
- USE_FQDN=no
- NGAPPeerAddr=192.168.18.177
- GTPuLocalAddr=192.168.69.136
- GTPuIFname=eth0
networks:
public_net:
ipv4_address: 192.168.69.136
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
gnbsim2:
container_name: gnbsim2
image: gnbsim:latest
privileged: true
environment:
- MCC=208
- MNC=95
- GNBID=2
- TAC=0x00a000
- SST=222
- SD=00007b
- PagingDRX=v32
- RANUENGAPID=0
- IMEISV=35609204079514
- MSIN=0000000032
- RoutingIndicator=1234
- ProtectionScheme=null
- KEY=0C0A34601D4F07677303652C0462535B
- OPc=63bfa50ee6523365ff14c1f45f88737d
- DNN=default
- URL=http://www.asnt.org:8080/
- NRCellID=1
- USE_FQDN=no
- NGAPPeerAddr=192.168.18.177
- GTPuLocalAddr=192.168.69.137
- GTPuIFname=eth0
networks:
public_net:
ipv4_address: 192.168.69.137
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
gnbsim3:
container_name: gnbsim3
image: gnbsim:latest
privileged: true
environment:
- MCC=208
- MNC=95
- GNBID=3
- TAC=0x0001
- SST=111
- SD=124
- PagingDRX=v32
- RANUENGAPID=0
- IMEISV=35609204079514
- MSIN=0000000033
- RoutingIndicator=1234
- ProtectionScheme=null
- KEY=0C0A34601D4F07677303652C0462535B
- OPc=63bfa50ee6523365ff14c1f45f88737d
- DNN=default
- URL=http://www.asnt.org:8080/
- NRCellID=1
- USE_FQDN=no
- NGAPPeerAddr=192.168.18.177
- GTPuLocalAddr=192.168.69.138
- GTPuIFname=eth0
networks:
public_net:
ipv4_address: 192.168.69.138
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
gnbsim4:
container_name: gnbsim4
image: gnbsim:latest
privileged: true
environment:
- MCC=208
- MNC=95
- GNBID=4
- TAC=0x00a000
- SST=222
- SD=00007b
- PagingDRX=v32
- RANUENGAPID=0
- IMEISV=35609204079514
- MSIN=0000000034
- RoutingIndicator=1234
- ProtectionScheme=null
- KEY=0C0A34601D4F07677303652C0462535B
- OPc=63bfa50ee6523365ff14c1f45f88737d
- DNN=default
- URL=http://www.asnt.org:8080/
- NRCellID=1
- USE_FQDN=no
- NGAPPeerAddr=192.168.18.177
- GTPuLocalAddr=192.168.70.139
- GTPuIFname=eth0
networks:
public_net:
ipv4_address: 192.168.70.139
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
gnbsim5:
container_name: gnbsim5
image: gnbsim:latest
privileged: true
environment:
- MCC=208
- MNC=95
- GNBID=5
- TAC=0x00a000
- SST=222
- SD=00007b
- PagingDRX=v32
- RANUENGAPID=0
- IMEISV=35609204079514
- MSIN=0000000035
- RoutingIndicator=1234
- ProtectionScheme=null
- KEY=0C0A34601D4F07677303652C0462535B
- OPc=63bfa50ee6523365ff14c1f45f88737d
- DNN=default
- URL=http://www.asnt.org:8080/
- NRCellID=1
- USE_FQDN=no
- NGAPPeerAddr=192.168.70.132
- GTPuLocalAddr=192.168.70.140
- GTPuIFname=eth0
networks:
public_net:
ipv4_address: 192.168.70.140
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
gnbsim-fqdn:
container_name: gnbsim-fqdn
image: gnbsim:latest
privileged: true
environment:
- MCC=208
- MNC=95
- GNBID=5
- TAC=0x00a000
- SST=222
- SD=00007b
- PagingDRX=v32
- RANUENGAPID=0
- IMEISV=35609204079514
- MSIN=0000000035
- RoutingIndicator=1234
- ProtectionScheme=null
- KEY=0C0A34601D4F07677303652C0462535B
- OPc=63bfa50ee6523365ff14c1f45f88737d
- DNN=default
- URL=http://www.asnt.org:8080/
- NRCellID=1
- USE_FQDN=yes
- AMF_FQDN=amf.oai-5gc.eur
- GTPuIFname=eth0
networks:
public_net:
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
gnbsim-vpp:
container_name: gnbsim-vpp
image: gnbsim:latest
privileged: true
environment:
- MCC=208
- MNC=95
- GNBID=5
- TAC=0x00a000
- SST=222
- SD=00007b
- PagingDRX=v32
- RANUENGAPID=0
- IMEISV=35609204079514
- MSIN=0000000035
- RoutingIndicator=1234
- ProtectionScheme=null
- KEY=0C0A34601D4F07677303652C0462535B
- OPc=63bfa50ee6523365ff14c1f45f88737d
- DNN=default
- URL=http://www.asnt.org:8080/
- NRCellID=1
- USE_FQDN=no
# - USE_FQDN=yes
# - AMF_FQDN=amf.oai-5gc.eur
- NGAPPeerAddr=192.168.71.132
- GTPuLocalAddr=192.168.72.141
- GTPuIFname=eth1
networks:
public_net_core:
ipv4_address: 192.168.71.141
public_net_access:
ipv4_address: 192.168.72.141
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
networks:
public_net:
external:
name: demo-oai-public-net
public_net_core:
name: oai-public-core
ipam:
config:
- subnet: 192.168.71.0/24
public_net_access:
name: oai-public-access
ipam:
config:
- subnet: 192.168.72.0/24
# Incase the user wants docker-compose to create a bridge rather than creating the bridge manually then uncomment the below lines
public_net:
driver: bridge
name: demo-oai-public-net
ipam:
config:
- subnet: 192.168.69.128/26
driver_opts:
com.docker.network.bridge.name: "demo-oai"
#!/bin/bash
##
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
##
echo "Updating operating system"
apt-get update
# Install ansible libraries
echo "Installing ansible"
apt-get install -y software-properties-common
apt-add-repository --yes --update ppa:ansible/ansible
apt install -y ansible
# Install library to execute command remotely by ssh
echo "Installing asynssh"
python3 -m pip install asyncssh
# Install ping system command
apt install -y iputils-ping
# Install HTTP python library
python3 -m pip install requests
# Install MySQL library
python3 -m pip install mysql-connector-python
#!/usr/bin/env bash
set -eux
sudo -s <<EOF
apt-get -y update
apt-get -y install \
ca-certificates \
curl \
gnupg \
lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get -y update
apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
groupadd docker
usermod -aG docker ubuntu
newgrp docker
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sysctl net.ipv4.conf.all.forwarding=1
iptables -P FORWARD ACCEPT
ip route add 192.168.70.128/26 via 192.168.1.1 dev ens4
ip route add 192.168.18.0/24 via 192.168.1.1 dev ens4
EOF
##
# Copyright 2022 Telefonica Investigacion y Desarrollo, S.A.U.
# This file is part of OSM
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# For those usages not covered by the Apache License, Version 2.0 please
# contact with: nfvlabs@tid.es
##
import logging
import asyncio
import asyncssh
import time
from mysql.connector import connect, Error
logger = logging.getLogger("osm_ee.vnf")
async def ssh_exec(host: str, user: str, command: str
) -> (int, str):
"""
Execute a remote command via SSH.
"""
try:
async with asyncssh.connect(host,
username=user,
known_hosts=None) as conn:
logger.debug("Executing command '{}'".format(command))
result = await conn.run(command)
logger.debug("Result: {}".format(result))
return result.exit_status, result.stderr
except Exception as e:
logger.error("Error: {}".format(repr(e)))
return -1, str(e)
def mysql_query(host: str, user: str, password: str, retries: int, query: str
) -> (int, str):
"""
Execute a query to a MySQL database.
"""
text = ""
logger.debug("Host: '{}', user: '{}', password: '{}', query: '{}'".format(host, user, password, query))
for i in range(0, retries):
try:
with connect(
host=host,
user=user,
password=password,
) as connection:
with connection.cursor() as cursor:
cursor.execute(query)
for (db) in cursor:
logger.debug(db)
text = text + str(db[0]) + ", "
return 0, text[0:len(text)-2]
except Error as e:
text = str(e)
logger.debug("Error: {}".format(e))
time.sleep(3)
continue
return -1, text
---
- hosts: all
become: yes
tasks:
- name: Wait 120 seconds, but only start checking after 10 seconds
wait_for_connection:
delay: 20
timeout: 120
- name: Install packages
apt:
name:
- "{{ app }}"
state: latest
cache_valid_time: 3600
#!/usr/bin/env bash
date "+%H:%M:%S Starting $0..."
IP=$1
USERNAME=$2
SCRIPT=$3
PARAMS=$4
DIR=$(dirname $0)
date "+%H:%M:%S Waiting for $IP to be ready..."
i=5
while ! ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o LogLevel=ERROR "$USERNAME"@"$IP" 'exit' ; do
date "+%H:%M:%S Error accessing $IP, retrying..."
sleep 5
i=$(( $i - 1 ))
[ $i -ge 0 ] || exit 1
done
date "+%H:%M:%S SSH server is up, sending script '${DIR}/${SCRIPT}'..."
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${DIR}/${SCRIPT} "$USERNAME"@"$IP":
if [ $? -ne 0 ]; then
date "+%H:%M:%S scp error"
exit 1
fi
date "+%H:%M:%S OK. Setting file permissions"
ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o LogLevel=ERROR "$USERNAME"@"$IP" "chmod a+x $SCRIPT"
if [ $? -ne 0 ]; then
date "+%H:%M:%S ssh error"
exit 1
fi
COMMAND="./$SCRIPT"
[ ${#PARAMS} -ge 0 ] || COMMAND="${COMMAND=} $PARAMS"
date "+%H:%M:%S Running '$COMMAND' on $IP..."
ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o LogLevel=ERROR "$USERNAME"@"$IP" "$COMMAND"
if [ $? -ne 0 ]; then
date "+%H:%M:%S ssh error"
exit 1
fi
date "+%H:%M:%S End"
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment