Skip to content

Commit

Permalink
Ansible devel 2.5.0 is required for win_copy to work
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrieu, Alban committed Oct 9, 2017
1 parent 544f1e2 commit f38cc98
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 27 deletions.
43 changes: 40 additions & 3 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
; needed to bypass self-signed certificates on windows
[galaxy]
ignore_certs=True

[defaults]
#ansible_python_interpreter="/usr/local/bin/python,/usr/bin/python"
#roles_path=../roles
#host_key_checking=False
#gathering=explicit
validate_certs=False
#vault_password_file=vault.passwd
bin_ansible_callbacks=True
callback_plugins = ./callback_plugins
library = ./library
#callback_whitelist = profile_tasks
#callback_plugins=./callback_plugins
#callback_plugins = ~/ansible/callback_plugins
#library=./library
#library="/usr/local/lib/python2.7/dist-packages/ansible"
#For MacOSX increase timeout
timeout=30
#inventory = ./hosts-albandri
#roles_path = ./roles
allow_world_readable_tmpfiles=True

#Workaround for ansible solaris bug https://github.com/ansible/ansible/issues/21339
#remote_tmp=$HOME/.ansible/tmp
#local_tmp=$HOME/.ansible/tmp
#transport=smart
display_skipped_hosts=False
#host_key_checking=False

#[privilege_escalation]
#become=True
#For MacOSX switch sudo to su become_method
#become_method=su
#For Jenkins switch sudo to su become_method
become_method=sudo

[ssh_connection]
#pipelining=True
pipelining=False
#ssh_args=-o ControlMaster=no
#ssh_args=-o ControlMaster=auto -o ControlPersist=1800s -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
#control_path=%(directory)s/%%h-%%r
Binary file added files/vs2008.ini
Binary file not shown.
46 changes: 46 additions & 0 deletions files/vs2012.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<AdminDeploymentCustomizations xmlns="http://schemas.microsoft.com/wix/2011/AdminDeployment">
<BundleCustomizations TargetDir="default" NoWeb="default"/>

<SelectableItemCustomizations>
<SelectableItemCustomization Id="WebTools" Hidden="no" Selected="no"/>
<SelectableItemCustomization Id="OfficeTools" Hidden="no" Selected="no"/>
<SelectableItemCustomization Id="SharepointTools" Hidden="no" Selected="no"/>
<SelectableItemCustomization Id="LightSwitch" Hidden="no" Selected="no"/>
<SelectableItemCustomization Id="SilverLight_Developer_Kit" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="SQL" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="VC_MFC_Libraries" Hidden="no" Selected="no" />
<SelectableItemCustomization Id="Blend" Hidden="no" Selected="no" />

<SelectableItemCustomization Id="BlissHidden" Selected="yes" />
<SelectableItemCustomization Id="HelpHidden" Selected="yes" />
<SelectableItemCustomization Id="LocalDBHidden" Selected="yes" />
<SelectableItemCustomization Id="NetFX4Hidden" Selected="yes" />
<SelectableItemCustomization Id="NetFX45Hidden" Selected="yes" />
<SelectableItemCustomization Id="PortableDTPHidden" Selected="yes" />
<SelectableItemCustomization Id="PreEmptiveDotfuscatorHidden" Selected="yes" />
<SelectableItemCustomization Id="PreEmptiveAnalyticsHidden" Selected="yes" />
<SelectableItemCustomization Id="ProfilerHidden" Selected="yes" />
<SelectableItemCustomization Id="ReportingHidden" Selected="yes" />
<SelectableItemCustomization Id="RIAHidden" Selected="yes" />
<SelectableItemCustomization Id="SDKTools3Hidden" Selected="yes" />
<SelectableItemCustomization Id="SDKTools4Hidden" Selected="yes" />
<SelectableItemCustomization Id="Silverlight5DRTHidden" Selected="yes" />
<SelectableItemCustomization Id="SQLCEHidden" Selected="yes" />
<SelectableItemCustomization Id="SQLCEToolsHidden" Selected="yes" />
<SelectableItemCustomization Id="SQLCLRTypesHidden" Selected="yes" />
<SelectableItemCustomization Id="SQLDACHidden" Selected="yes" />
<SelectableItemCustomization Id="SQLDbProviderHidden" Selected="yes" />
<SelectableItemCustomization Id="SQLDOMHidden" Selected="yes" />
<SelectableItemCustomization Id="SQLSharedManagementObjectsHidden" Selected="yes" />
<SelectableItemCustomization Id="TSQLHidden" Selected="yes" />
<SelectableItemCustomization Id="VCCompilerHidden" Selected="yes" />
<SelectableItemCustomization Id="VCCoreHidden" Selected="yes" />
<SelectableItemCustomization Id="VCDebugHidden" Selected="yes" />
<SelectableItemCustomization Id="VCDesigntimeHidden" Selected="yes" />
<SelectableItemCustomization Id="VCExtendedHidden" Selected="yes" />
<SelectableItemCustomization Id="WCFDataServicesHidden" Selected="yes" />
<SelectableItemCustomization Id="WinJSHidden" Selected="yes" />
<SelectableItemCustomization Id="WinSDKHidden" Selected="yes" />
</SelectableItemCustomizations>
</AdminDeploymentCustomizations>
24 changes: 23 additions & 1 deletion meta/ansigenome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ galaxy_info:
description: A role for installing windows
company: Nabla
license: Apache
min_ansible_version: '2.3.1.0'
min_ansible_version: '2.5.0'
platforms:
- name: Windows
versions:
Expand Down Expand Up @@ -59,7 +59,29 @@ ansigenome_info:
ansible --version
#ansible 1.7.2
Ansible 2.5.0 is required on order to have win_copy working on Windows 7 and Windows Server 2016
Check winrm in target host
```
winrm id
winrm get winrm/config
```
For oler version od Windows, please do
```
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 5000
Set-Item WSMan:\localhost\Plugin\Microsoft.PowerShell\Quotas\MaxMemoryPerShellMB 5000
```
Restart-Service winrm
```
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}'
```
On the windows VM :
Try :
Expand Down
29 changes: 29 additions & 0 deletions tasks/visualstudio-2008.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- name: "visual studio 2008 : download iso"
win_get_url:
url: "{{ visualstudio.url_prefix }}/{{ visualstudio.2008.iso }}"
dest: "{{ ansible_user_dir }}\\{{ visualstudio.2008.iso }}"
force: no

- name: "visual studio 2008 : extract files from iso"
win_command: 7z x -aos -o"{{ visualstudio.2008.installer.path }}" "{{ ansible_user_dir }}\\{{ visualstudio.2008.iso }}"

- name: "visual studio 2008 : copy unattended installation script"
win_copy:
src: "{{ visualstudio.2008.installer.ini }}"
dest: "{{ ansible_user_dir }}\\{{ visualstudio.2008.installer.ini }}"

- name: "visual studio 2008 : unattended installation"
win_command: "{{ visualstudio.2008.installer.path }}\\setup\\setup.exe /q /norestart"
# win_command: "{{ visualstudio.2008.installer.path }}\\setup\\setup.exe /unattendfile {{ ansible_user_dir }}\\{{ visualstudio.2008.installer.ini }}"

- name: "visual studio 2008 : clean installation files"
win_file:
path: "{{ item }}"
state: absent
with_items:
- "{{ ansible_user_dir }}\\{{ visualstudio.2008.iso }}"
- "{{ ansible_user_dir }}\\{{ visualstudio.2008.installer.ini }}"
- "{{ visualstudio.2008.installer.path }}"
tags:
- cleanup
28 changes: 28 additions & 0 deletions tasks/visualstudio-2012.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
- name: "visual studio 2012 : download iso"
win_get_url:
url: "{{ visualstudio.url_prefix }}/{{ visualstudio.2012.iso }}"
dest: "{{ ansible_user_dir }}\\{{ visualstudio.2012.iso }}"
force: no

- name: "visual studio 2012 : extract files from iso"
win_command: 7z x -aos -o"{{ visualstudio.2012.installer.path }}" "{{ ansible_user_dir }}\\{{ visualstudio.2012.iso }}"

- name: "visual studio 2012 : copy unattended installation script"
win_copy:
src: "{{ visualstudio.2012.installer.ini }}"
dest: "{{ ansible_user_dir }}\\{{ visualstudio.2012.installer.ini }}"

- name: "visual studio 2012 : unattended installation"
win_command: "{{ visualstudio.2012.installer.path }}\\vs_professional.exe /AdminFile {{ ansible_user_dir }}\\{{ visualstudio.2012.installer.ini }} /passive /norestart"

- name: "visual studio 2012 : clean installation files"
win_file:
path: "{{ item }}"
state: absent
with_items:
- "{{ ansible_user_dir }}\\{{ visualstudio.2012.iso }}"
- "{{ ansible_user_dir }}\\{{ visualstudio.2012.installer.ini }}"
- "{{ ansible_user_dir }}\\{{ visualstudio.2012.installer.path }}"
tags:
- cleanup
35 changes: 23 additions & 12 deletions tasks/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,35 @@
- debug: var=ps_out.stdout_lines

- name: echo 'temp' in 'temp_out'
win_shell: echo $temp
win_shell: echo $TEMP
register: temp_out

- debug: var=temp_out.stdout_lines

#- name: Copy helloworld.ps1 to TMP
# win_copy:
# src: files/helloworld.ps1
# dest: C:\Windows\Temp
# register: out
#
#- debug: var=out.stdout_lines
#
- name: Create temp directory
win_file:
path: C:\Windows\Temp
state: directory

- name: Copy helloworld.ps1 to TMP
win_copy:
src: files/helloworld.ps1
dest: C:\Windows\Temp\helloworld.ps1
force: True
remote_src: False
register: out

- debug: var=out.stdout_lines

#- name: Run powershell script
# script: C:\Windows\Temp\helloworld.ps1
# register: out
#
#- debug: var=out.stdout_lines

- name: Run powershell script
script: files/helloworld.ps1
register: out

- debug: var=out.stdout_lines

- name: "Try command choco"
win_command: choco -v
Expand All @@ -69,7 +80,7 @@
#- name: "install chocolatey"
# include: chocolatey.yml
# when: result|failed

#- name: update installed chocolatey packages
# win_chocolatey:
# name: all
Expand Down
12 changes: 1 addition & 11 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
---
url_prefix: http://kgrdb01/download
url_prefix: http://home.nabla.mobi/download

visualstudio:
url_prefix: "{{ url_prefix }}/winnt-compilation-tools"
2005:
iso: "1_en_vs_2005_pro_dvd.iso"
patches:
- "2_VS80sp1-KB926601-X86-ENU.exe"
- "3_VS80sp1-KB932232-X86-ENU.exe"
- "4_vcredist_x86.EXE"
- "5_vcredist_x86.exe"
installer:
path: "{{ ansible_user_dir }}\\1_visualstudio2005"
ini: "vs2005.ini"
2008:
iso: "en_visual_studio_2008_professional_x86_dvd_x14-26326.iso"
installer:
Expand Down

0 comments on commit f38cc98

Please sign in to comment.