Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install instructions? #50

Closed
b-long opened this issue Jul 21, 2017 · 3 comments
Closed

Install instructions? #50

b-long opened this issue Jul 21, 2017 · 3 comments

Comments

@b-long
Copy link

b-long commented Jul 21, 2017

Hi @jhaals , great plugin!

Would you mind adding some content to the README describing the install process?

@jhaals
Copy link
Owner

jhaals commented Jul 21, 2017 via email

@b-long
Copy link
Author

b-long commented Jul 21, 2017

Cool, I appreciate it 😄 👍 Looking forward to it.

@b-long
Copy link
Author

b-long commented Jul 21, 2017

I just figured out one of the many installation options and wanted to propose a "hello world" solution.

  1. Create an ansible.cfg file next to a given playbook (e.g. print-secret.yml) :
$ cat ansible.cfg 
[defaults]
lookup_plugins = ./lookup_plugins
  1. Create a folder to hold your lookup plugins:
$ mkdir lookup_plugins/
  1. Clone this plugin into the directory
$ cd lookup_plugins/
$ git clone https://github.com/jhaals/ansible-vault.git
  1. Use the plugin.

Here's an example playbook:

---
- hosts: localhost
  connection: local
  gather_facts: False

  tasks:

  - name: Get a secret from Vault
    debug: msg="{{ lookup('vault', 'secret/digitalocean-api-key', 'value') }}"

Run it as normal: ansible-playbook print-secret.yml, and you'll get the following output:

 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available


PLAY [localhost] ***************************************************************

TASK [Get a secret from Vault] *************************************************
ok: [localhost] => {
    "msg": "7872q4cfff396de2c1x7d052bfec4b0d4"
}

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0   

Truthfully, my opinion is that Ansible itself doesn't explain plugin installation very well. For instance, I think such a description should be more obvious on this page: https://docs.ansible.com/ansible/latest/intro_configuration.html

@jhaals jhaals closed this as completed in 23e4bc4 Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants