[ansible-project] Re: Install Docker on Windows Server 2016 using win_shell module

2018-01-19 Thread Larry Smith
Awesome. Glad you got it sorted out.

On Friday, January 19, 2018 at 3:02:54 AM UTC-5, Andreas Mosti wrote:
>
> I got it working from the powershell-module with the following tasks: 
>
>   - name: Enable Windows Container Feature
> win_feature:
>   name: Containers
>   state: present
> register: dockerwindowsfeature
>
>   - name: Reboot server if Windows Container Feature requires it
> win_reboot:
> when: dockerwindowsfeature.reboot_required
>
>   - name: Add DockerMsftProviderInsider powershell module repository
> win_psmodule:
>   name: DockerMsftProviderInsider
>   state: present
>
>   - name: Install Docker package
> win_shell: Install-Package –ProviderName "DockerMsftProviderInsider" 
> -Name "Docker" -Force
> args:
>   creates: "C:\\Program Files\\Docker\\metadata.json"
> register: dockerinstall
>
>   - name: Reboot server if Docker package requires it
> win_reboot:
> when: dockerinstall.changed
>
> Might help somebody out. 
>
> fredag 19. januar 2018 07.10.24 UTC+1 skrev Larry Smith følgende:
>>
>> Not sure if this will help you or not but you might be able to get some 
>> ideas from my Ansible role for Windows Docker installation.
>>
>> https://github.com/mrlesmithjr/ansible-windows-docker
>>
>>
>> On Monday, July 17, 2017 at 5:51:06 PM UTC-4, Pasquale Carlo Maiorano 
>> Picone wrote:
>>>
>>> *ISSUE TYPE*
>>>  - Bug Report
>>>
>>> *COMPONENT NAME*
>>> Win_shell
>>>
>>> *ANSIBLE VERSION*
>>>
>>> ansible 2.3.0.0
>>> config file = /home//ansible-docker/ansible.cfg (just disabled 
>>> host key checking)
>>> configured module search path = Default w/o overrides
>>>  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
>>> 20160609]
>>>
>>>
>>>
>>> # CONFIGURATION
>>>
>>> host_key_checking = False
>>>
>>>
>>> *OS / ENVIRONMENT*
>>> Control Machine: Ubuntu 16.04 machine
>>> Guest Machine: Windows Server 2016
>>>
>>> *SUMMARY*
>>> Could not install Docker for Windows using the same commands indicated 
>>> on docker interactive installation on docker website(
>>> https://docs.docker.com/engine/installation/windows/docker-ee/). 
>>>
>>> *STEPS TO REPRODUCE*
>>>
>>> Windows Server 2016, clean installation with Powershell Remoting and 
>>> WinRM service enabled with basic authentication and allow unencrypted for 
>>> WinRM service.
>>>
>>>
>>> - hosts: windows
>>>   tasks:
>>> - name: Enable Windows Container Feature
>>>   win_feature:
>>> name: Containers
>>> state: present
>>> - name: Install Nuget Package Provider
>>>   win_shell: Install-PackageProvider -Name "NuGet" -MinimumVersion 
>>> "2.8.5.201" -Force
>>> - name: Install Docker Msft Module
>>>   win_shell: Install-Module -Name "DockerMsftProvider" -Repository 
>>> "PSGallery" -Force
>>> - name: Install Docker package #error in this task
>>>   win_shell: Install-Package –ProviderName "DockerMsftProvider" -
>>> Name "Docker" -Force
>>> - name: Start docker service   #Start-Service docker
>>>   win_service:
>>> name: docker
>>> state: started
>>> start_mode: auto
>>>
>>>
>>>
>>>
>>> *EXPECTED RESULTS*
>>> Docker installed and running 
>>>
>>> *ACTUAL RESULTS*
>>> Package manager returns an error (see stacktrace below, refered to task 
>>> for installation of Docker package)
>>>
>>> TASK [Install Docker package] 
>>> 
>>> task path: /home/carlo/ansible-docker-trystack/windows_hosts.yml:11 
>>> 
>>>   
>>> Using module file /usr/lib/python2.7/dist-packages/ansible/modules/
>>> windows/win_shell.ps1   
>>>
>>> <192.168.87.129> ESTABLISH WINRM CONNECTION FOR USER: Administrator on 
>>> PORT 5985 TO 192.168.87.129 
>>>
>>> EXEC (via pipeline wrapper) 
>>> 
>>>   
>>> fatal: [192.168.87.129]: FAILED! => {   
>>> 
>>>   
>>> "changed": true,   
>>> 
>>>
>>> "cmd": "Install-Package –ProviderName \"DockerMsftProvider\" -Name 
>>> \"Docker\" -Force",  

[ansible-project] Re: Install Docker on Windows Server 2016 using win_shell module

2018-01-19 Thread Andreas Mosti
I got it working from the powershell-module with the following tasks: 

  - name: Enable Windows Container Feature
win_feature:
  name: Containers
  state: present
register: dockerwindowsfeature

  - name: Reboot server if Windows Container Feature requires it
win_reboot:
when: dockerwindowsfeature.reboot_required

  - name: Add DockerMsftProviderInsider powershell module repository
win_psmodule:
  name: DockerMsftProviderInsider
  state: present

  - name: Install Docker package
win_shell: Install-Package –ProviderName "DockerMsftProviderInsider" 
-Name "Docker" -Force
args:
  creates: "C:\\Program Files\\Docker\\metadata.json"
register: dockerinstall

  - name: Reboot server if Docker package requires it
win_reboot:
when: dockerinstall.changed

Might help somebody out. 

fredag 19. januar 2018 07.10.24 UTC+1 skrev Larry Smith følgende:
>
> Not sure if this will help you or not but you might be able to get some 
> ideas from my Ansible role for Windows Docker installation.
>
> https://github.com/mrlesmithjr/ansible-windows-docker
>
>
> On Monday, July 17, 2017 at 5:51:06 PM UTC-4, Pasquale Carlo Maiorano 
> Picone wrote:
>>
>> *ISSUE TYPE*
>>  - Bug Report
>>
>> *COMPONENT NAME*
>> Win_shell
>>
>> *ANSIBLE VERSION*
>>
>> ansible 2.3.0.0
>> config file = /home//ansible-docker/ansible.cfg (just disabled 
>> host key checking)
>> configured module search path = Default w/o overrides
>>  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
>> 20160609]
>>
>>
>>
>> # CONFIGURATION
>>
>> host_key_checking = False
>>
>>
>> *OS / ENVIRONMENT*
>> Control Machine: Ubuntu 16.04 machine
>> Guest Machine: Windows Server 2016
>>
>> *SUMMARY*
>> Could not install Docker for Windows using the same commands indicated on 
>> docker interactive installation on docker website(
>> https://docs.docker.com/engine/installation/windows/docker-ee/). 
>>
>> *STEPS TO REPRODUCE*
>>
>> Windows Server 2016, clean installation with Powershell Remoting and 
>> WinRM service enabled with basic authentication and allow unencrypted for 
>> WinRM service.
>>
>>
>> - hosts: windows
>>   tasks:
>> - name: Enable Windows Container Feature
>>   win_feature:
>> name: Containers
>> state: present
>> - name: Install Nuget Package Provider
>>   win_shell: Install-PackageProvider -Name "NuGet" -MinimumVersion 
>> "2.8.5.201" -Force
>> - name: Install Docker Msft Module
>>   win_shell: Install-Module -Name "DockerMsftProvider" -Repository 
>> "PSGallery" -Force
>> - name: Install Docker package #error in this task
>>   win_shell: Install-Package –ProviderName "DockerMsftProvider" -Name 
>> "Docker" -Force
>> - name: Start docker service   #Start-Service docker
>>   win_service:
>> name: docker
>> state: started
>> start_mode: auto
>>
>>
>>
>>
>> *EXPECTED RESULTS*
>> Docker installed and running 
>>
>> *ACTUAL RESULTS*
>> Package manager returns an error (see stacktrace below, refered to task 
>> for installation of Docker package)
>>
>> TASK [Install Docker package] 
>> 
>> task path: /home/carlo/ansible-docker-trystack/windows_hosts.yml:11 
>> 
>>   
>> Using module file /usr/lib/python2.7/dist-packages/ansible/modules/
>> windows/win_shell.ps1   
>>
>> <192.168.87.129> ESTABLISH WINRM CONNECTION FOR USER: Administrator on 
>> PORT 5985 TO 192.168.87.129 
>>
>> EXEC (via pipeline wrapper) 
>> 
>>   
>> fatal: [192.168.87.129]: FAILED! => {   
>> 
>>   
>> "changed": true, 
>> 
>>  
>> "cmd": "Install-Package –ProviderName \"DockerMsftProvider\" -Name 
>> \"Docker\" -Force", 
>>
>> "delta": "0:00:07.845040",   
>> 
>>

[ansible-project] Re: Install Docker on Windows Server 2016 using win_shell module

2018-01-18 Thread Larry Smith
Not sure if this will help you or not but you might be able to get some 
ideas from my Ansible role for Windows Docker installation.

https://github.com/mrlesmithjr/ansible-windows-docker


On Monday, July 17, 2017 at 5:51:06 PM UTC-4, Pasquale Carlo Maiorano 
Picone wrote:
>
> *ISSUE TYPE*
>  - Bug Report
>
> *COMPONENT NAME*
> Win_shell
>
> *ANSIBLE VERSION*
>
> ansible 2.3.0.0
> config file = /home//ansible-docker/ansible.cfg (just disabled 
> host key checking)
> configured module search path = Default w/o overrides
>  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
> 20160609]
>
>
>
> # CONFIGURATION
>
> host_key_checking = False
>
>
> *OS / ENVIRONMENT*
> Control Machine: Ubuntu 16.04 machine
> Guest Machine: Windows Server 2016
>
> *SUMMARY*
> Could not install Docker for Windows using the same commands indicated on 
> docker interactive installation on docker website(
> https://docs.docker.com/engine/installation/windows/docker-ee/). 
>
> *STEPS TO REPRODUCE*
>
> Windows Server 2016, clean installation with Powershell Remoting and WinRM 
> service enabled with basic authentication and allow unencrypted for WinRM 
> service.
>
>
> - hosts: windows
>   tasks:
> - name: Enable Windows Container Feature
>   win_feature:
> name: Containers
> state: present
> - name: Install Nuget Package Provider
>   win_shell: Install-PackageProvider -Name "NuGet" -MinimumVersion 
> "2.8.5.201" -Force
> - name: Install Docker Msft Module
>   win_shell: Install-Module -Name "DockerMsftProvider" -Repository 
> "PSGallery" -Force
> - name: Install Docker package #error in this task
>   win_shell: Install-Package –ProviderName "DockerMsftProvider" -Name 
> "Docker" -Force
> - name: Start docker service   #Start-Service docker
>   win_service:
> name: docker
> state: started
> start_mode: auto
>
>
>
>
> *EXPECTED RESULTS*
> Docker installed and running 
>
> *ACTUAL RESULTS*
> Package manager returns an error (see stacktrace below, refered to task 
> for installation of Docker package)
>
> TASK [Install Docker package] 
> 
> task path: /home/carlo/ansible-docker-trystack/windows_hosts.yml:11   
> 
> 
> Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows
> /win_shell.ps1   
>
> <192.168.87.129> ESTABLISH WINRM CONNECTION FOR USER: Administrator on 
> PORT 5985 TO 192.168.87.129   
>  
> EXEC (via pipeline wrapper)   
> 
> 
> fatal: [192.168.87.129]: FAILED! => { 
> 
> 
> "changed": true, 
> 
>  
> "cmd": "Install-Package –ProviderName \"DockerMsftProvider\" -Name 
> \"Docker\" -Force",   
>  
> "delta": "0:00:07.845040",   
> 
>  
> "end": "2017-07-17 02:53:56.827786", 
> 
>  
> "failed": true,   
> 
> 
> "rc": 1, 
> 
>  
> "start": "2017-07-17 02:53:48.982746",   
> 
>  
> "stderr": "Install-Package : No match was found for the specified 
> search criteria and package name 'Docker'. Try \r\nGet-PackageSource to 

[ansible-project] Re: Install Docker on Windows Server 2016 using win_shell module

2018-01-18 Thread Andreas Mosti
Can you paste the Ansible-tasks you got working? Seeing the same issues 
here.. 

mandag 31. juli 2017 14.14.21 UTC+2 skrev Yuriy Ostapenko følgende:
>
> Hi,
>
> I experienced the same issue.
> Install-Package works from both local powershell session or remote with 
> "Enter-PSSession", but not from Ansible.
>
> Apparently it has something to do with how Ansible does winrm and BITS.
> Try switching to DockerMsftProviderInsider. It worked for me.
>
> Similar issue with packer: 
> https://github.com/StefanScherer/packer-windows/pull/33
>
> On Monday, July 17, 2017 at 11:51:06 PM UTC+2, Pasquale Carlo Maiorano 
> Picone wrote:
>>
>> *ISSUE TYPE*
>>  - Bug Report
>>
>> *COMPONENT NAME*
>> Win_shell
>>
>> *ANSIBLE VERSION*
>>
>> ansible 2.3.0.0
>> config file = /home//ansible-docker/ansible.cfg (just disabled 
>> host key checking)
>> configured module search path = Default w/o overrides
>>  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
>> 20160609]
>>
>>
>>
>> # CONFIGURATION
>>
>> host_key_checking = False
>>
>>
>> *OS / ENVIRONMENT*
>> Control Machine: Ubuntu 16.04 machine
>> Guest Machine: Windows Server 2016
>>
>> *SUMMARY*
>> Could not install Docker for Windows using the same commands indicated on 
>> docker interactive installation on docker website(
>> https://docs.docker.com/engine/installation/windows/docker-ee/). 
>>
>> *STEPS TO REPRODUCE*
>>
>> Windows Server 2016, clean installation with Powershell Remoting and 
>> WinRM service enabled with basic authentication and allow unencrypted for 
>> WinRM service.
>>
>>
>> - hosts: windows
>>   tasks:
>> - name: Enable Windows Container Feature
>>   win_feature:
>> name: Containers
>> state: present
>> - name: Install Nuget Package Provider
>>   win_shell: Install-PackageProvider -Name "NuGet" -MinimumVersion 
>> "2.8.5.201" -Force
>> - name: Install Docker Msft Module
>>   win_shell: Install-Module -Name "DockerMsftProvider" -Repository 
>> "PSGallery" -Force
>> - name: Install Docker package #error in this task
>>   win_shell: Install-Package –ProviderName "DockerMsftProvider" -Name 
>> "Docker" -Force
>> - name: Start docker service   #Start-Service docker
>>   win_service:
>> name: docker
>> state: started
>> start_mode: auto
>>
>>
>>
>>
>> *EXPECTED RESULTS*
>> Docker installed and running 
>>
>> *ACTUAL RESULTS*
>> Package manager returns an error (see stacktrace below, refered to task 
>> for installation of Docker package)
>>
>> TASK [Install Docker package] 
>> 
>> task path: /home/carlo/ansible-docker-trystack/windows_hosts.yml:11 
>> 
>>   
>> Using module file /usr/lib/python2.7/dist-packages/ansible/modules/
>> windows/win_shell.ps1   
>>
>> <192.168.87.129> ESTABLISH WINRM CONNECTION FOR USER: Administrator on 
>> PORT 5985 TO 192.168.87.129 
>>
>> EXEC (via pipeline wrapper) 
>> 
>>   
>> fatal: [192.168.87.129]: FAILED! => {   
>> 
>>   
>> "changed": true, 
>> 
>>  
>> "cmd": "Install-Package –ProviderName \"DockerMsftProvider\" -Name 
>> \"Docker\" -Force", 
>>
>> "delta": "0:00:07.845040",   
>> 
>>  
>> "end": "2017-07-17 02:53:56.827786", 
>> 
>>  
>> "failed": true, 
>> 
>>   
>> "rc": 1, 
>>  

[ansible-project] Re: Install Docker on Windows Server 2016 using win_shell module

2017-08-01 Thread Jordan Borean
It's interesting that is worked over a PSSession but still failed with Ansible. 
PSSession is run over WinRM which is the same protocol Ansible uses so if it 
didn't fail there there must be something else going on.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3214eb6a-02e5-4beb-9222-97a47bba5036%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Install Docker on Windows Server 2016 using win_shell module

2017-07-31 Thread Yuriy Ostapenko
Hi,

I experienced the same issue.
Install-Package works from both local powershell session or remote with 
"Enter-PSSession", but not from Ansible.

Apparently it has something to do with how Ansible does winrm and BITS.
Try switching to DockerMsftProviderInsider. It worked for me.

Similar issue with 
packer: https://github.com/StefanScherer/packer-windows/pull/33

On Monday, July 17, 2017 at 11:51:06 PM UTC+2, Pasquale Carlo Maiorano 
Picone wrote:
>
> *ISSUE TYPE*
>  - Bug Report
>
> *COMPONENT NAME*
> Win_shell
>
> *ANSIBLE VERSION*
>
> ansible 2.3.0.0
> config file = /home//ansible-docker/ansible.cfg (just disabled 
> host key checking)
> configured module search path = Default w/o overrides
>  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
> 20160609]
>
>
>
> # CONFIGURATION
>
> host_key_checking = False
>
>
> *OS / ENVIRONMENT*
> Control Machine: Ubuntu 16.04 machine
> Guest Machine: Windows Server 2016
>
> *SUMMARY*
> Could not install Docker for Windows using the same commands indicated on 
> docker interactive installation on docker website(
> https://docs.docker.com/engine/installation/windows/docker-ee/). 
>
> *STEPS TO REPRODUCE*
>
> Windows Server 2016, clean installation with Powershell Remoting and WinRM 
> service enabled with basic authentication and allow unencrypted for WinRM 
> service.
>
>
> - hosts: windows
>   tasks:
> - name: Enable Windows Container Feature
>   win_feature:
> name: Containers
> state: present
> - name: Install Nuget Package Provider
>   win_shell: Install-PackageProvider -Name "NuGet" -MinimumVersion 
> "2.8.5.201" -Force
> - name: Install Docker Msft Module
>   win_shell: Install-Module -Name "DockerMsftProvider" -Repository 
> "PSGallery" -Force
> - name: Install Docker package #error in this task
>   win_shell: Install-Package –ProviderName "DockerMsftProvider" -Name 
> "Docker" -Force
> - name: Start docker service   #Start-Service docker
>   win_service:
> name: docker
> state: started
> start_mode: auto
>
>
>
>
> *EXPECTED RESULTS*
> Docker installed and running 
>
> *ACTUAL RESULTS*
> Package manager returns an error (see stacktrace below, refered to task 
> for installation of Docker package)
>
> TASK [Install Docker package] 
> 
> task path: /home/carlo/ansible-docker-trystack/windows_hosts.yml:11   
> 
> 
> Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows
> /win_shell.ps1   
>
> <192.168.87.129> ESTABLISH WINRM CONNECTION FOR USER: Administrator on 
> PORT 5985 TO 192.168.87.129   
>  
> EXEC (via pipeline wrapper)   
> 
> 
> fatal: [192.168.87.129]: FAILED! => { 
> 
> 
> "changed": true, 
> 
>  
> "cmd": "Install-Package –ProviderName \"DockerMsftProvider\" -Name 
> \"Docker\" -Force",   
>  
> "delta": "0:00:07.845040",   
> 
>  
> "end": "2017-07-17 02:53:56.827786", 
> 
>  
> "failed": true,   
> 
> 
> "rc": 1, 
> 
>  
> "start": "2017-07-17 02:53:48.982746",   
> 
>

[ansible-project] Re: Install Docker on Windows Server 2016 using win_shell module

2017-07-24 Thread 'J Hawkesworth' via Ansible Project
Hi,

I am curious if you got any further with this.

I looked at the link above but couldn't see any powershell command like you 
show to install docker.  It looks like there is a .msi installer now, which 
I would hope could be installed using the win_package module.

The .msi installer is described on this page

https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows 


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f234df21-3852-46b7-abc7-12ec0ce80981%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.