diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..244652b4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+ansible.yaml
+deployment.yaml
diff --git a/123.txt b/123.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/Dockerfile b/Dockerfile
index ceb6b0ab..cfe189d0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
-FROM tomcat
-WORKDIR webapps
-COPY target/WebApp.war .
-RUN rm -rf ROOT && mv WebApp.war ROOT.war
-ENTRYPOINT ["sh", "/usr/local/tomcat/bin/startup.sh"]
+FROM tomcat
+WORKDIR webapps
+COPY target/WebApp.war .
+RUN rm -rf ROOT && mv WebApp.war ROOT.war
+ENTRYPOINT ["sh", "/usr/local/tomcat/bin/startup.sh"]
diff --git a/Jenkinsfile b/Jenkinsfile
index b6c34792..805dcbe1 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,79 +1,79 @@
-currentBuild.displayName = "Final_Demo # "+currentBuild.number
-
- def getDockerTag(){
- def tag = sh script: 'git rev-parse HEAD', returnStdout: true
- return tag
- }
-
-
-pipeline{
- agent any
- environment{
- Docker_tag = getDockerTag()
- }
-
- stages{
-
-
- stage('Quality Gate Statuc Check'){
-
- agent {
- docker {
- image 'maven'
- args '-v $HOME/.m2:/root/.m2'
- }
- }
- steps{
- script{
- withSonarQubeEnv('sonarserver') {
- sh "mvn sonar:sonar"
- }
- timeout(time: 1, unit: 'HOURS') {
- def qg = waitForQualityGate()
- if (qg.status != 'OK') {
- error "Pipeline aborted due to quality gate failure: ${qg.status}"
- }
- }
- sh "mvn clean install"
- }
- }
- }
-
-
-
- stage('build')
- {
- steps{
- script{
- sh 'cp -r ../devops-training@2/target .'
- sh 'docker build . -t deekshithsn/devops-training:$Docker_tag'
- withCredentials([string(credentialsId: 'docker_password', variable: 'docker_password')]) {
-
- sh 'docker login -u deekshithsn -p $docker_password'
- sh 'docker push deekshithsn/devops-training:$Docker_tag'
- }
- }
- }
- }
-
- stage('ansible playbook'){
- steps{
- script{
- sh '''final_tag=$(echo $Docker_tag | tr -d ' ')
- echo ${final_tag}test
- sed -i "s/docker_tag/$final_tag/g" deployment.yaml
- '''
- ansiblePlaybook become: true, installation: 'ansible', inventory: 'hosts', playbook: 'ansible.yaml'
- }
- }
- }
-
-
-
- }
-
-
-
-
-
-}
+currentBuild.displayName = "Final_Demo # "+currentBuild.number
+
+ def getDockerTag(){
+ def tag = sh script: 'git rev-parse HEAD', returnStdout: true
+ return tag
+ }
+
+
+pipeline{
+ agent any
+ environment{
+ Docker_tag = getDockerTag()
+ }
+
+ stages{
+
+
+ stage('Quality Gate Statuc Check'){
+
+ agent {
+ docker {
+ image 'maven'
+ args '-v $HOME/.m2:/root/.m2'
+ }
+ }
+ steps{
+ script{
+ withSonarQubeEnv('sonarserver') {
+ sh "mvn sonar:sonar"
+ }
+ timeout(time: 1, unit: 'HOURS') {
+ def qg = waitForQualityGate()
+ if (qg.status != 'OK') {
+ error "Pipeline aborted due to quality gate failure: ${qg.status}"
+ }
+ }
+ sh "mvn clean install"
+ }
+ }
+ }
+
+
+
+ stage('build')
+ {
+ steps{
+ script{
+ sh 'cp -r ../devops-training@2/target .'
+ sh 'docker build . -t deekshithsn/devops-training:$Docker_tag'
+ withCredentials([string(credentialsId: 'docker_password', variable: 'docker_password')]) {
+
+ sh 'docker login -u deekshithsn -p $docker_password'
+ sh 'docker push deekshithsn/devops-training:$Docker_tag'
+ }
+ }
+ }
+ }
+
+ stage('ansible playbook'){
+ steps{
+ script{
+ sh '''final_tag=$(echo $Docker_tag | tr -d ' ')
+ echo ${final_tag}test
+ sed -i "s/docker_tag/$final_tag/g" deployment.yaml
+ '''
+ ansiblePlaybook become: true, installation: 'ansible', inventory: 'hosts', playbook: 'ansible.yaml'
+ }
+ }
+ }
+
+
+
+ }
+
+
+
+
+
+}
diff --git a/README.md b/README.md
index 78662a2a..cbe0ce89 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,14 @@
-
-
-# Build Instruction
-
-
-```
-mvn clean package
-and build the instruction .
-```
-
-# Deploy instruction
-
-Deploy ```target/WebApp.war``` on Tomcat properly for better experience.
-
+
+
+# Build Instruction
+
+
+```
+mvn clean package
+and build the instruction .
+```
+
+# Deploy instruction
+
+Deploy ```target/WebApp.war``` on Tomcat properly for better experience.
+
diff --git a/ansible.yaml b/ansible.yaml
index a349d7b8..68f5bd8e 100644
--- a/ansible.yaml
+++ b/ansible.yaml
@@ -1,11 +1,11 @@
-- hosts: test
- tasks:
- - name: copy deployment file to kubernetes master
- copy:
- src: deployment.yaml
- dest: /root/
- - name: delete the previous of kubernetes objects
- command: kubectl delete -f /root/deployment.yaml
- - name: Create a Deployment by reading the definition from a local file
- command: kubectl apply -f /root/deployment.yaml
-
+- hosts: test
+ tasks:
+ - name: copy deployment file to kubernetes master
+ copy:
+ src: deployment.yaml
+ dest: /root/
+ - name: delete the previous of kubernetes objects
+ command: kubectl delete -f /root/deployment.yaml
+ - name: Create a Deployment by reading the definition from a local file
+ command: kubectl apply -f /root/deployment.yaml
+
diff --git a/deployment.yaml b/deployment.yaml
index 55d9da8b..e6d8d3b9 100644
--- a/deployment.yaml
+++ b/deployment.yaml
@@ -1,38 +1,38 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: devops-training
-spec:
- selector:
- matchLabels:
- app: devops-training
- template:
- metadata:
- labels:
- app: devops-training
- spec:
- containers:
- - name: devops-training
- image: deekshithsn/devops-training:docker_tag
- command: ["/bin/sh"]
- args: ["-c","sh /usr/local/tomcat/bin/startup.sh;while true; do echo hello; sleep 10;done"]
- ports:
- - name: http
- containerPort: 8080
- replicas: 2
----
-apiVersion: v1
-kind: Service
-metadata:
- name: devops-training-app-service
- labels:
- app: devops-training
-spec:
- type: NodePort
- ports:
- - port: 8080
- nodePort: 31884
- protocol: TCP
- name: http
- selector:
- app: devops-training
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: devops-training
+spec:
+ selector:
+ matchLabels:
+ app: devops-training
+ template:
+ metadata:
+ labels:
+ app: devops-training
+ spec:
+ containers:
+ - name: devops-training
+ image: deekshithsn/devops-training:docker_tag
+ command: ["/bin/sh"]
+ args: ["-c","sh /usr/local/tomcat/bin/startup.sh;while true; do echo hello; sleep 10;done"]
+ ports:
+ - name: http
+ containerPort: 8080
+ replicas: 2
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: devops-training-app-service
+ labels:
+ app: devops-training
+spec:
+ type: NodePort
+ ports:
+ - port: 8080
+ nodePort: 31884
+ protocol: TCP
+ name: http
+ selector:
+ app: devops-training
diff --git a/hosts b/hosts
index 289312cd..4ce5cf1a 100644
--- a/hosts
+++ b/hosts
@@ -1,2 +1,2 @@
-[test]
-Host_ip
+[test]
+Host_ip
diff --git a/pom.xml b/pom.xml
index 3909d5ff..477aa94e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,21 +1,21 @@
-
DevOps is the combination of cultural philosophies, practices, and tools that increases an organization's ability to deliver applications and services at high velocity: evolving and improving products at a faster pace than organizations using traditional software development and infrastructure management processes.
- -Jenkins is a free and open source automation server. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery
- -Maven is a build automation tool used primarily for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.
- -DevOps is the combination of cultural philosophies, practices, and tools that increases an organization's ability to deliver applications and services at high velocity: evolving and improving products at a faster pace than organizations using traditional software development and infrastructure management processes.
+ +Jenkins is a free and open source automation server. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery
+ +Maven is a build automation tool used primarily for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.
+ +