ansible-vault

Git clean/smudge filters for ansible vault secrets

一笑奈何 提交于 2019-12-04 13:57:57
问题 I am trying to setup clean/smudge filter in git to have automatic encrypting and decrypting of files containing secrets thru ansible-vault command. Peculiarity of the ansible-vault command is that it is not idempotent (it creates a different binary each time it is invoked on the same data). I started with the implementation suggested in this blog page. Unfortunately it did not work correctly, as whenever smudge is called (be it a git checkout , or just git status), the secret files looks as

How to decrypt string with ansible-vault 2.3.0

巧了我就是萌 提交于 2019-12-03 14:24:58
问题 I have been waiting for ansible 2.3 as it was going to introduce encrypt_string feature. Unfortuately I'm not sure how can I read the encrypted string. I did try decrypt_string , decrypt (the file), view (the file) and nothing works. cat test.yml --- test: !vault | $ANSIBLE_VAULT;1.1;AES256 37366638363362303836383335623066343562666662386233306537333232396637346463376430 3664323265333036663736383837326263376637616466610a383430623562633235616531303861

Git clean/smudge filters for ansible vault secrets

我与影子孤独终老i 提交于 2019-12-03 08:54:31
I am trying to setup clean/smudge filter in git to have automatic encrypting and decrypting of files containing secrets thru ansible-vault command. Peculiarity of the ansible-vault command is that it is not idempotent (it creates a different binary each time it is invoked on the same data). I started with the implementation suggested in this blog page . Unfortunately it did not work correctly, as whenever smudge is called (be it a git checkout , or just git status), the secret files looks as modified for git, even if it is not. So I wondered if git would be comparing the binary he has in the

Ansible with “Alternative Directory Layout” and using vaults

别说谁变了你拦得住时间么 提交于 2019-12-02 03:03:45
I am trying to use the Alternative Directory Layout and ansible-vaults within. But when i run my playbook, variables which are vault encrypted could not resolve with that directory structure. So what iam doing wrong? I execute via: ansible-playbook -i inventories/inv/hosts playbooks/inv/invTest.yml --check --ask-vault Here is my structure: . ├── inventories │ ├── inv │ │ ├── group_vars │ │ │ ├── var.yml │ │ │ └── vault.yml │ │ └── hosts │ └── staging │ ├── group_vars │ │ ├── var.yml │ │ └── vault.yml │ └── hosts ├── playbooks │ ├── staging │ │ └── stagingTest.yml │ └── inv │ ├── invTest.retry

how to use include_vars in ansible

孤街醉人 提交于 2019-11-30 01:37:15
问题 I have created my own custom library, I added my custom library in the common folder of my repository. In that I need to pass variables dynamically. It's a confidential password, so I am using "vault" in ansible. In that my requirement is how to pass include_vars in the tasks\main.yml before hosts. e.g: mytasks.yml - include_vars: sample_vault.yml - include: sample_tasks.yml - hosts: localhost tasks: name: "free task" command: ls -a my directory structure like this: myfolder - common -library

Inline encrypted variable not JSON serializable

半城伤御伤魂 提交于 2019-11-29 19:09:25
问题 I'm trying to understand how to encrypt single variables with vault. First I encrypt the string with ansible-vault encrypt_string -n -p , then I write the output into my playbook. When I execute the playbook it says that the decrypted string isn't JSON serializable. Encrypted string: "inline_name" I also tried it with inline_name and inlinename , every time with the same result. My playbook: --- - name: Build System hosts: dev tasks: - name: Create mysql_db: state: present name: !vault |

How to diff ansible vault changes?

不想你离开。 提交于 2019-11-28 17:16:01
I'd like to see the actual git commit changes in the ansible vault file. Is there an easy way how to achieve this? You can do this very neatly, so that the normal git tools like git log and git diff can see inside the vaulted files, using a custom git diff driver and .gitattributes . Make sure that your vault password is in .vault_password and that that file is not committed - you should also add it to .gitignore . Add a .gitattributes file that matches any files in your repository that are encrypted with ansible-vault and give them the attribute diff=ansible-vault . For example, I have: env

How to diff ansible vault changes?

十年热恋 提交于 2019-11-27 05:17:35
问题 I'd like to see the actual git commit changes in the ansible vault file. Is there an easy way how to achieve this? 回答1: You can do this very neatly, so that the normal git tools like git log and git diff can see inside the vaulted files, using a custom git diff driver and .gitattributes . Make sure that your vault password is in .vault_password and that that file is not committed - you should also add it to .gitignore . Add a .gitattributes file that matches any files in your repository that