-
-
Save chemikadze/5a9abc8b3d070153b1b2 to your computer and use it in GitHub Desktop.
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
application: | |
configuration: | |
input.image: "us-east-1/ami-aede32c6" | |
input.image-user: "Administrator" | |
input.instance-size: "m1.medium" | |
input.password: "123QweAsd" | |
input.recipe-url: "https://dl.dropboxusercontent.com/u/250836/jenkins.tar.gz" | |
input.jenkin-server-url: "http://23.20.248.221:8080/" | |
input.quantity: "1" | |
interfaces: | |
input: | |
image: "bind(jenkins-windows-slave#input.image)" | |
image-user: "bind(jenkins-windows-slave#input.image-user)" | |
instance-size: "bind(jenkins-windows-slave#input.instance-size)" | |
password: "bind(jenkins-windows-slave#input.password)" | |
quantity: "bind(jenkins-windows-slave#input.quantity)" | |
recipe-url: "bind(jenkins-windows-slave#input.recipe-url)" | |
jenkin-server-url: "bind(jenkins-windows-slave#input.jenkin-server-url)" | |
actions: | |
update: "bind(jenkins-windows-slave#actions.update)" | |
output: | |
jenkins-slave-hosts: "bind(jenkins-windows-slave#result.jenkins-slave-hosts)" | |
jenkins-slave-password: "bind(jenkins-windows-slave#result.jenkins-slave-password)" | |
components: | |
jenkins-windows-slave: | |
type: workflow.Instance | |
interfaces: | |
input: | |
image: configuration(string) | |
image-user: configuration(string) | |
instance-size: configuration(string) | |
password: configuration(string) | |
quantity: configuration(string) | |
recipe-url: configuration(string) | |
jenkin-server-url: configuration(string) | |
actions: | |
update: receive-command() | |
result: | |
jenkins-slave-hosts: publish-signal(list<string>) | |
jenkins-slave-password: publish-signal(string) | |
configuration: | |
configuration.workflows: | |
launch: | |
parameters: | |
- image: | |
description: AMI id | |
- image-user: | |
description: AMI image image-user | |
- password: | |
description: User password | |
- instance-size: | |
description: Instance type | |
- quantity: | |
description: Number of intances to start | |
- recipe-url: | |
description: Recipe URL | |
- jenkin-server-url: | |
description: Jenkins server URL to coonnect | |
steps: | |
- provision-slave-windows-vm: | |
action: provisionVms | |
parameters: | |
hardwareId: "{$.instance-size}" | |
imageId: "{$.image}" | |
targetQuantity: "{$.quantity}" | |
vmIdentity: "{$.image-user}" | |
roleName: default | |
providerSettings: | |
userData: | |
| | |
<powershell> | |
$$wc = New-Object System.Net.WebClient | |
$$wc.DownloadFile("http://cygwin.com/setup-x86_64.exe", "setup-x86_64.exe") | |
.\setup-x86_64.exe --no-desktop --site ftp://mirrors.kernel.org/sourceware/cygwin/ --quiet-mode --local-package-dir C:\cygwin64\local_packages --packages "openssh,curl,util-linux,procps,sed" | Out-Null | |
C:\cygwin64\bin\bash.exe --login -c "cp /usr/bin/ps.exe /usr/bin/ps.exe~; cp /bin/ps.exe /bin/ps.exe~; cp /usr/bin/procps.exe /usr/bin/ps.exe; cp /usr/bin/procps.exe /bin/ps.exe" | |
C:\cygwin64\bin\bash.exe --login -c "mkdir ~/.ssh; curl 169.254.169.254/latest/meta-data/public-keys/0/openssh-key > ~/.ssh/authorized_keys" | |
C:\cygwin64\bin\bash.exe --login -c "ssh-host-config --yes --user cyg_server --pwd {$.password}" | |
netsh advfirewall firewall add rule name="CYGWIN sshd" dir=in action=allow program="C:\cygwin64\usr\sbin\sshd.exe" enable=yes | |
net start sshd | |
net user Administrator {$.password} | |
cd C:\ | |
C:\cygwin64\bin\curl.exe -O https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-windows-10.32.2-3.windows.msi | |
Start-Process -FilePath msiexec -ArgumentList /i, "C:\chef-windows-10.32.2-3.windows.msi", /quiet, /qn -Wait | |
C:\cygwin64\bin\bash.exe --login -c "cd /cygdrive/c/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.32.2-x86-mingw32/lib/chef/application/; cp solo.rb solo.rb~; cat solo.rb~ | sed -re 's|tar zxvfC|C:/opscode/chef/bin/tar zxvfC|' > solo.rb" | |
C:\cygwin64\bin\bash.exe --login -c "mkdir ~/bin; (echo \\#\\!/usr/bin/bash --login; echo /cygdrive/c/opscode/chef/embedded/bin/ruby.exe C:/opscode/chef/bin/chef-solo \\`$$*) > ~/bin/chef-solo; chmod +x ~/bin/chef-solo" | |
C:\cygwin64\bin\bash.exe --login -c "(echo \\#\\!/usr/bin/bash --login; echo /cygdrive/c/opscode/chef/embedded/bin/ruby.exe C:/opscode/chef/bin/chef-client \\`$$*) > ~/bin/chef-client; chmod +x ~/bin/chef-client" | |
C:\cygwin64\bin\bash.exe --login -c "cat > ~/.bashrc <<'EEND' | |
export LC_ALL=C | |
export LANG=C | |
export PATH=~/bin:`$$PATH | |
EEND | |
" | |
</powershell> | |
output: | |
jenkins-slave-hosts: ips | |
- wait-provision: | |
action: wait | |
precedingPhases: [provision-slave-windows-vm] | |
parameters: | |
delay: 13 minutes | |
- install-jenkins-slave: | |
action: chefsolo | |
precedingPhases: [wait-provision] | |
parameters: | |
isSudo: false | |
recipeUrl: "{$.recipe-url}" | |
runList: [ "recipe[cookbook_qubell_jenkins::node]" ] | |
roles: [default] | |
jattrs: | |
jenkins: | |
server: | |
url: "{$.jenkin-server-url}" | |
node: | |
agent_type: "windows" | |
availability: "always" | |
return: | |
jenkins-slave-hosts: | |
value: "{$.jenkins-slave-hosts}" | |
jenkins-slave-password: | |
value: "{$.password}" | |
update: | |
steps: | |
- install-jenkins-slave: | |
action: chefsolo | |
precedingPhases: [wait-provision] | |
parameters: | |
isSudo: false | |
recipeUrl: "{$.recipe-url}" | |
runList: [ "recipe[cookbook_qubell_jenkins::node]" ] | |
roles: [default] | |
jattrs: | |
jenkins: | |
server: | |
url: "{$.jenkin-server-url}" | |
node: | |
agent_type: "windows" | |
availability: "always" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment