Trying to make a dual boot script and came across these results, the shell 
is changed during the playbook but subsequent tasks are somehow using the 
old one. 

How can I force a new connection please?

1) Change shell to cmd -Success
win_ping using powershell - success
win_ping using cmd - failure

The reverse is true when changing it back.
I've confimed the shells are changing by normal ssh from CLI

--Part of Playbook--
---
- hosts: happy
  gather_facts: no
  ignore_unreachable: true
  ignore_errors: true
  tasks:
    - include_tasks: win_shell_cmd.yml
      vars:
        become: yes
        ansible_connection: ssh
        ansible_shell_type: powershell
        become_method: runas
    - name: win_ping using ansible_shell_type powershell
      win_ping:
      vars:
        become: yes
        ansible_connection: ssh
        ansible_shell_type: powershell
        become_method: runas
    - name: win_ping using ansible_shell_type cmd
      win_ping:
      vars:
        become: yes
        ansible_connection: ssh
        ansible_shell_type: cmd
        become_method: runas

--- win_shell_cmd.yml ---
- name: set the default shell to cmd
  win_regedit:
    path: HKLM:\SOFTWARE\OpenSSH
    name: DefaultShell
    state: absent

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dfe4c751-d3d5-460e-bcfb-bbb50b0465adn%40googlegroups.com.

Reply via email to