Tok
2018-07-26 bca8c914beb1c038ae3e8c33a6b0668cce3e6bdf
Updates to linklight/README
Reformat of linklight/post_infra.yml
2 files modified
78 ■■■■ changed files
ansible/configs/linklight/README.adoc 8 ●●●●● patch | view | raw | blame | history
ansible/configs/linklight/post_infra.yml 70 ●●●● patch | view | raw | blame | history
ansible/configs/linklight/README.adoc
@@ -49,7 +49,7 @@
You can run the playbook with the following arguments to overwrite the default variable values:
[source,bash]
----
GUID=tok2
GUID=tok1
ENV_TYPE=linklight
CLOUD_PROVIDER=ec2
@@ -104,13 +104,15 @@
GUID=tok1
ENV_TYPE=linklight
EC2_REGION=us-east-1
EC2_NAME_PREFIX=${GUID}
EC2_REGION=us-east-1
EC2_AVAILABILITY_ZONE=us-east-1a
ANSIBLE_REPO_PATH=$(pwd)
ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \
  -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \
  -e ec2_region=${EC2_REGION} \
  -e ec2_name_prefix=${GUID} \
  -e ec2_region=${EC2_REGION} \
  -e ec2_az=${EC2_AVAILABILITY_ZONE}
----
ansible/configs/linklight/post_infra.yml
@@ -11,40 +11,40 @@
    - 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 }}"
@@ -52,7 +52,7 @@
      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:
@@ -62,25 +62,25 @@
 
  - 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']}}"
@@ -89,7 +89,7 @@
      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