Coder Social home page Coder Social logo

capusta / ssm_parameter_store Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bwits/ssm_parameter_store

0.0 2.0 0.0 43 KB

ansible module to manage key/value in aws parameter store

License: GNU General Public License v3.0

Python 99.58% Shell 0.42%

ssm_parameter_store's Introduction

ssm_parameter_store

ansible module to manage key/value in aws parameter store

Target file: library/ssm_parameter_store.py

Pull request has been raised to ansible.

ansible/ansible#23460

Usage:

- name: Create or update key/value pair in aws parameter store
  ssm_parameter_store:
    name: "Hello"
    description: "This is your first key"
    value: "World"

- name: Delete the key
  ssm_parameter_store:
    name: "Hello"
    state: absent

- name: Delete non-exist key
  ssm_parameter_store:
    name: "notkey"
    state: absent

- name: Create or update secure key/value pair with nominated kms key
  ssm_parameter_store:
    name: "Hello"
    description: "This is your first key"
    key_id: "alias/demo"
    string_type: "SecureString"
    value: "World"

Example:

test/roles/test/tasks/main.yml

Reference:

http://docs.ansible.com/ansible/dev_guide/developing_modules.html

https://github.com/ansible/ansible-modules-extras/blob/devel/cloud/amazon/ec2_vpc_nacl.py

Parameter lookup plungin

ansible lookup plugin to easily get key-value from aws parameter store

Target file: lookup/ssm.py

lookup sample:

# lookup sample:
- name: lookup ssm parameter store in the current region
  debug: msg="{{ lookup('ssm', 'Hello' ) }}"

- name: lookup a key which doesn't exist, return ""
  debug: msg="{{ lookup('ssm', 'NoKey') }}"

- name: lookup ssm parameter store in nominated region
  debug: msg="{{ lookup('ssm', 'Hello', 'region=us-east-2' ) }}"

- name: lookup ssm parameter store without decrypted
  debug: msg="{{ lookup('ssm', 'Hello', 'decrypt=False' ) }}"

- name: lookup ssm parameter store in nominated aws profile
  debug: msg="{{ lookup('ssm', 'Hello', 'aws_profile=myprofile' ) }}"

- name: lookup ssm parameter store with all options.
  debug: msg="{{ lookup('ssm', 'Hello', 'decrypt=false', 'region=us-east-2', 'aws_profile=myprofile') }}"

Tutorials

  1. make sure you have configured aws command line

refer: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html

  1. run the command
cd test
./cmd.sh

# with verbosse
./cmd.sh -vvvv

Reference:

https://docs.ansible.com/ansible/dev_guide/developing_plugins.html#lookup-plugins

https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/credstash.py

https://github.com/jhaals/ansible-vault/blob/master/vault.py

http://russell.ballestrini.net/setting-region-programmatically-in-boto3/

https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/hashi_vault.py

https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/__init__.py

http://boto3.readthedocs.io/en/latest/reference/core/session.html

http://boto3.readthedocs.io/en/latest/reference/core/boto3.html#boto3.setup_default_session

http://russell.ballestrini.net/filtering-aws-resources-with-boto3/

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.