Stuff I'm Up To

Technical Ramblings

Ansible Vault and Lint Errors — May 22, 2023

Ansible Vault and Lint Errors

Using the VS Code plugin for Ansible, I’m getting an internal error when it lints a YAML file. I know the syntax is OK, as I can run an ansible-playbook with --syntax-check and it works.

But then I’m using a command line that also includes my Ansible vault password file:

ansible-playbook -i inventory.yml --syntax-check desktop-playbook.yml --vault-password-file=~/.ansible/secret

The VS Code linter, doesn’t do this. So if I repeat the call without the vault password file, I get:

ansible-playbook -i inventory.yml --syntax-check desktop-playbook.yml                                  
ERROR! Attempting to decrypt but no vault secrets found

To solve the puzzle, you need to edit /etc/ansible/ansible.cfg, and put your vault file in the config:

vault_password_file = ~/.ansible/secret

Now, when you run the --syntax-check without the --vault-password-file parameter, it should work. Meaning, the VS Code lint should work also.

References

Ansible Lint Documentation

https://github.com/ansible/ansible-lint/issues/115#issuecomment-774472336

Happy Desktop, Part 2 —
Zeal – Offline Reference — May 9, 2023

Zeal – Offline Reference

I came across Zeal some time ago, and for some reason never really got to using it. Mainly because I’m always online and always have access to reference sources. Also, I find myself with a lesser need for documentation as the product base I deal with shrinks.

Then I find I get asked to get stuck in at the coal face and bring out my old Laravel, PHP and JavaScript skills, to bring more hands to a development project. Out comes VSCode and a bag of helpful plugins, and I rediscover zeal.

Install Zeal onto my desktop. Add a few document sets that I need – Laravel, PHP and JavaScript. Then use the Dash VSCode plugin (It supports Dash – MacOS, Zeal – Linux and Velocity – Windows).

Then a simple CTRL+H in VSCode links me to the Zeal documentation search.