Created
September 11, 2018 19:19
-
-
Save IPvSean/487d14f495c8ddcfa8ce197abe72bf35 to your computer and use it in GitHub Desktop.
simple provisioning into AWS for BIG-IP F5
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
#GO FIND CORRECT AMI (filter by name & architecture) | |
- name: find ami for f5 (F5 MODE) | |
ec2_ami_facts: | |
region: us-east-1 | |
owners: 679593333241 | |
filters: | |
name: 'F5 Networks Prelicensed Hourly BIGIP-13.1*Good 25MBPS*' | |
architecture: x86_64 | |
register: amis | |
#PREVIOUS TASK WILL SOMETIMES GIVE A LIST OF AMIS, WE SORT BY DATE AND GRAB NEWEST | |
- name: save ami for f5 (F5 MODE) | |
set_fact: | |
f5_ami: > | |
{{ amis.images | selectattr('name', 'defined') | sort(attribute='creation_date') | last }} | |
#THIS WILL SPIN UP 5x F5 BIG-IP INSTANCES IN ONE TASK | |
- name: Create EC2 instances for f5 node (F5 MODE) | |
ec2: | |
assign_public_ip: yes | |
key_name: "YOUR_AWS_KEY" | |
group: "YOUR_AWS_SECURITY_GROUP" | |
instance_type: t2.large | |
image: "{{ f5_ami.image_id }}" | |
region: us-east-1 | |
exact_count: 5 | |
count_tag: | |
Workshop_f5: "f5test" | |
wait: "{{ ec2_wait }}" | |
vpc_subnet_id: "{{ ec2_vpc_subnet_id }}" | |
register: f5_output | |
#ADD SOME MORE UNIQUE TAGS BY LOOPING | |
- name: Ensure tags are present for f5 node (F5 MODE) | |
ec2_tag: | |
region: us-east-1 | |
resource: "{{item.1}}" | |
state: present | |
tags: | |
Name: "BIGIP{{item.0 + 1}}-f5" | |
Workshop_f5: "f5test" | |
Index: "{{ item[0] }}" | |
with_indexed_items: | |
- "{{ f5_output.instance_ids }}" | |
when: f5_output.instance_ids is not none |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment