Ievgen Chernov
asked on
Deploying the host created by CloudFormation using Ansible
I've got stuck on one trivial thing. I've got an Ansible playbook:
---
- name: Build cluster
hosts: localhost
gather_facts: no
roles:
- buildcluster
- name: Run software setup
hosts: tag_Name_{{ cluster_name }}
gather_facts: no
roles:
- iso_pipeline_install
I'm setting the {{ cluster_name }} Tag on the Master node of cluster. My {{ cluster_name }} has dashes in it, but the inventory syntax accepts only underscores. And I don't know the IP address before I run the CloudFormation build. Is there any good practice to manipulate with the created server (I've got a cluster and I need to install software only on the Master Node)? Thank you in advance.
---
- name: Build cluster
hosts: localhost
gather_facts: no
roles:
- buildcluster
- name: Run software setup
hosts: tag_Name_{{ cluster_name }}
gather_facts: no
roles:
- iso_pipeline_install
I'm setting the {{ cluster_name }} Tag on the Master node of cluster. My {{ cluster_name }} has dashes in it, but the inventory syntax accepts only underscores. And I don't know the IP address before I run the CloudFormation build. Is there any good practice to manipulate with the created server (I've got a cluster and I need to install software only on the Master Node)? Thank you in advance.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
http://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#regular-expression-filters
I have never used it that way, but if it doesn't work doing it directly in that way maybe you can use the set_fact module in a task before the run software setup task, where it would use a filter to convert the cluster_name.