mirror of
https://github.com/CiscoDevNet/cml-community.git
synced 2025-10-23 07:42:03 +00:00
Compare commits
2 Commits
b49259b74f
...
74010cffff
Author | SHA1 | Date | |
---|---|---|---|
|
74010cffff | ||
|
f86bfc37b5 |
@@ -6,7 +6,7 @@ OUT = cml-exporter-installer.sh
|
||||
# List of macros and corresponding files
|
||||
SHELL := /bin/bash
|
||||
|
||||
FILES = scripts/cml-exporter scripts/cml-exporter.py scripts/cml-exporter.service scripts/cml-exporter.sh
|
||||
FILES = scripts/cml-exporter scripts/cml-exporter.py scripts/cml-exporter.service scripts/cml-exporter.sh
|
||||
|
||||
# Generate sed script to replace macros with file contents
|
||||
SED_SCRIPT = $(OUT).sed
|
||||
@@ -31,4 +31,4 @@ $(OUT): $(SRC) $(FILES) $(SED_SCRIPT)
|
||||
clean:
|
||||
rm -f $(SED_SCRIPT)
|
||||
spotless: clean
|
||||
rm -f $(OUT)
|
||||
rm -f $(OUT)
|
||||
|
@@ -294,6 +294,7 @@ After=virl2.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/default/cml-exporter
|
||||
ExecPreStart=/usr/bin/firewall-cmd --zone public --permanent --add-port="${EXPORTER_PORT}/tcp" && /usr/bin/firewall-cmd --reload
|
||||
ExecStart=/usr/local/bin/cml-exporter.sh
|
||||
User=virl2
|
||||
Restart=on-failure
|
||||
@@ -322,17 +323,6 @@ create_venv() {
|
||||
fi
|
||||
}
|
||||
|
||||
add_firewall_rule() {
|
||||
local port="9100"
|
||||
if ! firewall-cmd --list-ports | grep -q "${port}/tcp"; then
|
||||
echo "Adding firewall rule for port $port"
|
||||
firewall-cmd --zone public --permanent --add-port="${port}/tcp"
|
||||
firewall-cmd --reload
|
||||
else
|
||||
echo "Firewall rule for port $port already exists"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root." >&2
|
||||
exit 1
|
||||
@@ -350,28 +340,12 @@ echo -e "\t✅"
|
||||
echo -n "installing service unit"
|
||||
install_service_unit
|
||||
echo -e "\t✅"
|
||||
echo -n "adding firewall rule"
|
||||
add_firewall_rule
|
||||
echo -e "\t✅"
|
||||
|
||||
cat <<EOF
|
||||
**************************************************************
|
||||
* ⚠️ IMPORTANT! ⚠️ *
|
||||
* you need to ensure that you change the username *
|
||||
* and password for a user of the system that can *
|
||||
* start the labs in /etc/default/cml-exporter *
|
||||
* *
|
||||
* If using a port other than 9100, run the *
|
||||
* following command to add a firewall rule: *
|
||||
* *
|
||||
* firewall-cmd --zone public --permanent --add-port=PORT/tcp *
|
||||
* *
|
||||
* Then run: *
|
||||
* firewall-cmd --reload *
|
||||
* *
|
||||
* You can then start the service with: *
|
||||
* *
|
||||
* systemctl start cml-exporter.service. *
|
||||
* *
|
||||
* you need to edit /etc/default/cml-exporter and set the *
|
||||
* CML_USERNAME and CML_PASSWORD variables for a user that. *
|
||||
* has access to see all labs in CML. *
|
||||
**************************************************************
|
||||
EOF
|
||||
|
@@ -63,17 +63,6 @@ create_venv() {
|
||||
fi
|
||||
}
|
||||
|
||||
add_firewall_rule() {
|
||||
local port="9100"
|
||||
if ! firewall-cmd --list-ports | grep -q "${port}/tcp"; then
|
||||
echo "Adding firewall rule for port $port"
|
||||
firewall-cmd --zone public --permanent --add-port="${port}/tcp"
|
||||
firewall-cmd --reload
|
||||
else
|
||||
echo "Firewall rule for port $port already exists"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root." >&2
|
||||
exit 1
|
||||
@@ -91,28 +80,12 @@ echo -e "\t✅"
|
||||
echo -n "installing service unit"
|
||||
install_service_unit
|
||||
echo -e "\t✅"
|
||||
echo -n "adding firewall rule"
|
||||
add_firewall_rule
|
||||
echo -e "\t✅"
|
||||
|
||||
cat <<EOF
|
||||
**************************************************************
|
||||
* ⚠️ IMPORTANT! ⚠️ *
|
||||
* you need to ensure that you change the username *
|
||||
* and password for a user of the system that can *
|
||||
* start the labs in /etc/default/cml-exporter *
|
||||
* *
|
||||
* If using a port other than 9100, run the *
|
||||
* following command to add a firewall rule: *
|
||||
* *
|
||||
* firewall-cmd --zone public --permanent --add-port=PORT/tcp *
|
||||
* *
|
||||
* Then run: *
|
||||
* firewall-cmd --reload *
|
||||
* *
|
||||
* You can then start the service with: *
|
||||
* *
|
||||
* systemctl start cml-exporter.service. *
|
||||
* *
|
||||
* you need to edit /etc/default/cml-exporter and set the *
|
||||
* CML_USERNAME and CML_PASSWORD variables for a user that. *
|
||||
* has access to see all labs in CML. *
|
||||
**************************************************************
|
||||
EOF
|
||||
|
@@ -5,6 +5,7 @@ After=virl2.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/default/cml-exporter
|
||||
ExecPreStart=/usr/bin/firewall-cmd --zone public --permanent --add-port="${EXPORTER_PORT}/tcp" && /usr/bin/firewall-cmd --reload
|
||||
ExecStart=/usr/local/bin/cml-exporter.sh
|
||||
User=virl2
|
||||
Restart=on-failure
|
||||
|
Reference in New Issue
Block a user