Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- network publica (outbound = 'yes' and outports = '80,7000,8080,22,9000')
- network privada ()
- system central (
- cpu.arch='x86_64' and
- cpu.count>=1 and
- memory.size>=1740m and
- net_interface.0.connection = 'publica' and
- net_interface.1.connection = 'privada' and
- net_interface.0.dns_name = 'central-mv' and
- net_interface.1.dns_name = 'central-priv' and
- disk.0.image.url = 'aws://us-east-1/ami-e50e888c' and
- disk.0.os.name='linux' and
- disk.0.os.credentials.username='ubuntu' and
- disk.0.os.version='14.04' and
- disk.0.applications contains (name='aws.region.us-east-1' and preinstalled='yes')
- )
- system mv1 (
- cpu.arch='x86_64' and
- cpu.count>=1 and
- memory.size>=512m and
- net_interface.0.connection = 'publica' and
- net_interface.1.connection = 'privada' and
- disk.0.image.url = 'aws://us-east-1/ami-e50e888c' and
- disk.0.os.name='linux' and
- disk.0.os.credentials.username='ubuntu' and
- disk.0.os.version='14.04' and
- disk.0.applications contains (name='aws.region.us-east-1' and preinstalled='yes')
- )
- system mv2 (
- cpu.arch='x86_64' and
- cpu.count>=1 and
- memory.size>=512m and
- net_interface.0.connection = 'publica' and
- net_interface.1.connection = 'privada' and
- disk.0.image.url = 'aws://us-east-1/ami-e50e888c' and
- disk.0.os.name='linux' and
- disk.0.os.credentials.username='ubuntu' and
- disk.0.os.version='14.04' and
- disk.0.applications contains (name='aws.region.us-east-1' and preinstalled='yes')
- )
- configure central (
- @begin
- ---
- - vars:
- destination: /home/ubuntu/git-server
- accounts:
- - { name: "franz", pw: "gu2KmqcJp0Yyo", pass: "franz"}
- - { name: "german", pw: "gu2KmqcJp0Yyo", pass: "german"}
- base: /home/ubuntu/base
- baseurl: https://master-class:master-password@bitbucket.org/phantro/base-java.git
- unitarias: /home/ubuntu/pruebas-unitarias-c
- unitariasurl: https://master-class:master-password@bitbucket.org/phantro/pruebas-unitarias-c.git
- ipmaster: localhost
- jenkinsnode: /home/ubuntu/node-jenkins
- jenkinsnodeurl: https://phantro:3468224@bitbucket.org/phantro/node-jenkins.git
- jenkins: /home/ubuntu/jenkins-server
- tasks:
- - name: Install Git
- apt: name=git update_cache=yes state=latest
- - name: update repository
- shell: 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -'
- - name: Install Node.js
- apt: name=nodejs update_cache=yes state=present
- - name: Install Dependency
- apt: name=build-essential update_cache=yes state=present
- - name: App | Cloning repos + submodules
- git: repo=https://master-class:master-password@bitbucket.org/phantro/git-server.git
- dest={{ item.dest }}
- accept_hostkey=yes
- force=yes
- recursive=no
- with_items:
- -
- dest: "{{ destination }}"
- repo: PrimaryRepo
- - 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]);"
- - name: corre node git server
- shell: 'node {{ destination }}/server.js &'
- - name: App | Cloning repos + base
- git: repo={{ baseurl }}
- dest={{ item.dest }}
- accept_hostkey=yes
- force=yes
- recursive=no
- with_items:
- -
- dest: "{{ base }}"
- repo: PrimaryRepo
- - name: colocando remote
- shell: 'cd {{base}} && git remote add {{ item.name }} http://{{ item.name }}:{{ item.pass }}@{{ ipmaster }}:7000/{{ item.name }}.git'
- with_items: accounts
- - name: subiendo remote
- shell: 'cd {{base}} && git push {{ item.name }} master'
- with_items: accounts
- - name: App | Cloning repos + pruebas unitarias
- git: repo={{ unitariasurl }}
- dest={{ item.dest }}
- accept_hostkey=yes
- force=yes
- recursive=no
- with_items:
- -
- dest: "{{ unitarias }}"
- repo: PrimaryRepo
- - name: App | Cloning repos + backup proyect
- git: repo={{ jenkinsnodeurl }}
- dest={{ item.dest }}
- accept_hostkey=yes
- force=yes
- recursive=no
- with_items:
- -
- dest: "{{ jenkinsnode }}"
- repo: PrimaryRepo
- - copy: dest={{ jenkinsnode }}/user.json content='{"user1":{"nombre":"franz","password":"franz"},"user2":{"nombre":"german","password":"german"}}'
- - name: update repository linux
- shell: "apt-get update"
- - name: add repo for java 8
- apt_repository: repo='ppa:webupd8team/java' state=present
- - name: set licence selected
- shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
- sudo: yes
- - name: install java 8
- apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
- sudo: yes
- - 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
- - name: App | Cloning repos + submodules + jenkins
- git: repo=https://master-class:master-password@bitbucket.org/phantro/jenkins-server.git
- dest={{ item.dest }}
- accept_hostkey=yes
- force=yes
- recursive=no
- with_items:
- -
- dest: "{{ jenkins }}"
- repo: PrimaryRepo
- - name: permisos jenkins
- shell: 'chmod 755 ./jenkins-server/bash.sh'
- - name: corre servidor jenkins
- shell: 'sh ./jenkins-server/bash.sh &'
- - name: descarga maven
- shell: 'wget http://archive.apache.org/dist/maven/binaries/apache-maven-3.0.4-bin.tar.gz'
- - name: descomprimir maven
- shell: 'tar -zxf apache-maven-3.0.4-bin.tar.gz'
- - name: copiar maven
- shell: 'sudo cp -R apache-maven-3.0.4 /usr/local'
- - name: maven para su ejecucion
- shell: 'sudo ln -s /usr/local/apache-maven-3.0.4/bin/mvn /usr/bin/mvn'
- - name: descargar sonar
- shell: 'wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-4.5.7.zip'
- - name: Install unzip
- apt: pkg=unzip state=latest update_cache=yes
- - name: descomprimir sonar
- shell: 'unzip sonarqube-4.5.7.zip'
- - name: ejecuta sonar
- shell: 'cd sonarqube-4.5.7 && bin/linux-x86-64/sonar.sh console &'
- @end
- )
- configure mv1 (
- @begin
- ---
- - vars:
- accounts:
- - { name: "franz", pw: "gu2KmqcJp0Yyo", pass: "franz"}
- ipmaster: central-priv
- tasks:
- - name: Install Git
- apt: name=git update_cache=yes state=latest
- - name: Create user accounts
- user: name={{ item.name }} password={{ item.pw }} shell=/bin/bash
- with_items: accounts
- - name: Modify $HOME permissions
- file: path=/home/{{ item.name }} state=directory owner={{ item.name }} group={{ item.name }} mode=0700
- with_items: accounts
- - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication no" line="PasswordAuthentication no" state=absent
- - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication yes" line="PasswordAuthentication yes" state=present
- - service: name=ssh state=restarted
- - name: clonado en cada cuenta
- 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 }}'
- with_items: accounts
- - name: colocando remote central
- shell: 'cd /home/{{ item.name }}/{{ item.name }} && git remote add central http://copia:copia@{{ ipmaster }}:7000/central.git'
- with_items: accounts
- - name: update repository linux
- shell: "apt-get update"
- - name: add repo for java 8
- apt_repository: repo='ppa:webupd8team/java' state=present
- - name: set licence selected
- shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
- sudo: yes
- - name: install java 8
- apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
- sudo: yes
- - 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
- @end
- )
- configure mv2 (
- @begin
- ---
- - vars:
- accounts:
- - { name: "german", pw: "gu2KmqcJp0Yyo", pass: "german"}
- ipmaster: central-priv
- tasks:
- - name: Install Git
- apt: name=git update_cache=yes state=latest
- - name: Create user accounts
- user: name={{ item.name }} password={{ item.pw }} shell=/bin/bash
- with_items: accounts
- - name: Modify $HOME permissions
- file: path=/home/{{ item.name }} state=directory owner={{ item.name }} group={{ item.name }} mode=0700
- with_items: accounts
- - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication no" line="PasswordAuthentication no" state=absent
- - lineinfile: dest=/etc/ssh/sshd_config regexp="PasswordAuthentication yes" line="PasswordAuthentication yes" state=present
- - service: name=ssh state=restarted
- - name: clonado en cada cuenta
- 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 }}'
- with_items: accounts
- - name: colocando remote central
- shell: 'cd /home/{{ item.name }}/{{ item.name }} && git remote add central http://copia:copia@{{ ipmaster }}:7000/central.git'
- with_items: accounts
- - name: update repository linux
- shell: "apt-get update"
- - name: add repo for java 8
- apt_repository: repo='ppa:webupd8team/java' state=present
- - name: set licence selected
- shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
- sudo: yes
- - name: install java 8
- apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
- sudo: yes
- - 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
- @end
- )
- deploy central 1
- deploy mv1 1
- deploy mv2 1
- contextualize (
- system central configure central step 1
- system mv1 configure mv1 step 2
- system mv2 configure mv2 step 2
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement