Last active
November 10, 2016 16:53
-
-
Save ralfbergs/0cc62920f5df007597ade8aac2bf60a8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
env_devmgmt_name: "devmgmt" | |
env_mgmt_name: "mgmt" | |
env_preprod_name: "preprod" | |
env_prod_name: "prod" |
This file contains hidden or 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
--- | |
dependencies: | |
- { role: aws.find-subnets, subnet_code_name: "pub_1" } | |
- { role: aws.find-subnets, subnet_code_name: "pub_2", when: env == env_mgmt_name } | |
- { role: aws.find-subnets, subnet_code_name: "be_1" } | |
- { role: aws.find-subnets, subnet_code_name: "be_2", when: env == env_mgmt_name } | |
- { role: aws.find-subnets, subnet_code_name: "be_deploy", when: env == env_mgmt_name } | |
- { role: aws.find-vpc } | |
- { role: aws.find-vpc, myenv: "preprod" } | |
- { role: aws.find-vpc, myenv: "prod" } | |
- { role: aws.find-vpc, myenv: "devenvs", when: env == env_devmgmt_name } | |
- { role: aws.find-sg, sg_name: "pub_jump"} |
This file contains hidden or 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 | |
vars: | |
env: "{{ env_devmgmt_name }}" | |
roles: | |
- aws/create |
This file contains hidden or 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
- name: "Launch instance for jumpbox: {{ owner }}_i_{{ env }}_jump_1" | |
ec2: | |
region: "{{ region }}" | |
image: "{{ ami_id }}" | |
count_tag: | |
Name: "{{ owner }}_i_{{ env }}_jump_1" | |
exact_count: 1 | |
wait: yes | |
instance_type: "t2.micro" | |
key_name: "{{ ssh_key_name}}" | |
group_id: | |
- "{{ {{ env }}_sg_pub_jump.group_id }}" | |
- "{{ sg_ssh.group_id }}" | |
vpc_subnet_id: "{{ subnet_pub_1.id }}" | |
zone: "{{ az1 }}" | |
instance_tags: | |
Name: "{{ owner }}_i_{{ env }}_pub_jump_1" | |
Env: "{{ owner }}_{{ env }}" | |
Tier: "{{ owner }}_{{ env }}_pub" | |
register: i_jump_1 |
obviously.
not asking what {{env}} is, asking what the format is of the dicts, and where they're set
otherwise it's unclear what's being interpolated, and what's just a string.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"env" is defined at the start of my Playbook.yml. The actual value is from group_vars/all, but it could be even written verbatim in the Playbook.yml,it doesn't matter.