VS Code Ansible Vault Inline Extended
This repository is a GitHub-hosted fork of
wolfmah/vscode-ansible-vault-inline.
It keeps the original extension behavior for encrypting and decrypting Ansible Vault
files and inline values, and adds a safer clipboard workflow for secrets.
What's different in this fork
- Adds a command to copy a selected encrypted inline vault value to the clipboard as
plain text without modifying the source document
- Keeps the existing inline encrypt/decrypt workflow
- Keeps support for Vault IDs and remembered encryption Vault IDs
This is useful when you need to paste a secret somewhere else, but want to avoid
temporarily writing decrypted content back into the file by accident.
Features
- Encrypt or decrypt the current selection
- Encrypt or decrypt the whole file when no text is selected
- Preserve indentation when encrypting inline values
- Read vault credentials from
ansible.cfg, extension settings, or an entered password
- Support
vault_identity_list
- Remember a default Vault ID for encryption
- Copy a selected encrypted inline vault block to the clipboard in decrypted form while
leaving the source unchanged
Commands and shortcuts
Encrypt/decrypt file or selection
- Command:
Encrypt/Decrypt with ansible-vault-inline-extended
- Shortcut:
- Windows/Linux:
Ctrl+Alt+0
- macOS:
Cmd+Alt+0
Behavior:
- If text is selected, the extension encrypts or decrypts the selected inline value
- If nothing is selected, the extension encrypts or decrypts the entire file
Copy decrypted selection to clipboard
- Command:
Copy decrypted selected inline vault to clipboard (source unchanged)
- Shortcut:
- Windows/Linux:
Ctrl+Alt+9
- macOS:
Cmd+Alt+9
Behavior:
- Expects the current selection to contain an encrypted inline vault block
- Decrypts the selected value
- Writes the decrypted result to the VS Code clipboard
- Does not modify the source file
Remember Vault ID for encryption
- Command:
Remember vault ID for encryption with ansible-vault-inline-extended
- Shortcut:
- Windows/Linux:
Ctrl+Alt+=
- macOS:
Cmd+Alt+=
Reset remembered Vault ID
- Command:
Reset vault ID setting for ansible-vault-inline-extended
- Shortcut:
- Windows/Linux:
Ctrl+Alt+-
- macOS:
Cmd+Alt+-
Usage notes
To read a vault password file from your computer, you can specify
vault_password_file in ansible.cfg or configure it through the extension
settings.
You can also use vault_identity_list in ansible.cfg or through extension
settings, for example:
vault_identity_list = dev@~/dev.key, prod@~/prod.key
When multiple Vault IDs are available, the extension can prompt for one during
encryption. You can also store a preferred default using the
ansibleVaultInline.encryptVaultId setting or the shortcut above.
To learn more about Vault IDs, see the
Ansible documentation.
Requirements
- Ansible with
ansible-vault available
Extension settings
This extension contributes the following settings:
ansibleVaultInline.executable: full path to the ansible-vault executable
ansibleVaultInline.keyfile: vault password file path or Vault ID list
ansibleVaultInline.keypass: vault password text
ansibleVaultInline.encryptVaultId: default Vault ID used for encryption
Development
Build
npm install
npm run compile
Test
npm test
Publishing this fork
Before publishing this fork to the VS Code Marketplace, review and update the
extension metadata in package.json, especially the publisher, display name,
description, and repository URL.