From db400ae6ca74f49b9712d115c5df7ccd5796c815 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 8 Dec 2022 09:26:29 +0000 Subject: [PATCH 01/23] python project files --- Dockerfile | 7 +++++++ README.md | 1 + demo.py | 10 ++++++++++ requirements.txt | 3 +++ 4 files changed, 21 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 demo.py create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0cd04dc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:alpine3.7 +COPY . /app +WORKDIR /app +RUN pip install -r requirements.txt +EXPOSE 5001 +ENTRYPOINT [ "python" ] +CMD [ "demo.py" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..20d3fde --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# python-flask-docker-project \ No newline at end of file diff --git a/demo.py b/demo.py new file mode 100644 index 0000000..0966f90 --- /dev/null +++ b/demo.py @@ -0,0 +1,10 @@ +from flask import Flask +app = Flask(__name__) + +@app.route('/') +def hello(): + return "welcome to the flask tutorials" + + +if __name__ == "__main__": + app.run(host ='0.0.0.0', port = 5001, debug = True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..db07929 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +flask +mysql-connector-python +boto3 From 73648583113f4538289fb1fbf2877fa98fdf5062 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:00:07 +0530 Subject: [PATCH 02/23] Create Jenkinsfile --- Jenkinsfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..6ecf055 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,41 @@ +pipeline{ + options { + buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '6')) + } + agent any + environment { + DOCKERHUB_REPO = "techcoms/backend-python" + GITHUB_URL = "${params.url}" + BRANCH = "${params.branch}" + + } + stages{ + stage("git checkout"){ + steps{ + git branch: "${BRANCH}", credentialsId: 'github-creds', url: "${GITHUB_URL}" + } + } + + stage("build docker image"){ + steps { + sh "docker build -t ${DOCKERHUB_REPO}:${BUILD_NUMBER} ." + } + } + stage("login to dockerhub and push image"){ + steps { + withCredentials([usernamePassword(credentialsId: 'dockerhub-creds', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) { + sh "docker login -u $USERNAME -p $PASSWORD " + sh "docker push ${DOCKERHUB_REPO}:${BUILD_NUMBER}" + + } + } + } + } + post{ + changed{ + mail to: "techcomsdevops@gmail.com", + subject: "jenkins build:${currentBuild.currentResult}: ${env.JOB_NAME}", + body: "${currentBuild.currentResult}: Job ${env.JOB_NAME}\nMore Info can be found here: ${env.BUILD_URL}" + } + } +} From e4af8f4b7acfed340b5c8f9cd96a61a424cbb0c1 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:20:16 +0530 Subject: [PATCH 03/23] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6ecf055..f948983 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,14 +5,14 @@ pipeline{ agent any environment { DOCKERHUB_REPO = "techcoms/backend-python" - GITHUB_URL = "${params.url}" - BRANCH = "${params.branch}" +// GITHUB_URL = "${params.url}" +// BRANCH = "${params.branch}" } stages{ stage("git checkout"){ steps{ - git branch: "${BRANCH}", credentialsId: 'github-creds', url: "${GITHUB_URL}" + git branch: "master", credentialsId: 'github-creds', url: "https://github.com/techcoms/backend-python.git" } } From c97f9398ecc6908e91114be262b7b5c7055938af Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Mon, 12 Dec 2022 13:34:29 +0530 Subject: [PATCH 04/23] Update Jenkinsfile --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f948983..b2a77cc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,6 +21,11 @@ pipeline{ sh "docker build -t ${DOCKERHUB_REPO}:${BUILD_NUMBER} ." } } + stage('run a docker container'){ + steps{ + sh "docker run -d -p 8088:5001 ${DOCKERHUB_REPO}:${BUILD_NUMBER}" + } + } stage("login to dockerhub and push image"){ steps { withCredentials([usernamePassword(credentialsId: 'dockerhub-creds', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) { From 9d465562ff525290495a474afd514b9862dd35d1 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Mon, 12 Dec 2022 13:40:38 +0530 Subject: [PATCH 05/23] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b2a77cc..615ffb9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,14 +5,14 @@ pipeline{ agent any environment { DOCKERHUB_REPO = "techcoms/backend-python" -// GITHUB_URL = "${params.url}" -// BRANCH = "${params.branch}" + GITHUB_URL = "${params.url}" + BRANCH = "${params.branch}" } stages{ stage("git checkout"){ steps{ - git branch: "master", credentialsId: 'github-creds', url: "https://github.com/techcoms/backend-python.git" + git branch: "${BRANCH}", credentialsId: 'github-creds', url: "${GITHUB_URL}" } } From 63e972c4e87751b9c09ab0a4d5cf9af1228b3a26 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 17:54:36 +0530 Subject: [PATCH 06/23] Refactor Jenkins pipeline stages and steps --- Jenkinsfile | 76 ++++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 615ffb9..09dbdfe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,46 +1,50 @@ -pipeline{ - options { - buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '6')) - } +pipeline { agent any - environment { - DOCKERHUB_REPO = "techcoms/backend-python" - GITHUB_URL = "${params.url}" - BRANCH = "${params.branch}" - - } - stages{ - stage("git checkout"){ - steps{ - git branch: "${BRANCH}", credentialsId: 'github-creds', url: "${GITHUB_URL}" + + stages { + + stage('Checkout') { + steps { + git url: 'https://github.com/techcoms/backend-python.git', branch:'feature' + } + } + + stage('Build Docker Image') { + steps { + sh "docker build -t yourdockerhub/myapp:latest ." } } - - stage("build docker image"){ + + stage('Push Docker Image') { steps { - sh "docker build -t ${DOCKERHUB_REPO}:${BUILD_NUMBER} ." + withCredentials([usernamePassword( + credentialsId: 'dockerhub-creds', + usernameVariable: 'USER', + passwordVariable: 'PASS' + )]) { + sh ''' + echo "$PASS" | docker login -u "$USER" --password-stdin + docker push techoms/myapp:latest + docker logout + ''' + } } } - stage('run a docker container'){ - steps{ - sh "docker run -d -p 8088:5001 ${DOCKERHUB_REPO}:${BUILD_NUMBER}" + + stage('Deploy with Ansible') { + steps { + withCredentials([sshUserPrivateKey( + credentialsId: 'deploy-ssh-key', + keyFileVariable: 'SSH_KEY', + usernameVariable: 'SSH_USER' + )]) { + sh """ + ansible-playbook -i ansible/inventory deploy.yml \ + --private-key ${SSH_KEY} -u ${SSH_USER} \ + --extra-vars "techcoms/myapp:latest" + """ } - } - stage("login to dockerhub and push image"){ - steps { - withCredentials([usernamePassword(credentialsId: 'dockerhub-creds', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) { - sh "docker login -u $USERNAME -p $PASSWORD " - sh "docker push ${DOCKERHUB_REPO}:${BUILD_NUMBER}" - - } - } - } - } - post{ - changed{ - mail to: "techcomsdevops@gmail.com", - subject: "jenkins build:${currentBuild.currentResult}: ${env.JOB_NAME}", - body: "${currentBuild.currentResult}: Job ${env.JOB_NAME}\nMore Info can be found here: ${env.BUILD_URL}" + } } } } From 5da0760ed510981f3d942fa3ad437beb2b6f3a7a Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 17:56:14 +0530 Subject: [PATCH 07/23] Create deploy.yml --- deploy.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 deploy.yml diff --git a/deploy.yml b/deploy.yml new file mode 100644 index 0000000..dca86f3 --- /dev/null +++ b/deploy.yml @@ -0,0 +1,22 @@ +--- +- name: Run Docker container on nodes + hosts: nodes + become: yes + + tasks: + + - name: Build Docker image locally + community.docker.docker_image: + name: sample-python-app + build: + path: /home/ec2-user/backend-python + source: build + + - name: Run Docker container + community.docker.docker_container: + name: simple-app + image: sample-python-app + state: started + restart_policy: always + published_ports: + - "5001:5001" From 86f7ac8376f5c28bc799670b4d1583b675de253c Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 18:14:58 +0530 Subject: [PATCH 08/23] Update Git checkout step with credentials --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 09dbdfe..61c2624 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { stage('Checkout') { steps { - git url: 'https://github.com/techcoms/backend-python.git', branch:'feature' + git url: 'https://github.com/techcoms/backend-python.git',credentialsId: 'github-creds', branch:'feature' } } From 105aacd057b1ceb8e6a9cfa518f3dcd6ef8a189f Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 18:23:23 +0530 Subject: [PATCH 09/23] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 61c2624..54074a5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { stage('Build Docker Image') { steps { - sh "docker build -t yourdockerhub/myapp:latest ." + sh "docker build -t techcoms/myapp:latest ." } } From bf617b9300c1dd51621f0a5bc8676266f5882445 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 18:30:56 +0530 Subject: [PATCH 10/23] Update Jenkinsfile --- Jenkinsfile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 54074a5..715bd45 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,13 +8,6 @@ pipeline { git url: 'https://github.com/techcoms/backend-python.git',credentialsId: 'github-creds', branch:'feature' } } - - stage('Build Docker Image') { - steps { - sh "docker build -t techcoms/myapp:latest ." - } - } - stage('Push Docker Image') { steps { withCredentials([usernamePassword( From 525d57f8f2e2a282a4b204505806b72d05d21265 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 18:31:44 +0530 Subject: [PATCH 11/23] Change Docker image name to techcoms/my-app Updated Docker image name in deployment configuration. --- deploy.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/deploy.yml b/deploy.yml index dca86f3..7f3666b 100644 --- a/deploy.yml +++ b/deploy.yml @@ -4,18 +4,11 @@ become: yes tasks: - - - name: Build Docker image locally - community.docker.docker_image: - name: sample-python-app - build: - path: /home/ec2-user/backend-python - source: build - name: Run Docker container community.docker.docker_container: name: simple-app - image: sample-python-app + image: techcoms/my-app state: started restart_policy: always published_ports: From 508462cc0bcdae69b1e1141950fc55126768ea94 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 18:35:36 +0530 Subject: [PATCH 12/23] Update Jenkinsfile --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 715bd45..282f2c0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,11 @@ pipeline { git url: 'https://github.com/techcoms/backend-python.git',credentialsId: 'github-creds', branch:'feature' } } + stage('Build Docker Image') { + steps { + sh "docker build -t techoms/myapp:latest ." + } + } stage('Push Docker Image') { steps { withCredentials([usernamePassword( From 1cf8bc61a876333ad7bd57b7157e5dc0bb0dd9c6 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:06:39 +0530 Subject: [PATCH 13/23] Update Jenkinsfile --- Jenkinsfile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 282f2c0..a196b0a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,21 +13,21 @@ pipeline { sh "docker build -t techoms/myapp:latest ." } } - stage('Push Docker Image') { - steps { - withCredentials([usernamePassword( - credentialsId: 'dockerhub-creds', - usernameVariable: 'USER', - passwordVariable: 'PASS' - )]) { - sh ''' - echo "$PASS" | docker login -u "$USER" --password-stdin - docker push techoms/myapp:latest - docker logout - ''' - } - } - } + // stage('Push Docker Image') { + // steps { + // withCredentials([usernamePassword( + // credentialsId: 'dockerhub-creds', + // usernameVariable: 'USER', + // passwordVariable: 'PASS' + // )]) { + // sh ''' + // echo "$PASS" | docker login -u "$USER" --password-stdin + // docker push techoms/myapp:latest + // docker logout + // ''' + // } + // } + // } stage('Deploy with Ansible') { steps { From ec18afe8f4dd49a5124022a4689bfa4b000fdf09 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:19:12 +0530 Subject: [PATCH 14/23] Update Jenkinsfile --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a196b0a..eaf4316 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,8 @@ pipeline { agent any + environment { + INVENTORY = "/home/ec2-user/ansible/inventory" + } stages { @@ -37,7 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh """ - ansible-playbook -i ansible/inventory deploy.yml \ + ansible-playbook -i ${INVENTORY} deploy.yml \ --private-key ${SSH_KEY} -u ${SSH_USER} \ --extra-vars "techcoms/myapp:latest" """ From 5e7baefd923dcdb71ca655b2e42fb2f8bb6a1c1d Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:22:02 +0530 Subject: [PATCH 15/23] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index eaf4316..75ae98f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - INVENTORY = "/home/ec2-user/ansible/inventory" + INVENTORY = "~/ansible/inventory " } stages { From 90d10f454903fe1faea17b73072acc707e358565 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:33:34 +0530 Subject: [PATCH 16/23] Update Jenkinsfile --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 75ae98f..3a87498 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,9 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh """ - ansible-playbook -i ${INVENTORY} deploy.yml \ - --private-key ${SSH_KEY} -u ${SSH_USER} \ - --extra-vars "techcoms/myapp:latest" + ansible-playbook -i ~/ansible/inventory deploy.yml -u ec2-user --private-key ~/.ssh/id_rsa_ansible """ } } From a9a19279dc6ac4e3ec98f385162ca1fa60f9cbf8 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:42:38 +0530 Subject: [PATCH 17/23] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3a87498..80e4064 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh """ - ansible-playbook -i ~/ansible/inventory deploy.yml -u ec2-user --private-key ~/.ssh/id_rsa_ansible + ansible-playbook -i /var/lib/jenkins/ansible/inventory deploy.yml --private-key ${KEYFILE} -u ${SSHUSER} """ } } From f2c8b4df561434ec5e46325b61ed383f049f4097 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:57:26 +0530 Subject: [PATCH 18/23] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 80e4064..0e68e57 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh """ - ansible-playbook -i /var/lib/jenkins/ansible/inventory deploy.yml --private-key ${KEYFILE} -u ${SSHUSER} + ansible-playbook -i ~/ansible/inventory deploy.yml -u ec2-user --private-key ~/.ssh/id_rsa_ansible """ } } From 4f724607025146acb2f67cfc54e3716181e9dcf6 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:59:21 +0530 Subject: [PATCH 19/23] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0e68e57..5d353e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,6 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh """ + ansible all -i ~/ansible/inventory -m ping ansible-playbook -i ~/ansible/inventory deploy.yml -u ec2-user --private-key ~/.ssh/id_rsa_ansible """ } From 74bb03cc4626495939f42f3ba05c02aae7bbe157 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 21:26:27 +0530 Subject: [PATCH 20/23] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5d353e0..bbf7551 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh """ - ansible all -i ~/ansible/inventory -m ping + ansible -u ec2-user all -i ~/ansible/inventory -m ping ansible-playbook -i ~/ansible/inventory deploy.yml -u ec2-user --private-key ~/.ssh/id_rsa_ansible """ } From d16e09bd11f3f67f14fa727fc557394f29208e8b Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 21:34:23 +0530 Subject: [PATCH 21/23] Update Jenkinsfile --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bbf7551..ca8b58d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - INVENTORY = "~/ansible/inventory " + INVENTORY = '/var/lib/jenkins/ansible/inventory' } stages { @@ -39,10 +39,10 @@ pipeline { keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER' )]) { - sh """ - ansible -u ec2-user all -i ~/ansible/inventory -m ping - ansible-playbook -i ~/ansible/inventory deploy.yml -u ec2-user --private-key ~/.ssh/id_rsa_ansible - """ + sh ''' + ansible -u "$SSH_USER" all -i "$INVENTORY" -m ping --private-key "$SSH_KEY" + ansible-playbook -i "$INVENTORY" deploy.yml -u "$SSH_USER" --private-key "$SSH_KEY" + ''' } } } From 58f7b059b53af83f50fcc1c52255cd3437c44c72 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 22:05:07 +0530 Subject: [PATCH 22/23] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ca8b58d..26baf37 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh ''' - ansible -u "$SSH_USER" all -i "$INVENTORY" -m ping --private-key "$SSH_KEY" + ansible all -i "$INVENTORY" -m ping --private-key "$SSH_KEY" ansible-playbook -i "$INVENTORY" deploy.yml -u "$SSH_USER" --private-key "$SSH_KEY" ''' } From fb7efed2290ea5397ec70a5baceb38b5e845eaa1 Mon Sep 17 00:00:00 2001 From: techcoms <120088252+techcoms@users.noreply.github.com> Date: Sun, 7 Dec 2025 22:24:17 +0530 Subject: [PATCH 23/23] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 26baf37..ea6deaa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { usernameVariable: 'SSH_USER' )]) { sh ''' - ansible all -i "$INVENTORY" -m ping --private-key "$SSH_KEY" + ansible nodes -i "$INVENTORY" -m ping --private-key "$SSH_KEY" ansible-playbook -i "$INVENTORY" deploy.yml -u "$SSH_USER" --private-key "$SSH_KEY" ''' }