Skip to content

Instantly share code, notes, and snippets.

@algotrader-dotcom
Last active March 26, 2019 01:01

Revisions

  1. algotrader-dotcom revised this gist Mar 26, 2019. 1 changed file with 54 additions and 66 deletions.
    120 changes: 54 additions & 66 deletions i2_playbook.yml
    Original file line number Diff line number Diff line change
    @@ -1,66 +1,54 @@
    hosts: localhost
    connection: local
    sudo: yes

    tasks:
    — name: Install list of packages
    apt: name={{item}} state=installed
    with_items:
    — htop
    — ctop
    — screen
    — unzip
    — curl
    — sudo
    — mtr
    — bash-completion
    — tree
    — colordiff
    — ntp
    — bwm-ng
    — docker-compose
    — apt-transport-https

    - name: install docker
    command: sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

    - name: add deb repo
    command: sudo touch /etc/apt/sources.list.d/docker.list

    - lineinfile: dest="/etc/apt/sources.list.d/docker.list" line="{{item}}"
    with_items:
    - "deb https://apt.dockerproject.org/repo ubuntu-trusty main"

    - name: apt update
    apt: update_cache=yes

    - apt: name=docker-engine state=present

    - name: add user mod
    command: sudo usermod -aG docker {{remote_user}}

    - name: add user mod
    command: sudo usermod -aG docker {{action_user}}

    — name: apt update
    command: sudo apt-get update

    — name: Download index.html
    shell: sudo wget https://s3.amazonaws.com/packeramidemo/index.html

    — name: Download Dockerfile
    command: wget https://s3.amazonaws.com/packeramidemo/Dockerfile

    — name: Docker build image
    command: sudo docker build -t “simple_worx:dockerfile” .
    ignore_errors: yes

    — name: Docker run even after restart
    command: sudo docker run -dit — restart unless-stopped -p 80:80 simple_worx:dockerfile
    ignore_errors: yes

    — name: Docker running?
    command: curl localhost:80
    register: out

    — debug: var=out.stdout_lines
    ---
    - hosts: 127.0.0.1
    connection: local
    become: true
    tasks:
    - name: install wget
    yum:
    name: wget
    state: present
    - name: install openjdk
    yum:
    name: java-1.8.0-openjdk
    state: present

    - name: download jenkins.repo
    get_url:
    url: http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
    dest: /etc/yum.repos.d/jenkins.repo

    - name: import jenkins key
    rpm_key:
    state: present
    key: https://jenkins-ci.org/redhat/jenkins-ci.org.key

    - name: install jenkins
    yum:
    name: jenkins
    state: present

    #- name: start jenkins
    # systemd:
    # name: jenkins
    # state: started

    #- name: enable jenkins
    # systemd:
    # name: jenkins
    # enabled: true

    - name: Start jenkins
    shell: sudo service jenkins start

    - name: sleep for 30 seconds and continue with play
    wait_for: timeout=30
    delegate_to: localhost

    - name: init password jenkin
    shell: cat /var/lib/jenkins/secrets/initialAdminPassword
    changed_when: false
    register: result

    - name: print init password jenkins
    debug:
    var: result.stdout
  2. algotrader-dotcom revised this gist Mar 25, 2019. 1 changed file with 12 additions and 14 deletions.
    26 changes: 12 additions & 14 deletions i2_playbook.yml
    Original file line number Diff line number Diff line change
    @@ -48,21 +48,19 @@ tasks:
    — name: Download index.html
    shell: sudo wget https://s3.amazonaws.com/packeramidemo/index.html

    — name: Download Dockerfile
    command: wget https://s3.amazonaws.com/packeramidemo/Dockerfile

    — name: Download Dockerfile
    command: wget https://s3.amazonaws.com/packeramidemo/Dockerfile
    — name: Docker build image
    command: sudo docker build -t “simple_worx:dockerfile” .
    ignore_errors: yes

    — name: Docker run even after restart
    command: sudo docker run -dit — restart unless-stopped -p 80:80 simple_worx:dockerfile
    ignore_errors: yes

    — name: Docker build image
    command: sudo docker build -t “simple_worx:dockerfile” .
    ignore_errors: yes
    — name: Docker running?
    command: curl localhost:80
    register: out


    — name: Docker run even after restart
    command: sudo docker run -dit — restart unless-stopped -p 80:80 simple_worx:dockerfile
    ignore_errors: yes

    — name: Docker running?
    command: curl localhost:80
    register: out
    — debug: var=out.stdout_lines
    — debug: var=out.stdout_lines
  3. algotrader-dotcom revised this gist Mar 25, 2019. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions i2_playbook.yml
    Original file line number Diff line number Diff line change
    @@ -42,11 +42,11 @@ tasks:
    - name: add user mod
    command: sudo usermod -aG docker {{action_user}}

    — name: apt update
    command: sudo apt-get update
    — name: apt update
    command: sudo apt-get update

    — name: Download index.html
    shell: sudo wget https://s3.amazonaws.com/packeramidemo/index.html
    — name: Download index.html
    shell: sudo wget https://s3.amazonaws.com/packeramidemo/index.html


    — name: Download Dockerfile
    @@ -65,4 +65,4 @@ tasks:
    — name: Docker running?
    command: curl localhost:80
    register: out
    — debug: var=out.stdout_lines
    — debug: var=out.stdout_lines
  4. algotrader-dotcom revised this gist Mar 25, 2019. 1 changed file with 21 additions and 23 deletions.
    44 changes: 21 additions & 23 deletions i2_playbook.yml
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,25 @@
    hosts: localhost
    connection: local
    sudo: yes
    tasks:


    — name: Install list of packages
    apt: name={{item}} state=installed
    with_items:
    — htop
    — ctop
    — screen
    — unzip
    — curl
    — sudo
    — mtr
    — bash-completion
    — tree
    — colordiff
    — ntp
    — bwm-ng
    — docker-compose
    — apt-transport-https
    connection: local
    sudo: yes

    tasks:
    — name: Install list of packages
    apt: name={{item}} state=installed
    with_items:
    — htop
    — ctop
    — screen
    — unzip
    — curl
    — sudo
    — mtr
    — bash-completion
    — tree
    — colordiff
    — ntp
    — bwm-ng
    — docker-compose
    — apt-transport-https

    - name: install docker
    command: sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
    @@ -63,7 +62,6 @@ hosts: localhost
    command: sudo docker run -dit — restart unless-stopped -p 80:80 simple_worx:dockerfile
    ignore_errors: yes


    — name: Docker running?
    command: curl localhost:80
    register: out
  5. algotrader-dotcom created this gist Mar 25, 2019.
    70 changes: 70 additions & 0 deletions i2_playbook.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    hosts: localhost
    connection: local
    sudo: yes
    tasks:


    — name: Install list of packages
    apt: name={{item}} state=installed
    with_items:
    — htop
    — ctop
    — screen
    — unzip
    — curl
    — sudo
    — mtr
    — bash-completion
    — tree
    — colordiff
    — ntp
    — bwm-ng
    — docker-compose
    — apt-transport-https

    - name: install docker
    command: sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

    - name: add deb repo
    command: sudo touch /etc/apt/sources.list.d/docker.list

    - lineinfile: dest="/etc/apt/sources.list.d/docker.list" line="{{item}}"
    with_items:
    - "deb https://apt.dockerproject.org/repo ubuntu-trusty main"

    - name: apt update
    apt: update_cache=yes

    - apt: name=docker-engine state=present

    - name: add user mod
    command: sudo usermod -aG docker {{remote_user}}

    - name: add user mod
    command: sudo usermod -aG docker {{action_user}}

    — name: apt update
    command: sudo apt-get update

    — name: Download index.html
    shell: sudo wget https://s3.amazonaws.com/packeramidemo/index.html


    — name: Download Dockerfile
    command: wget https://s3.amazonaws.com/packeramidemo/Dockerfile


    — name: Docker build image
    command: sudo docker build -t “simple_worx:dockerfile” .
    ignore_errors: yes


    — name: Docker run even after restart
    command: sudo docker run -dit — restart unless-stopped -p 80:80 simple_worx:dockerfile
    ignore_errors: yes


    — name: Docker running?
    command: curl localhost:80
    register: out
    — debug: var=out.stdout_lines