-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup,ansible,win: refactor Windows and move to ansible
This removes all Windows machines from both `ansible/` and `setup/` inventories. The new scripts added here should only be used to create new machines for now, the inventory will be reviewed later. The `windows-servers.md` files in secrets have the current updated list of Windows machines. PR-URL: #1383 Reviewed-By: Jon Moss <me@jonathanmoss.me>
- Loading branch information
1 parent
55714b8
commit 054bb4e
Showing
32 changed files
with
356 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
|
||
# | ||
# set up a jenkins worker -- muy bueno! | ||
# | ||
|
||
- hosts: | ||
- "*-win*" | ||
|
||
roles: | ||
- bootstrap | ||
- package-upgrade | ||
- visual-studio | ||
- baselayout-windows | ||
- jenkins-worker-windows | ||
|
||
pre_tasks: | ||
- name: check if secret is properly set | ||
fail: | ||
failed_when: not secret | ||
- name: check if the Visual Studio version to install is properly set | ||
when: os|startswith("win") | ||
fail: | ||
failed_when: not vs | ||
|
||
post_tasks: | ||
- name: reboot Windows machines | ||
when: os|startswith("win") | ||
win_reboot: | ||
|
||
environment: '{{remote_env}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
|
||
# | ||
# Install Node build dependencies and other required software | ||
# | ||
|
||
- name: install NetWide Assembler | ||
win_chocolatey: name=nasm | ||
|
||
- name: install Python 2 | ||
win_chocolatey: name=python2 | ||
|
||
- block: | ||
- name: install Git | ||
win_chocolatey: | ||
name: git | ||
params: '/GitAndUnixToolsOnPath' | ||
- name: enable long paths in Git | ||
win_command: 'git config --global core.longpaths true' | ||
|
||
# Necessary for junit output in Jenkins jobs | ||
- name: install tap2junit | ||
win_command: 'pip2 install tap2junit' | ||
|
||
# Necessary for the libuv test job | ||
- block: | ||
- name: check if GYP is already cloned | ||
win_stat: path='C:\gyp' | ||
register: gyp_stat | ||
- name: clone GYP repository | ||
win_command: 'git clone https://chromium.googlesource.com/external/gyp C:\gyp' | ||
when: not gyp_stat.stat.exists | ||
- name: update GYP repository | ||
win_command: 'git pull' | ||
args: { chdir: 'C:\gyp' } | ||
when: gyp_stat.stat.exists | ||
|
||
# Necessary for releases of older versions of Node | ||
- block: | ||
- name: create node-icu directory | ||
win_file: path='C:\\node-icu' state=directory | ||
- name: download ICU2C 54 zip | ||
win_get_url: | ||
url: 'http://download.icu-project.org/files/icu4c/54.1/icu4c-54_1-src.zip' | ||
dest: 'C:\node-icu\icu4c-54_1-src.zip' | ||
force: no | ||
- name: download ICU2C 55 zip | ||
win_get_url: | ||
url: 'http://download.icu-project.org/files/icu4c/55.1/icu4c-55_1-src.zip' | ||
dest: 'C:\node-icu\icu4c-55_1-src.zip' | ||
force: no | ||
- name: download ICU2C 56 zip | ||
win_get_url: | ||
url: 'http://download.icu-project.org/files/icu4c/56.1/icu4c-56_1-src.zip' | ||
dest: 'C:\node-icu\icu4c-56_1-src.zip' | ||
force: no | ||
|
||
# Necessary for compressing the Node package | ||
- name: install 7Zip | ||
win_chocolatey: name=7zip | ||
|
||
# Utilities | ||
- block: | ||
- name: install Sysinternals Suite | ||
win_chocolatey: name=sysinternals | ||
- name: install Google Chrome | ||
win_chocolatey: name=googlechrome | ||
- name: install Notepad++ | ||
win_chocolatey: name=notepadplusplus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
|
||
# | ||
# Windows bootstrap | ||
# | ||
|
||
- name: create TEMP directory | ||
win_file: path='C:\TEMP' state=directory | ||
|
||
- block: | ||
- name: set automatic logon user name | ||
win_regedit: | ||
path: "{{ autologon_regpath }}" | ||
name: DefaultUsername | ||
data: "{{ ansible_ssh_user }}" | ||
type: string | ||
- name: set automatic logon password | ||
win_regedit: | ||
path: "{{ autologon_regpath }}" | ||
name: DefaultPassword | ||
data: "{{ ansible_ssh_pass }}" | ||
type: string | ||
- name: enable automatic logon | ||
win_regedit: | ||
path: "{{ autologon_regpath }}" | ||
name: AutoAdminLogon | ||
data: 1 | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
raspberry_pi: { | ||
apt_proxy: 'http://192.168.2.100:3142', | ||
} | ||
|
||
autologon_regpath: 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
|
||
# | ||
# Install the Jenkins worker | ||
# | ||
|
||
- name: install Java 8 | ||
win_chocolatey: name=jdk8 | ||
|
||
- name: download Jenkins icon | ||
win_get_url: | ||
url: 'http://mirrors.jenkins-ci.org/art/jenkins-logo/favicon.ico' | ||
dest: 'C:\jenkins.ico' | ||
force: no | ||
|
||
- name: create jenkins.bat | ||
win_template: | ||
src: '../templates/jenkins.bat' | ||
dest: 'C:\jenkins.bat' | ||
|
||
- name: create Jenkins shortcuts | ||
script: '../files/Jenkins-Shortcuts.ps1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
C: | ||
cd \ | ||
:start | ||
curl -L {{ jenkins_worker_jar }} -o {{ agent_path }} | ||
java -Dhudson.remoting.Launcher.pingIntervalSec=10 -jar {{ agent_path }} -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp -secret {{ secret }} | ||
echo Restarting Jenkins... | ||
goto start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
agent_path: 'C:\jenkins_agent.jar' |
32 changes: 32 additions & 0 deletions
32
ansible/roles/package-upgrade/tasks/partials/chocolatey.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
|
||
# | ||
# Updates Windows | ||
# | ||
|
||
- block: | ||
- name: reboot machine to ensure no updates are pending | ||
win_reboot: | ||
- name: wait for Jenkins to start if already installed | ||
win_shell: 'Start-Sleep -Seconds 10' | ||
- name: stop Jenkins after reboot | ||
win_shell: 'Get-WmiObject Win32_Process -Filter "(Name = ''cmd.exe'') AND (CommandLine LIKE ''%jenkins.bat%'')" | % {$_.Terminate()}' | ||
|
||
- name: download and install Windows updates | ||
win_updates: | ||
register: update_result | ||
|
||
- when: update_result.reboot_required | ||
block: | ||
- name: reboot machine if necessary | ||
win_reboot: | ||
reboot_timeout: 3600 | ||
- name: wait for Jenkins to start if already installed | ||
win_shell: 'Start-Sleep -Seconds 10' | ||
- name: stop Jenkins after reboot | ||
win_shell: 'Get-WmiObject Win32_Process -Filter "(Name = ''cmd.exe'') AND (CommandLine LIKE ''%jenkins.bat%'')" | % {$_.Terminate()}' | ||
|
||
- name: upgrade installed packages | ||
win_chocolatey: | ||
name: all | ||
state: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
'dnf': 'fedora', | ||
'pkg': 'freebsd', | ||
'pkgin': 'smartos', | ||
'chocolatey': 'win', | ||
'brew': 'macos' | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
|
||
# | ||
# Install Visual Studio | ||
# | ||
|
||
- when: vs == 2013 | ||
block: | ||
# TODO: Ensure no other versions are installed | ||
- name: install Visual Studio 2013 | ||
include_tasks: "partials/vs2013.yml" | ||
|
||
- when: vs == 2015 | ||
block: | ||
# TODO: Ensure no other versions are installed | ||
- name: install Visual Studio 2015 | ||
include_tasks: "partials/vs2015.yml" | ||
|
||
- when: vs == 'vcbt2015' | ||
block: | ||
# TODO: Ensure no other versions are installed | ||
- name: install Visual C++ Build Tools 2015 | ||
include_tasks: "partials/vcbt2015.yml" | ||
|
||
- when: vs == 2017 | ||
block: | ||
# TODO: Ensure no other versions are installed | ||
- name: install Visual Studio 2017 | ||
include_tasks: "partials/vs2017.yml" |
Oops, something went wrong.