Skip to content

YouSysAdmin/ansible_aws_ssm_export

Repository files navigation

Collecting AWS SSM Parameters by prefix as Ansible Facts

Dependency:

  • amazon.aws ansible-galaxy collection install amazon.aws

Install

# requirements.yaml
collections:
  - name: amazon.aws
    version: 8.2.1

roles:
  - name: aws_ssm_export
    scm: git
    src: [email protected]:YouSysAdmin/ansible_aws_ssm_export.git
    version: v1.0.0
ansible-galaxy install -r requirements.yaml

Usage

# Export all params by prefix /ci/production

# AWS SSM params:
# /ci/production/instance_type
# /ci/production/instance_volume_size
# /ci/production/instance_user

# Result:
# ci_prod_aws_ssm:
#   instance_type: t3.medium
#   instance_volume_size: 50
#   instance_user: admin

# Usage vars
# vars:
#  instance_type: "{{ ci_aws_ssm.instance_type }}"

# Exporting values from the AWS SSM as global Ansible facts
- hosts: all
  gather_facts: False
  run_once: true
  vars:
    ssm_prefixes:
    - name: ci_prod
      prefix: '/ci/production'
  roles:
    - aws_ssm_export
  tags: [ "always" ]

- name: other tasks
  ...

About

Collecting AWS SSM Parameters by prefix as Ansible Facts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages