Giter Club home page Giter Club logo

ansible-lookup-plugin-gopass's Introduction

Ansible gopass Lookup Plugin

Ansible lookup plugin for the gopass password manager.

This lookup plugin allows you to use gopass to generate passwords. It mimics the behaviour of the password lookup, but using gopass instead of plaintext files for storing the passwords.

If the password doesn't exist it will be generated with the parameters.

Usage

Clone this repository in a directory of your choice and tell ansible to look for plugins there by setting something like this in ansible.cfg:

lookup_plugins=/path/to/ansible/plugins

Then just use it as you would use the password lookup, but with the path to your password instead of the path to a file. For example, if you would normally get your password with

$ gopass show path/to/your/password

you would use it like this in a playbook to set the password of a user

---
- hosts: monitoringserver
  tasks:
    - set_fact:
        password: "{{ lookup('gopass', 'path/to/your/password') }}"
      # https://docs.ansible.com/ansible/latest/reference_appendices/logging.html#protecting-sensitive-data-with-no-log
      no_log: true

    - name: set password for user debian
      user:
        name: debian
        password: "{{ password | password_hash('sha512') }}"
        state: present
        shell: /bin/bash

Parameters

You can use parameters to control how gopass generate will be called.

  • length: length of the generated password (default: 32).
  • symbols: include symbols in the generated password (default: False).
  • regenerate: force the generation of a new password (default: False).
  • list: list the passwords under the given path (default: False).

Installation

Arch Linux

This ansible plugin is availiable via the AUR as ansible-gopass.

Examples

Get a single password

password: "{{ lookup('gopass', 'path/to/your/password', length=16, symbols=True, regenerate=True) }}"

Get all passwords under a path

- debug:
    msg: "{{ lookup('gopass', item) }}"
  # https://docs.ansible.com/ansible/latest/reference_appendices/logging.html#protecting-sensitive-data-with-no-log
  # no_log: true
  with_items: "{{ lookup('gopass', 'heuselfamily/mqtt/', list=True) }}"

License & Acknowledgements

The contents of this repository are based on https://github.com/gcoop-libre/ansible-lookup-plugin-pass and share a common history.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

ansible-lookup-plugin-gopass's People

Contributors

christian-heusel avatar csegarra avatar osiris avatar pigmonkey avatar unrblt avatar

Watchers

 avatar

ansible-lookup-plugin-gopass's Issues

Allow iteration over multiple passwords

API is not yet quite clear but one can find multiple passwords like so

$ gopass search mqtt
heuselfamily/mqtt/defaultsink2mqtt
heuselfamily/mqtt/delock-4174
heuselfamily/mqtt/regelwerk
heuselfamily/mqtt/sonoff-1014c6-7582
heuselfamily/mqtt/testuser
heuselfamily/mqtt/ug_serverschrank_shelly_1pm

Maybe something like this would be good:

---
- hosts: localhost
  tasks:
    - debug:
        msg: "{{ item }}"
      with_items: "{{ lookup('gopass', 'heuselfamily/mqtt/', search=True) }}"

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.