Guillaume Coré
2017-11-28 f6f415053c996a1bb6521f0edaef990f0652a905
ec2_inf_dep: add tags to jq_minify and CF validation
1 files modified
13 ■■■■■ changed files
ansible/cloud_providers/ec2_infrastructure_deployment.yml 13 ●●●●● patch | view | raw | blame | history
ansible/cloud_providers/ec2_infrastructure_deployment.yml
@@ -24,10 +24,18 @@
    shell: "jq -c . < {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template-orig >  {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template"
    register: jq_minify
    ignore_errors: true
    tags:
      - aws_infrastructure_deployment
      - gen_cf_template
      - minify_cf_template
  - name: use original if jq failed
    command: "cp {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template-orig {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template"
    when: jq_minify|failed
    tags:
      - aws_infrastructure_deployment
      - gen_cf_template
      - minify_cf_template
  ######################### Validate CF Template
@@ -37,6 +45,9 @@
      AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}"
      AWS_DEFAULT_REGION: "{{aws_region}}"
    shell: "aws cloudformation validate-template --region {{ aws_region | default(region) | default('us-east-1')}} --template-body file://{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template"
    tags:
      - aws_infrastructure_deployment
      - validate_cf_template
  ######################### Launch CF Template
@@ -85,12 +96,14 @@
    tags:
      - create_inventory
      - must
  - name: windows ostype workaround
    set_fact:
      project_tag_ostype: "{{project_tag}}_ostype"
    tags:
      - create_inventory
      - must
  - add_host:
      name: "{{item['public_dns_name']}}"
      shortname: "{{item['tags']['Name'] | default(item['private_dns_name'])}}"