Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.78 KB | None | 0 0
  1. network publica (outbound = 'yes' and outports = '80,7000,8080,22,9000')
  2. network privada ()
  3.  
  4. system central (
  5. cpu.arch='x86_64' and
  6. cpu.count>=1 and
  7. memory.size>=1740m and
  8. net_interface.0.connection = 'publica' and
  9. net_interface.1.connection = 'privada' and
  10. net_interface.0.dns_name = 'central-mv' and
  11. net_interface.1.dns_name = 'central-priv' and
  12. disk.0.image.url = 'aws://us-east-1/ami-e50e888c' and
  13. disk.0.os.name='linux' and
  14. disk.0.os.credentials.username='ubuntu' and
  15. disk.0.os.version='14.04' and
  16. disk.0.applications contains (name='aws.region.us-east-1' and preinstalled='yes')
  17. )
  18.  
  19. system mv1 (
  20. cpu.arch='x86_64' and
  21. cpu.count>=1 and
  22. memory.size>=512m and
  23. net_interface.0.connection = 'publica' and
  24. net_interface.1.connection = 'privada' and
  25. disk.0.image.url = 'aws://us-east-1/ami-e50e888c' and
  26. disk.0.os.name='linux' and
  27. disk.0.os.credentials.username='ubuntu' and
  28. disk.0.os.version='14.04' and
  29. disk.0.applications contains (name='aws.region.us-east-1' and preinstalled='yes')
  30. )
  31.  
  32. system mv2 (
  33. cpu.arch='x86_64' and
  34. cpu.count>=1 and
  35. memory.size>=512m and
  36. net_interface.0.connection = 'publica' and
  37. net_interface.1.connection = 'privada' and
  38. disk.0.image.url = 'aws://us-east-1/ami-e50e888c' and
  39. disk.0.os.name='linux' and
  40. disk.0.os.credentials.username='ubuntu' and
  41. disk.0.os.version='14.04' and
  42. disk.0.applications contains (name='aws.region.us-east-1' and preinstalled='yes')
  43. )
  44.  
  45. configure central (
  46. @begin
  47. ---
  48. - vars:
  49. destination: /home/ubuntu/git-server
  50. accounts:
  51. - { name: "franz", pw: "gu2KmqcJp0Yyo", pass: "franz"}
  52. - { name: "german", pw: "gu2KmqcJp0Yyo", pass: "german"}
  53.  
  54. base: /home/ubuntu/base
  55. baseurl: https://master-class:master-password@bitbucket.org/phantro/base-java.git
  56. unitarias: /home/ubuntu/pruebas-unitarias-c
  57. unitariasurl: https://master-class:master-password@bitbucket.org/phantro/pruebas-unitarias-c.git
  58. ipmaster: localhost
  59. jenkinsnode: /home/ubuntu/node-jenkins
  60. jenkinsnodeurl: https://phantro:3468224@bitbucket.org/phantro/node-jenkins.git
  61. jenkins: /home/ubuntu/jenkins-server
  62.  
  63. tasks:
  64. - name: Install Git
  65. apt: name=git update_cache=yes state=latest
  66.  
  67. - name: update repository
  68. shell: 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -'
  69.  
  70. - name: Install Node.js
  71. apt: name=nodejs update_cache=yes state=present
  72.  
  73. - name: Install Dependency
  74. apt: name=build-essential update_cache=yes state=present
  75.  
  76. - name: App | Cloning repos + submodules
  77. git: repo=https://master-class:master-password@bitbucket.org/phantro/git-server.git
  78. dest={{ item.dest }}
  79. accept_hostkey=yes
  80. force=yes
  81. recursive=no
  82. with_items:
  83. -
  84. dest: "{{ destination }}"
  85. repo: PrimaryRepo
  86.  
  87. - copy: dest={{ destination }}/server.js content="var GitServer=require('git-server'),franz={username:'franz',password:'franz'},german={username:'german',password:'german'},central={username:'admin',password:'admin'},copia={username:'copia',password:'copia'},franzRepo={name:'franz',anonRead:!1,users:[{user:franz,permissions:['R','W']},{user:central,permissions:['R','W']}]},germanRepo={name:'german',anonRead:!1,users:[{user:german,permissions:['R','W']},{user:central,permissions:['R','W']}]},centralRepo={name:'central',anonRead:!1,users:[{user:central,permissions:['R','W']},{user:copia,permissions:['R']}]};_g=new GitServer([franzRepo,germanRepo,centralRepo]);"
  88.  
  89. - name: corre node git server
  90. shell: 'node {{ destination }}/server.js &'
  91.  
  92. - name: App | Cloning repos + base
  93. git: repo={{ baseurl }}
  94. dest={{ item.dest }}
  95. accept_hostkey=yes
  96. force=yes
  97. recursive=no
  98. with_items:
  99. -
  100. dest: "{{ base }}"
  101. repo: PrimaryRepo
  102.  
  103. - name: colocando remote
  104. shell: 'cd {{base}} && git remote add {{ item.name }} http://{{ item.name }}:{{ item.pass }}@{{ ipmaster }}:7000/{{ item.name }}.git'
  105. with_items: accounts
  106.  
  107. - name: subiendo remote
  108. shell: 'cd {{base}} && git push {{ item.name }} master'
  109. with_items: accounts
  110.  
  111. - name: App | Cloning repos + pruebas unitarias
  112. git: repo={{ unitariasurl }}
  113. dest={{ item.dest }}
  114. accept_hostkey=yes
  115. force=yes
  116. recursive=no
  117. with_items:
  118. -
  119. dest: "{{ unitarias }}"
  120. repo: PrimaryRepo
  121.  
  122. - name: App | Cloning repos + backup proyect
  123. git: repo={{ jenkinsnodeurl }}
  124. dest={{ item.dest }}
  125. accept_hostkey=yes
  126. force=yes
  127. recursive=no
  128. with_items:
  129. -
  130. dest: "{{ jenkinsnode }}"
  131. repo: PrimaryRepo
  132.  
  133. - copy: dest={{ jenkinsnode }}/user.json content='{"user1":{"nombre":"franz","password":"franz"},"user2":{"nombre":"german","password":"german"}}'
  134.  
  135. - name: update repository linux
  136. shell: "apt-get update"
  137.  
  138. - name: add repo for java 8
  139. apt_repository: repo='ppa:webupd8team/java' state=present
  140.  
  141. - name: set licence selected
  142. shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
  143. sudo: yes
  144.  
  145. - name: install java 8
  146. apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
  147. sudo: yes
  148.  
  149. - lineinfile: dest=/etc/bash.bashrc regexp="export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" line="export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" create=yes
  150.  
  151. - name: App | Cloning repos + submodules + jenkins
  152. git: repo=https://master-class:master-password@bitbucket.org/phantro/jenkins-server.git
  153. dest={{ item.dest }}
  154. accept_hostkey=yes
  155. force=yes
  156. recursive=no
  157. with_items:
  158. -
  159. dest: "{{ jenkins }}"
  160. repo: PrimaryRepo
  161.  
  162. - name: permisos jenkins
  163. shell: 'chmod 755 ./jenkins-server/bash.sh'
  164.  
  165. - name: corre servidor jenkins
  166. shell: 'sh ./jenkins-server/bash.sh &'
  167.  
  168. - name: descarga maven
  169. shell: 'wget http://archive.apache.org/dist/maven/binaries/apache-maven-3.0.4-bin.tar.gz'
  170.  
  171. - name: descomprimir maven
  172. shell: 'tar -zxf apache-maven-3.0.4-bin.tar.gz'
  173.  
  174. - name: copiar maven
  175. shell: 'sudo cp -R apache-maven-3.0.4 /usr/local'
  176.  
  177. - name: maven para su ejecucion
  178. shell: 'sudo ln -s /usr/local/apache-maven-3.0.4/bin/mvn /usr/bin/mvn'
  179.  
  180. - name: descargar sonar
  181. shell: 'wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-4.5.7.zip'
  182.  
  183. - name: Install unzip
  184. apt: pkg=unzip state=latest update_cache=yes
  185.  
  186. - name: descomprimir sonar
  187. shell: 'unzip sonarqube-4.5.7.zip'
  188.  
  189. - name: ejecuta sonar
  190. shell: 'cd sonarqube-4.5.7 && bin/linux-x86-64/sonar.sh console &'
  191.  
  192. @end
  193. )
  194.  
  195. configure mv1 (
  196. @begin
  197. ---
  198. - vars:
  199. accounts:
  200. - { name: "franz", pw: "gu2KmqcJp0Yyo", pass: "franz"}
  201.  
  202. ipmaster: central-priv
  203.  
  204. tasks:
  205. - name: Install Git
  206. apt: name=git update_cache=yes state=latest
  207.  
  208. - name: Create user accounts
  209. user: name={{ item.name }} password={{ item.pw }} shell=/bin/bash
  210. with_items: accounts
  211.  
  212. - name: Modify $HOME permissions
  213. file: path=/home/{{ item.name }} state=directory owner={{ item.name }} group={{ item.name }} mode=0700
  214. with_items: accounts
  215. - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication no" line="PasswordAuthentication no" state=absent
  216. - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication yes" line="PasswordAuthentication yes" state=present
  217. - service: name=ssh state=restarted
  218.  
  219. - name: clonado en cada cuenta
  220. shell: 'cd /home/{{ item.name }} && git clone http://{{ item.name }}:{{ item.pass }}@{{ ipmaster }}:7000/{{ item.name }}.git && chmod 0700 -R /home/{{ item.name }}/{{ item.name }}'
  221. with_items: accounts
  222.  
  223. - name: colocando remote central
  224. shell: 'cd /home/{{ item.name }}/{{ item.name }} && git remote add central http://copia:copia@{{ ipmaster }}:7000/central.git'
  225. with_items: accounts
  226.  
  227. - name: update repository linux
  228. shell: "apt-get update"
  229.  
  230. - name: add repo for java 8
  231. apt_repository: repo='ppa:webupd8team/java' state=present
  232.  
  233. - name: set licence selected
  234. shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
  235. sudo: yes
  236.  
  237. - name: install java 8
  238. apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
  239. sudo: yes
  240.  
  241. - lineinfile: dest=/etc/bash.bashrc regexp="export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" line="export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" create=yes
  242.  
  243. @end
  244. )
  245.  
  246. configure mv2 (
  247. @begin
  248. ---
  249. - vars:
  250. accounts:
  251. - { name: "german", pw: "gu2KmqcJp0Yyo", pass: "german"}
  252.  
  253. ipmaster: central-priv
  254.  
  255. tasks:
  256. - name: Install Git
  257. apt: name=git update_cache=yes state=latest
  258.  
  259. - name: Create user accounts
  260. user: name={{ item.name }} password={{ item.pw }} shell=/bin/bash
  261. with_items: accounts
  262.  
  263. - name: Modify $HOME permissions
  264. file: path=/home/{{ item.name }} state=directory owner={{ item.name }} group={{ item.name }} mode=0700
  265. with_items: accounts
  266. - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication no" line="PasswordAuthentication no" state=absent
  267. - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication yes" line="PasswordAuthentication yes" state=present
  268. - service: name=ssh state=restarted
  269.  
  270. - name: clonado en cada cuenta
  271. shell: 'cd /home/{{ item.name }} && git clone http://{{ item.name }}:{{ item.pass }}@{{ ipmaster }}:7000/{{ item.name }}.git && chmod 0700 -R /home/{{ item.name }}/{{ item.name }}'
  272. with_items: accounts
  273.  
  274. - name: colocando remote central
  275. shell: 'cd /home/{{ item.name }}/{{ item.name }} && git remote add central http://copia:copia@{{ ipmaster }}:7000/central.git'
  276. with_items: accounts
  277.  
  278. - name: update repository linux
  279. shell: "apt-get update"
  280.  
  281. - name: add repo for java 8
  282. apt_repository: repo='ppa:webupd8team/java' state=present
  283.  
  284. - name: set licence selected
  285. shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
  286. sudo: yes
  287.  
  288. - name: install java 8
  289. apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
  290. sudo: yes
  291.  
  292. - lineinfile: dest=/etc/bash.bashrc regexp="export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" line="export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" create=yes
  293.  
  294. @end
  295. )
  296.  
  297. deploy central 1
  298. deploy mv1 1
  299. deploy mv2 1
  300.  
  301. contextualize (
  302. system central configure central step 1
  303. system mv1 configure mv1 step 2
  304. system mv2 configure mv2 step 2
  305. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement