Skip to content

Commit 054bb4e

Browse files
committed
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 <[email protected]>
1 parent 55714b8 commit 054bb4e

32 files changed

Lines changed: 356 additions & 352 deletions

File tree

ansible/README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
## Getting started
77

8-
1. Install Ansible 2.2.0 or newer: `pip install ansible`. If you use brew, then
9-
`brew install python2 ansible`, and then run
8+
1. Follow the [instructions to install the latest version of Ansible][ansible-install].
9+
* In most cases, using pip: `pip install ansible`.
10+
* If you use brew, then `brew install python2 ansible`, and then run
1011
`export PYTHONPATH=$(pip2 show pyyaml | grep Location | awk '{print $2}') `
1112
before you use `ansible-playbook`.
1213
2. Read this document.
@@ -16,16 +17,31 @@
1617
## Getting things done
1718

1819
Most of your work will probably include editing `inventory.yml`, followed by
19-
running one (or multiple) of below playbooks. If you're adding a new host,
20-
limiting ansible to just running on that host is probably quicker:
20+
running one (or multiple) of below playbooks.
21+
22+
See the [manual setup instructions](../doc/non-ansible-configuration-notes.md)
23+
for how to prepare both the control and target machines to run the commands
24+
below. To ensure that the secrets are in place and test the connection to a
25+
host use:
26+
27+
```console
28+
$ ansible test-digitalocean-debian8-x64-1 -m ping -vvvv
29+
## Or, for Windows hosts:
30+
$ ansible test-rackspace-win2008r2-x64-1 -m win_ping -vvvv
31+
```
32+
33+
If you're adding a new host, limiting Ansible to just running on that host is
34+
probably quicker. In fact, you most likely want to use `--limit` for everything
35+
when you just need to edit a few set of hosts:
2136

2237
```console
2338
$ ansible-playbook playbooks/jenkins/worker/create.yml \
24-
--limit "test-digitalocean-debian8-x64-1"
39+
--limit "test-digitalocean-debian8-x64-1" -vv
2540
```
2641

27-
..in fact, you most likely want to use `--limit` for everything when you just
28-
need to edit a few set of hosts.
42+
If you only want to run a specific set of steps, you can use `--step`. This is
43+
useful when developing playbooks and when you want to be sure that only a few
44+
steps are executed, to avoid disrupting the machines.
2945

3046
These playbooks are available to you:
3147

@@ -194,5 +210,6 @@ Unsorted stuff of things we need to do/think about
194210
- [ ] github-bot: automate list of whitelisted Jenkins worker IPs with
195211
python
196212

213+
[ansible-install]: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
197214
[callback]: plugins/inventory/nodejs_yaml.py
198215
[github-bot]: https://github.com/nodejs/github-bot

ansible/inventory.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ hosts:
7070

7171
- azure:
7272
msft-ubuntu1404-x64-1: {ip: node-msft-cross-compiler-1.cloudapp.net}
73-
win10-x64-1: {ip: 40.114.4.213, port: 55646}
74-
win10-x64-2: {ip: 40.76.31.157, port: 61279}
75-
win10-x64-3: {ip: 40.76.25.231, port: 60033}
76-
win10-x64-4: {ip: 40.76.23.22, port: 58919}
77-
win10-x64-5: {ip: 40.76.19.120, port: 60486}
78-
win2008r2-x64-1: {ip: 104.209.213.11, port: 55511}
79-
win2008r2-x64-2: {ip: 104.209.209.74, port: 55516}
80-
win2008r2-x64-3: {ip: 104.209.215.1, port: 54886}
81-
win2012r2-x64-1: {ip: 104.209.213.170, port: 54633}
82-
win2012r2-x64-2: {ip: 104.209.212.27, port: 61718}
83-
win2012r2-x64-3: {ip: 104.209.210.218, port: 52109}
8473

8574
- digitalocean:
8675
centos5-x86-1: {ip: 192.241.250.186}
@@ -166,24 +155,6 @@ hosts:
166155
ubuntu1204-x64-1: {ip: 119.9.51.210}
167156
ubuntu1604-x64-1: {ip: 119.9.51.176}
168157
ubuntu1604-x64-2: {ip: 104.130.124.194}
169-
win2008r2-x64-1: {ip: 104.130.225.148}
170-
win2008r2-x64-2: {ip: 23.253.254.31}
171-
win2008r2-x64-3: {ip: 104.130.8.178}
172-
win2008r2-x64-4: {ip: 104.239.156.73}
173-
win2008r2-x64-5: {ip: 104.239.231.190}
174-
win2008r2-x64-6: {ip: 23.253.107.98}
175-
win2012r2-x64-1: {ip: 104.130.175.153}
176-
win2012r2-x64-2: {ip: 23.253.249.139}
177-
win2012r2-x64-3: {ip: 162.242.241.50}
178-
win2012r2-x64-4: {ip: 67.192.246.240}
179-
win2012r2-x64-5: {ip: 104.239.174.16}
180-
win2012r2-x64-6: {ip: 23.253.234.112}
181-
win2012r2-x64-7: {ip: 162.242.247.5}
182-
win2012r2-x64-8: {ip: 104.239.151.28}
183-
win2012r2-x64-9: {ip: 104.239.231.87}
184-
win2012r2-x64-10: {ip: 162.242.156.145}
185-
win2012r2-x64-11: {ip: 162.242.235.179}
186-
win2012r2-x64-12: {ip: 104.239.150.105}
187158

188159
- requireio:
189160
andineck-debian9-armv6l_pi1p-1: {ip: 192.168.2.42, user: pi}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
3+
#
4+
# set up a jenkins worker -- muy bueno!
5+
#
6+
7+
- hosts:
8+
- "*-win*"
9+
10+
roles:
11+
- bootstrap
12+
- package-upgrade
13+
- visual-studio
14+
- baselayout-windows
15+
- jenkins-worker-windows
16+
17+
pre_tasks:
18+
- name: check if secret is properly set
19+
fail:
20+
failed_when: not secret
21+
- name: check if the Visual Studio version to install is properly set
22+
when: os|startswith("win")
23+
fail:
24+
failed_when: not vs
25+
26+
post_tasks:
27+
- name: reboot Windows machines
28+
when: os|startswith("win")
29+
win_reboot:
30+
31+
environment: '{{remote_env}}'

ansible/playbooks/jenkins/worker/create.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- infra-softlayer-ubuntu1404-x64-2
1212
- "!test-joyent-freebsd10-x64-2"
1313
- "!test-rackspace-freebsd10-x64-1"
14+
- "!*-win*"
1415

1516
roles:
1617
- bootstrap

ansible/plugins/inventory/nodejs_yaml.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,7 @@ def main():
105105
hostname = '{}-{}{}{}'.format(host_type, provider_name,
106106
delimiter, host)
107107

108-
# no point in adding windows servers for now
109-
if 'win' in hostname:
110-
continue
111-
else:
112-
export[host_type]['hosts'].append(hostname)
108+
export[host_type]['hosts'].append(hostname)
113109

114110
c = {}
115111

@@ -135,8 +131,8 @@ def main():
135131
if 'alias' in metadata:
136132
c.update({'alias': metadata['alias']})
137133

138-
if 'win' in hostname:
139-
c.update({'is_win': True})
134+
if 'vs' in metadata:
135+
c.update({'vs': metadata['vs']})
140136

141137
# add specific options from config
142138
for option in ifilter(lambda s: s.startswith('hosts:'),
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
3+
#
4+
# Install Node build dependencies and other required software
5+
#
6+
7+
- name: install NetWide Assembler
8+
win_chocolatey: name=nasm
9+
10+
- name: install Python 2
11+
win_chocolatey: name=python2
12+
13+
- block:
14+
- name: install Git
15+
win_chocolatey:
16+
name: git
17+
params: '/GitAndUnixToolsOnPath'
18+
- name: enable long paths in Git
19+
win_command: 'git config --global core.longpaths true'
20+
21+
# Necessary for junit output in Jenkins jobs
22+
- name: install tap2junit
23+
win_command: 'pip2 install tap2junit'
24+
25+
# Necessary for the libuv test job
26+
- block:
27+
- name: check if GYP is already cloned
28+
win_stat: path='C:\gyp'
29+
register: gyp_stat
30+
- name: clone GYP repository
31+
win_command: 'git clone https://chromium.googlesource.com/external/gyp C:\gyp'
32+
when: not gyp_stat.stat.exists
33+
- name: update GYP repository
34+
win_command: 'git pull'
35+
args: { chdir: 'C:\gyp' }
36+
when: gyp_stat.stat.exists
37+
38+
# Necessary for releases of older versions of Node
39+
- block:
40+
- name: create node-icu directory
41+
win_file: path='C:\\node-icu' state=directory
42+
- name: download ICU2C 54 zip
43+
win_get_url:
44+
url: 'http://download.icu-project.org/files/icu4c/54.1/icu4c-54_1-src.zip'
45+
dest: 'C:\node-icu\icu4c-54_1-src.zip'
46+
force: no
47+
- name: download ICU2C 55 zip
48+
win_get_url:
49+
url: 'http://download.icu-project.org/files/icu4c/55.1/icu4c-55_1-src.zip'
50+
dest: 'C:\node-icu\icu4c-55_1-src.zip'
51+
force: no
52+
- name: download ICU2C 56 zip
53+
win_get_url:
54+
url: 'http://download.icu-project.org/files/icu4c/56.1/icu4c-56_1-src.zip'
55+
dest: 'C:\node-icu\icu4c-56_1-src.zip'
56+
force: no
57+
58+
# Necessary for compressing the Node package
59+
- name: install 7Zip
60+
win_chocolatey: name=7zip
61+
62+
# Utilities
63+
- block:
64+
- name: install Sysinternals Suite
65+
win_chocolatey: name=sysinternals
66+
- name: install Google Chrome
67+
win_chocolatey: name=googlechrome
68+
- name: install Notepad++
69+
win_chocolatey: name=notepadplusplus

ansible/roles/baselayout/tasks/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
shell: coreadm -i /home/iojs/cores/core.%f.%p -e process -d global
3131

3232
- name: disable sftp
33-
when: not os|startswith("win")
3433
notify: restart sshd
3534
lineinfile: state=absent dest="{{ ssh_config }}" regexp=^Subsystem(\s+)sftp
3635

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
3+
#
4+
# Windows bootstrap
5+
#
6+
7+
- name: create TEMP directory
8+
win_file: path='C:\TEMP' state=directory
9+
10+
- block:
11+
- name: set automatic logon user name
12+
win_regedit:
13+
path: "{{ autologon_regpath }}"
14+
name: DefaultUsername
15+
data: "{{ ansible_ssh_user }}"
16+
type: string
17+
- name: set automatic logon password
18+
win_regedit:
19+
path: "{{ autologon_regpath }}"
20+
name: DefaultPassword
21+
data: "{{ ansible_ssh_pass }}"
22+
type: string
23+
- name: enable automatic logon
24+
win_regedit:
25+
path: "{{ autologon_regpath }}"
26+
name: AutoAdminLogon
27+
data: 1
28+
type: string
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
raspberry_pi: {
22
apt_proxy: 'http://192.168.2.100:3142',
33
}
4+
5+
autologon_regpath: 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'

ansible/roles/docker/tasks/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
name: "{{ inventory_hostname|replace('_', '-') }}"
1313

1414
- name: disable sftp
15-
when: not os|startswith("win")
1615
notify: restart sshd
1716
lineinfile:
1817
state: absent

0 commit comments

Comments
 (0)