Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions ansible-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
- name: Play1 for copying files
hosts: docker-master
become: yes
tasks:
- name: Copy the war file, dockerfile & flipkart.yml to docker master server
copy:
src: /home/ansadmin/trainingwale/
dest: /opt/docker/trainingwale
owner: root
group: root
mode: '0777'

- name: "Play 2 Install Python packages and docker image push"
hosts: docker-master
become: yes
vars:
ansible_python_interpreter: /usr/bin/python
tasks:
- name: Install boto3 and botocore with pip3 module
pip:
name:
- boto3
- botocore
- docker
executable: pip-2.7
register: out1
- debug:
var: out1

- name: "Delete the docker image"
docker_image:
state: absent
force: yes
name: 127.0.0.1:5000/trainingwaleapp
tag: latest
register: out2
- debug:
var: out2

- name: Build an image and push it to a private repo
docker_image:
path: /opt/docker/trainingwale
name: 127.0.0.1:5000/trainingwaleapp
tag: latest
push: yes
nocache: yes
force: yes
register: out3
- debug:
var: out3

- name: "Play 3 docker stack deploy"
hosts: docker-master
become: yes
tasks:

- name: stop the stack
shell: docker stack rm trainingwale

- name: start the stack
shell: docker stack deploy --compose-file /opt/docker/trainingwale/trainingwale.yml trainingwale
4 changes: 2 additions & 2 deletions src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<body>

<h1>Welcome to DevOps Class</h1>
<h1>I hope you like the course, please give feedback</h1>
<h1>Congratulations !!</h1>
<h1>CI - Jenkins integration with GIT and MAVEN Completed<h1>
</body>
</html>