22 lines
595 B
Python
Executable File
22 lines
595 B
Python
Executable File
#!/usr/bin/python3
|
|
#-*- coding: utf-8 -*-
|
|
|
|
import hvac
|
|
import os
|
|
|
|
hostname=os.sys.argv[1]
|
|
accountid=os.sys.argv[2]
|
|
password=os.sys.argv[3]
|
|
adminuser=os.sys.argv[4]
|
|
adminpass=os.sys.argv[5]
|
|
|
|
str_url = "http://10.10.43.240:30803"
|
|
client = hvac.Client(url=str_url)
|
|
client.auth.approle.login(role_id="e96c5fd8-abde-084a-fde7-7450a9348a70", secret_id="5371706b-414a-11d3-f3fd-6cf98871aad1")
|
|
|
|
client.secrets.kv.v2.create_or_update_secret(
|
|
mount_point='host',
|
|
path=hostname,
|
|
secret=dict(accountid=f'{accountid}',password=f'{password}',adminuser=f'{adminuser}',adminpass=f'{adminpass}')
|
|
)
|