Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24962913
roles/router/carp/files/carp-ovh-switch.py
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Sat, Mar 21, 16:07
2026-03-21 16:07:04 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
roles/router/carp/files/carp-ovh-switch.py
View Options
#!/usr/bin/env python3
# -------------------------------------------------------------
# Switch CARP MAC at OVH level
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Switch MAC address for CARP VIP on router-002 and router-003
# License: BSD-2-Clause
# Source file: roles/router/carp/files/carp-ovh-switch.py
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
import
os
import
hvac
import
ovh
import
sys
from
secretsmith.vault.secrets
import
read_secret
# -------------------------------------------------------------
# Vault - Query OVH API credentials
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CA_PATH
=
"/usr/local/share/certs/nasqueron-vault-ca.crt"
SECRET_MOUNT
=
"apps"
SECRET_PATH
=
"network/carp-hyper-001-switch"
def
query_credentials
():
client
=
hvac
.
Client
(
verify
=
CA_PATH
)
return
read_secret
(
client
,
SECRET_MOUNT
,
SECRET_PATH
)
def
get_ovh_api_client
():
secret
=
query_credentials
()
return
ovh
.
Client
(
endpoint
=
"ovh-eu"
,
application_key
=
secret
[
"application_key"
],
application_secret
=
secret
[
"application_secret"
],
consumer_key
=
secret
[
"consumer_key"
],
)
# -------------------------------------------------------------
# Application entry point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
run
():
client
=
get_ovh_api_client
()
print
(
client
.
get
(
'/dedicated/server/ns3173530.ip-51-210-99.eu/virtualMac/00:50:56:09:98:fc/virtualAddress'
))
if
__name__
==
"__main__"
:
run
()
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3553898
Default Alt Text
roles/router/carp/files/carp-ovh-switch.py (1 KB)
Attached To
Mode
P392 roles/router/carp/files/carp-ovh-switch.py
Attached
Detach File
Event Timeline
Log In to Comment