From 00d0782b6cf1c7aaf35ea35c2fe709b5801231ac Mon Sep 17 00:00:00 2001 From: Scott Koranda Date: Sat, 9 Nov 2019 08:55:11 -0600 Subject: [PATCH] Better management of inventory to pick up tags Added a meta task to rebuild inventory. This causes the ec2.py script to be run again and pick up the tags for the recently provisioned ec2 instances, so that the tags can be used as variables later in plays/tasks. --- ec2.ini | 1 + training_nodes.yml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ec2.ini b/ec2.ini index 488ffd0..f2793ce 100644 --- a/ec2.ini +++ b/ec2.ini @@ -118,6 +118,7 @@ cache_path = ~/.ansible/tmp # seconds, a new API call will be made, and the cache file will be updated. # To disable the cache, set this value to 0 #cache_max_age = 300 +cache_max_age = 0 # Organize groups into a nested/hierarchy instead of a flat namespace. nested_groups = False diff --git a/training_nodes.yml b/training_nodes.yml index 467d80a..678bf7b 100644 --- a/training_nodes.yml +++ b/training_nodes.yml @@ -236,8 +236,11 @@ overwrite: yes wait: no loop: "{{ training_nodes.results }}" + + - name: Refresh inventory to pick up ec2 tags + meta: refresh_inventory -- hosts: ssh_training_node_hosts +- hosts: tag_role_comanage_registry become: yes gather_facts: True strategy: free