| | |
| | | - post_infrastructure |
| | | tasks: |
| | | |
| | | - name: Job Template to launch a Job Template with update on launch inventory set |
| | | uri: |
| | | url: "https://{{ ansible_tower_ip }}/api/v1/job_templates/{{ job_template_id }}/launch/" |
| | | method: POST |
| | | user: "{{tower_admin}}" |
| | | password: "{{tower_admin_password}}" |
| | | body: |
| | | extra_vars: |
| | | guid: "{{guid}}" |
| | | ipa_host_password: "{{ipa_host_password}}" |
| | | - name: Job Template to launch a Job Template with update on launch inventory set |
| | | uri: |
| | | url: "https://{{ ansible_tower_ip }}/api/v1/job_templates/{{ job_template_id }}/launch/" |
| | | method: POST |
| | | user: "{{ tower_admin }}" |
| | | password: "{{ tower_admin_password }}" |
| | | body: |
| | | extra_vars: |
| | | guid: "{{ guid }}" |
| | | ipa_host_password: "{{ ipa_host_password }}" |
| | | |
| | | body_format: json |
| | | validate_certs: False |
| | | HEADER_Content-Type: "application/json" |
| | | status_code: 200, 201 |
| | | body_format: json |
| | | validate_certs: False |
| | | HEADER_Content-Type: "application/json" |
| | | status_code: 200, 201 |
| | | when: tower_run == 'true' |
| | | |
| | | - name: create our own inventory |
| | | hosts: localhost |
| | | connection: local |
| | | gather_facts: false |
| | | become: false |
| | | vars_files: |
| | | - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
| | | - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" |
| | | tags: |
| | | - step001 |
| | | - pre_infrastructure |
| | | - generate_env_keys |
| | | |
| | | connection: local |
| | | gather_facts: false |
| | | become: false |
| | | vars_files: |
| | | - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
| | | - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" |
| | | tags: |
| | | - step001 |
| | | - pre_infrastructure |
| | | - generate_env_keys |
| | | |
| | | tasks: |
| | | - name: get rid of ll hostvars |
| | | - name: get rid of linklight hostvars |
| | | set_fact: |
| | | hostvars: "" |
| | | |
| | | - name: Gather EC2 facts |
| | | ec2_remote_facts: |
| | | aws_access_key: "{{ aws_access_key_id }}" |
| | |
| | | region: "{{ aws_region | default(region) | default('us-east-1')}}" |
| | | filters: |
| | | instance-state-name: running |
| | | "tag:Workshop": "{{guid}}" |
| | | "tag:Workshop": "{{ guid }}" |
| | | register: ec2_facts |
| | | - name: print our new instances |
| | | debug: |
| | |
| | | |
| | | - name: print our new instances |
| | | debug: |
| | | msg: "found BASTION {{item.id}}" |
| | | msg: "found BASTION {{ item.id }}" |
| | | when: item.tags.short_name == 'ansible' |
| | | with_items: "{{ec2_facts['instances']}}" |
| | | with_items: "{{ ec2_facts['instances'] }}" |
| | | - name: Ensure tags are present on a resource |
| | | ec2_tag: |
| | | region: "{{ aws_region | default(region) | default('us-east-1')}}" |
| | | resource: "{{item.id}}" |
| | | state: present |
| | | tags: |
| | | Project: "{{env_type}}-{{guid}}" |
| | | Project: "{{ env_type }}-{{ guid }}" |
| | | AnsibleGroup: "all" |
| | | with_items: "{{ec2_facts['instances']}}" |
| | | with_items: "{{ ec2_facts['instances'] }}" |
| | | - name: tag bastion hosts with the bastion group tag |
| | | ec2_tag: |
| | | region: "{{ aws_region | default(region) | default('us-east-1')}}" |
| | | resource: "{{item.id}}" |
| | | resource: "{{ item.id }}" |
| | | state: present |
| | | tags: |
| | | Project: "{{env_type}}-{{guid}}" |
| | | Project: "{{ env_type }}-{{ guid }}" |
| | | AnsibleGroup: "bastions" |
| | | when: item.tags.short_name == 'ansible' |
| | | with_items: "{{ec2_facts['instances']}}" |
| | |
| | | name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" |
| | | - name: Run Common SSH Config Generator Role |
| | | include_role: |
| | | name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" |
| | | name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-common-ssh-config-generate" |
| | | |
| | | - name: ssh workaround thing |
| | | hosts: all |