mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 15:28:12 +02:00
Refactored main.yml
This commit is contained in:
20
cli/vault.py
Normal file
20
cli/vault.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
def run_ansible_vault(action, filename, password_file):
|
||||
cmd = ["ansible-vault", action, filename, "--vault-password-file", password_file]
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Manage Ansible Vault")
|
||||
parser.add_argument("action", choices=["edit", "decrypt", "encrypt"], help="Vault action")
|
||||
parser.add_argument("filename", help="File to process")
|
||||
parser.add_argument("--password-file", required=True, help="Path to the Vault password file")
|
||||
args = parser.parse_args()
|
||||
|
||||
run_ansible_vault(args.action, args.filename, args.password_file)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user