Last active
August 29, 2015 14:03
-
-
Save jollyrojer/53e43c1a2be52a00ef8d 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)" | |
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) | |
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" | Out-Null | |
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 | |
C:\chef-windows-10.32.2-3.windows.msi /quiet /qn | |
C:\cygwin64\bin\bash.exe --login -c "mkdir ~/bin; echo /cygdrive/c/opscode/chef/embedded/bin/ruby C:/opscode/chef/bin/chef-solo \\`$$* > ~/bin/chef-solo; chmod +x ~/bin/chef-solo" | |
C:\cygwin64\bin\bash.exe --login -c "echo /cygdrive/c/opscode/chef/embedded/bin/ruby 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=`$$PATH:~/bin | |
EEND | |
" | |
</powershell> | |
output: | |
jenkins-slave-hosts: ips | |
- wait-provision: | |
action: wait | |
precedingPhases: [provision-slave-windows-vm] | |
parameters: | |
delay: 10 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}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment