Created
July 6, 2016 00:00
-
-
Save grrywlsn/f8e9800fb6fadc0ba963b70d20fcc15c to your computer and use it in GitHub Desktop.
local.yml to set up a new image on first Ansible-Pull
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
tasks: | |
- name: get ec2 facts | |
action: ec2_facts | |
- name: list tags on an instance | |
ec2_tag: | |
region: "{{ ansible_ec2_placement_region }}" | |
resource: "{{ ansible_ec2_instance_id }}" | |
state: list | |
register: ec2_tags | |
- name: tag a resource | |
ec2_tag: | |
region: "{{ ansible_ec2_placement_region }}" | |
resource: "{{ ansible_ec2_instance_id }}" | |
tags: | |
Name: "{{ ec2_tags['tags']['aws:autoscaling:groupName'] }}.{{ ansible_ec2_instance_id }}" | |
- hostname: name="{{ ec2_tags['tags']['aws:autoscaling:groupName'] }}.{{ ansible_ec2_instance_id }}" | |
become: yes | |
become_user: root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment