Git Product home page Git Product logo

Comments (3)

b-long avatar b-long commented on June 21, 2024 3

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

from ansible-vault.

jhaals avatar jhaals commented on June 21, 2024

from ansible-vault.

b-long avatar b-long commented on June 21, 2024

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

from ansible-vault.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.