Ansible Script 추가
This commit is contained in:
17
ansible/infra_setting/roles/connect-settings/files/vault_get
Executable file
17
ansible/infra_setting/roles/connect-settings/files/vault_get
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python3
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
import hvac
|
||||
import os
|
||||
|
||||
hostname=os.sys.argv[1]
|
||||
|
||||
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")
|
||||
|
||||
try:
|
||||
data = client.secrets.kv.v2.read_secret_version(mount_point='host', path=hostname, raise_on_deleted_version=True)['data']['data']
|
||||
print(data)
|
||||
except Exception as err:
|
||||
print(err)
|
||||
Reference in New Issue
Block a user