зеркало из https://github.com/mozilla/mig-deploy.git
103 строки
3.1 KiB
YAML
103 строки
3.1 KiB
YAML
- hosts: localhost
|
|
connection: local
|
|
gather_facts: False
|
|
|
|
vars_files:
|
|
- "../vars/vars-{{ env }}.yml"
|
|
|
|
tasks:
|
|
- name: Get CloudFormation facts for base stack
|
|
cloudformation_facts:
|
|
stack_name: "{{ base_stack_name }}"
|
|
region: "{{ region }}"
|
|
register: basestack
|
|
|
|
- debug: var=basestack
|
|
|
|
- name: Get CloudFormation facts for app stack
|
|
cloudformation_facts:
|
|
stack_name: "{{ app_stack_name }}"
|
|
region: "{{ region }}"
|
|
register: appstack
|
|
|
|
- debug: var=appstack
|
|
|
|
- name: Get API ELB facts
|
|
ec2_elb_facts:
|
|
names: "{{ appstack.ansible_facts.cloudformation[app_stack_name].stack_outputs.APIELBName }}"
|
|
region: "{{ region }}"
|
|
register: apielb
|
|
|
|
- debug: var=apielb
|
|
|
|
- name: Verify API ELB health
|
|
assert: { that: "apielb.elbs[0].instances_inservice_percent == 100.0" }
|
|
|
|
- name: Get Relay ELB facts
|
|
ec2_elb_facts:
|
|
names: "{{ appstack.ansible_facts.cloudformation[app_stack_name].stack_outputs.RelayELBName }}"
|
|
region: "{{ region }}"
|
|
register: relayelb
|
|
|
|
- debug: var=relayelb
|
|
|
|
- name: Verify relay ELB health
|
|
assert: { that: "relayelb.elbs[0].instances_inservice_percent == 100.0" }
|
|
|
|
- name: Get Self Service ELB facts
|
|
ec2_elb_facts:
|
|
names: "{{ appstack.ansible_facts.cloudformation[app_stack_name].stack_outputs.SelfServiceELBName }}"
|
|
region: "{{ region }}"
|
|
register: selfserviceelb
|
|
|
|
- debug: var=selfserviceelb
|
|
|
|
- name: Verify selfservice ELB health
|
|
assert: { that: "selfserviceelb.elbs[0].instances_inservice_percent == 100.0" }
|
|
|
|
- name: Configure API zone
|
|
route53:
|
|
command: "create"
|
|
zone: "{{ domain }}"
|
|
record: "{{ apidnszone }}"
|
|
type: "A"
|
|
value: "{{ appstack.ansible_facts.cloudformation[app_stack_name].stack_outputs.APIELBDNSName }}"
|
|
alias: true
|
|
alias_hosted_zone_id: "{{ apielb.elbs[0].hosted_zone_id }}"
|
|
ttl: 300
|
|
overwrite: true
|
|
|
|
- name: Configure self service zone
|
|
route53:
|
|
command: "create"
|
|
zone: "{{ domain }}"
|
|
record: "{{ selfservicednszone }}"
|
|
type: "A"
|
|
value: "{{ appstack.ansible_facts.cloudformation[app_stack_name].stack_outputs.SelfServiceELBDNSName }}"
|
|
alias: true
|
|
alias_hosted_zone_id: "{{ selfserviceelb.elbs[0].hosted_zone_id }}"
|
|
ttl: 300
|
|
overwrite: true
|
|
|
|
- name: Configure relay zone
|
|
route53:
|
|
command: "create"
|
|
zone: "{{ domain }}"
|
|
record: "{{ relaydnszone }}"
|
|
type: "A"
|
|
value: "{{ appstack.ansible_facts.cloudformation[app_stack_name].stack_outputs.RelayELBDNSName }}"
|
|
alias: true
|
|
alias_hosted_zone_id: "{{ relayelb.elbs[0].hosted_zone_id }}"
|
|
ttl: 300
|
|
overwrite: true
|
|
|
|
- name: Configure admin zone
|
|
route53:
|
|
command: "create"
|
|
zone: "{{ domain }}"
|
|
record: "{{ admindnszone }}"
|
|
type: "A"
|
|
value: "{{ basestack.ansible_facts.cloudformation[base_stack_name].stack_outputs.BastionIP }}"
|
|
ttl: 300
|
|
overwrite: true
|