diff --git a/ansible.cfg b/ansible.cfg index 331e5a8..a10d852 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -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 diff --git a/files/vs2008.ini b/files/vs2008.ini new file mode 100644 index 0000000..984cd46 Binary files /dev/null and b/files/vs2008.ini differ diff --git a/files/vs2012.xml b/files/vs2012.xml new file mode 100644 index 0000000..118c630 --- /dev/null +++ b/files/vs2012.xml @@ -0,0 +1,46 @@ + + + + + + + diff --git a/meta/ansigenome.yml b/meta/ansigenome.yml index f3d3769..517a11a 100644 --- a/meta/ansigenome.yml +++ b/meta/ansigenome.yml @@ -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: @@ -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 : diff --git a/tasks/visualstudio-2008.yml b/tasks/visualstudio-2008.yml new file mode 100644 index 0000000..7ca1307 --- /dev/null +++ b/tasks/visualstudio-2008.yml @@ -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 diff --git a/tasks/visualstudio-2012.yml b/tasks/visualstudio-2012.yml new file mode 100644 index 0000000..019febf --- /dev/null +++ b/tasks/visualstudio-2012.yml @@ -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 diff --git a/tasks/windows.yml b/tasks/windows.yml index 52db2a8..c6e79ff 100644 --- a/tasks/windows.yml +++ b/tasks/windows.yml @@ -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 @@ -69,7 +80,7 @@ #- name: "install chocolatey" # include: chocolatey.yml # when: result|failed - + #- name: update installed chocolatey packages # win_chocolatey: # name: all diff --git a/vars/main.yml b/vars/main.yml index ba45fea..2262f1e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -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: