- name: Step 00xxxxx post software hosts: localhost connection: local gather_facts: False become: no tasks: - debug: msg: "Post-Software tasks Started" - name: Copy files to workstation hosts: workstations tasks: - name: Copy Ansible Inventory for this environment win_copy: src: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" dest: "C:\\inventory.ini" - name: PostSoftware flight-check hosts: towers gather_facts: false become: yes tags: - post_flight_check tasks: - name: See if virtualenv is installed stat: path: venv register: virtualenv - name: Setup python virtualenv shell: | virtualenv venv source venv/bin/activate pip install ansible requests-credssp pywinrm deactivate exit 0 when: not virtualenv.stat.exists - name: Test Ansible connectivity to Windows servers shell: | source venv/bin/activate ansible windows -m win_ping register: ansible_check ignore_errors: true - debug: var: ansible_check - fail: msg: "Ansible test of tower environment failed" when: ansible_check is failed - debug: msg: "Post-Software checks completed successfully" - name: Provisioning final tasks hosts: localhost connection: local gather_facts: false become: no tasks: - name: Report provisioning status include_role: name: status-report vars: classroom_status: "Classroom ready" status_json: "{{ lookup('template', 'report.j2') }}" when: report_status - name: Stop SSH/Socks proxy for Windows proxying through bastion shell: | ssh -i {{ ssh_key | default(infra_ssh_key) | default(ansible_ssh_private_key_file) | default(default_key_name)}} -o "ControlPath=~/.ssh/cp/ssh-%r@%h:%p" -O exit -p 22 {{hostvars[bastion_hostname].ansible_user}}@{{hostvars[bastion_hostname].public_ip_address}} when: win_connect_method | d('winrm') == 'psrp'