<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hemanth B</title>
    <description>The latest articles on DEV Community by Hemanth B (@hemanth22).</description>
    <link>https://dev.to/hemanth22</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F99512%2Fb1b65ca1-e564-4977-bfb6-b8934e301374.jpeg</url>
      <title>DEV Community: Hemanth B</title>
      <link>https://dev.to/hemanth22</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hemanth22"/>
    <language>en</language>
    <item>
      <title>Jenkins deployment integration with HashiCorp Vault</title>
      <dc:creator>Hemanth B</dc:creator>
      <pubDate>Sat, 07 Jun 2025 05:31:02 +0000</pubDate>
      <link>https://dev.to/hemanth22/jenkins-deployment-integration-with-hashicorp-vault-3a7m</link>
      <guid>https://dev.to/hemanth22/jenkins-deployment-integration-with-hashicorp-vault-3a7m</guid>
      <description>&lt;p&gt;Hello Team,&lt;/p&gt;

&lt;p&gt;I’ve developed a Jenkins pipeline that integrates with HashiCorp Vault to securely retrieve passwords and deploy packages to a host using Ansible. This approach eliminates the need for a Jenkins node agent, streamlining the deployment process while maintaining security.&lt;/p&gt;

&lt;h2&gt;
  
  
  Password Storage in HashiCorp Vault
&lt;/h2&gt;

&lt;p&gt;In HashiCorp Vault, passwords are stored in a structured format that Jenkins can query dynamically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pipeline Workflow
&lt;/h2&gt;

&lt;p&gt;When provided with specific input parameters, Jenkins will:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Jenkins will download the required repository.&lt;/li&gt;
&lt;li&gt;Parse a &lt;code&gt;deploy.json&lt;/code&gt; file to extract deployment details.
Here’s an example of the &lt;code&gt;deploy.json&lt;/code&gt; file structure:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ipaddress"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"193.16.16.9"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bitra"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hostname"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"centos8"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"deploymentPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/home/bitra/apps/batch-jobs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"backupPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/home/bitra/backup/batch-jobs"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this JSON data, Jenkins generates a HashiCorp Vault object ID in the format:&lt;br&gt;
--&lt;br&gt;
For the above example, the object ID would be:&lt;br&gt;
193.16.16.9-bitra-centos8&lt;/p&gt;

&lt;p&gt;Jenkins then connects to HashiCorp Vault, retrieves the associated password using this object ID, and uses Ansible to perform the deployment.&lt;/p&gt;
&lt;h2&gt;
  
  
  Pipeline Execution
&lt;/h2&gt;

&lt;p&gt;Below is a sample output of the pipeline execution, illustrating how Jenkins interacts with HashiCorp Vault and executes the deployment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Started by user admin
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/Bitroid
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Initialization of Jenkins)
[Pipeline] sh
+ echo 'Initial step'
Initial step
+ ls
+ ls /var/lib/jenkins/workspace/Bitroid/
[Pipeline] echo
https://github.com/hemanth22/batch-jobs.git
[Pipeline] echo
releasev1
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Checkout SCM)
[Pipeline] script
[Pipeline] {
[Pipeline] echo
Checking out the source code
[Pipeline] checkout
The recommended git tool is: NONE
using credential 0411e51e-acca-411d-bdb4-f2d55b2549a1
Cloning the remote Git repository
Cloning repository https://github.com/hemanth22/batch-jobs.git
 &amp;gt; git init /var/lib/jenkins/workspace/Bitroid # timeout=10
Fetching upstream changes from https://github.com/hemanth22/batch-jobs.git
 &amp;gt; git --version # timeout=10
 &amp;gt; git --version # 'git version 2.43.5'
using GIT_ASKPASS to set credentials 
 &amp;gt; git fetch --tags --force --progress -- https://github.com/hemanth22/batch-jobs.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 &amp;gt; git config remote.origin.url https://github.com/hemanth22/batch-jobs.git # timeout=10
 &amp;gt; git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
 &amp;gt; git rev-parse origin/releasev1^{commit} # timeout=10
Checking out Revision 0a6a3b6908190dc25c326364f960372d1e7c9167 (origin/releasev1)
 &amp;gt; git config core.sparsecheckout # timeout=10
 &amp;gt; git checkout -f 0a6a3b6908190dc25c326364f960372d1e7c9167 # timeout=10
Commit message: "feat: change user"
 &amp;gt; git rev-list --no-walk 0a6a3b6908190dc25c326364f960372d1e7c9167 # timeout=10
[Pipeline] sh
+ git log -1 --format=%cd --date=iso
[Pipeline] echo
scmData.GIT_BRANCH=origin/releasev1
[Pipeline] echo
scmData.GIT_COMMIT=0a6a3b6908190dc25c326364f960372d1e7c9167
[Pipeline] echo
scmData.GIT_URL=https://github.com/hemanth22/batch-jobs.git
[Pipeline] sh
+ git rev-parse --short HEAD
[Pipeline] echo
Build Version: 6_0a6a3b6
[Pipeline] checkout
The recommended git tool is: NONE
using credential 0411e51e-acca-411d-bdb4-f2d55b2549a1
Cloning the remote Git repository
Cloning repository https://github.com/hemanth22/pipeline-studio.git
 &amp;gt; git init /var/lib/jenkins/workspace/Bitroid/pipeline # timeout=10
Fetching upstream changes from https://github.com/hemanth22/pipeline-studio.git
 &amp;gt; git --version # timeout=10
 &amp;gt; git --version # 'git version 2.43.5'
using GIT_ASKPASS to set credentials 
 &amp;gt; git fetch --tags --force --progress -- https://github.com/hemanth22/pipeline-studio.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 &amp;gt; git config remote.origin.url https://github.com/hemanth22/pipeline-studio.git # timeout=10
 &amp;gt; git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
 &amp;gt; git rev-parse origin/main^{commit} # timeout=10
Checking out Revision b83d505b09d779238b90ff841aa3c952148782e5 (origin/main)
 &amp;gt; git config core.sparsecheckout # timeout=10
 &amp;gt; git checkout -f b83d505b09d779238b90ff841aa3c952148782e5 # timeout=10
Commit message: "Update deploy.playbook"
 &amp;gt; git rev-list --no-walk b83d505b09d779238b90ff841aa3c952148782e5 # timeout=10
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Parse Deploy JSON and Set Env Vars)
[Pipeline] script
[Pipeline] {
[Pipeline] echo
Set environment variable: 193_16_16_9-bitra-centos8=193.16.16.9-bitra-centos8
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Retrive secrets from vault)
[Pipeline] script
[Pipeline] {
[Pipeline] sh
+ vault login -method=userpass username=hemanth password=bitra
Success! You are now authenticated. The token information displayed below
is already stored in the token helper. You do NOT need to run "vault login"
again. Future Vault requests will automatically use this token.

Key                    Value
---                    -----
token                  hvs.CAESILsgc5b2BAEz9PXicYSBb2o7ZVg-cEpRXAQzNoRx3MWqGh4KHGh2cy53MEp0SVc2VVB5Q29kQUhVZjlXamVCNlo
token_accessor         QLXV3OdG9INVRzsNWSGBNMZV
token_duration         768h
token_renewable        true
token_policies         ["default" "hemanth-read-only"]
identity_policies      []
policies               ["default" "hemanth-read-only"]
token_meta_username    hemanth
[Pipeline] sh
+ vault kv get -field=password secret/PRD_VM_LINUX_APP/193.16.16.9-bitra-centos8
[Pipeline] echo
Retrieved secret: hemanth
[Pipeline] echo
Retrieved secret and set as GLOBAL_SECRET: hemanth
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Archive)
[Pipeline] sh
+ cd /var/lib/jenkins/workspace/Bitroid/
+ zip -v -9 archive.zip healthcheck.sh checkspace.sh
  adding: healthcheck.sh (in=828) (out=346) (deflated 58%)
  adding: checkspace.sh (in=281) (out=90) (deflated 68%)
total bytes=1109, compressed=436 -&amp;gt; 61% savings
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy)
[Pipeline] echo
Object ID: 193.16.16.9-bitra-centos8
[Pipeline] echo
Deploying project. Last commit date: 2025-01-22 14:26:13 +0530
[Pipeline] sh
+ ls /var/lib/jenkins/workspace/Bitroid/
archive.zip
checkspace.sh
deploy.json
healthcheck.sh
pipeline
pipeline@tmp
README.md
secret_filename.json
+ echo =================================================
=================================================
+ ls /var/lib/jenkins/workspace/Bitroid/pipeline/BIT
deploy.playbook
set_env_vars.py
+ echo =================================================
=================================================
+ cp -v /var/lib/jenkins/workspace/Bitroid/pipeline/BIT/deploy.playbook /var/lib/jenkins/workspace/Bitroid
'/var/lib/jenkins/workspace/Bitroid/pipeline/BIT/deploy.playbook' -&amp;gt; '/var/lib/jenkins/workspace/Bitroid/deploy.playbook'
+ echo =================================================
=================================================
+ ls /var/lib/jenkins/workspace/Bitroid/
archive.zip
checkspace.sh
deploy.json
deploy.playbook
healthcheck.sh
pipeline
pipeline@tmp
README.md
secret_filename.json
+ echo =================================================
=================================================
[Pipeline] sh
+ ansible-playbook -vvvvv deploy.playbook -e ansible_become_pass=hemanth
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
ansible-playbook [core 2.18.1]
  config file = None
  configured module search path = ['/var/lib/jenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.12/site-packages/ansible
  ansible collection location = /var/lib/jenkins/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.12.5 (main, Dec  3 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (/usr/bin/python3.12)
  jinja version = 3.1.4
  libyaml = True
No config file found; using defaults
setting up inventory plugins
Loading collection ansible.builtin from 
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.12/site-packages/ansible/plugins/callback/default.py
Attempting to use 'default' callback.
Skipping callback 'default', as we already have a stdout callback.
Attempting to use 'junit' callback.
Attempting to use 'minimal' callback.
Skipping callback 'minimal', as we already have a stdout callback.
Attempting to use 'oneline' callback.
Skipping callback 'oneline', as we already have a stdout callback.
Attempting to use 'tree' callback.

PLAYBOOK: deploy.playbook ******************************************************
Positional arguments: deploy.playbook
verbosity: 5
connection: ssh
become_method: sudo
tags: ('all',)
inventory: ('/etc/ansible/hosts',)
extra_vars: ('ansible_become_pass=hemanth',)
forks: 5
2 plays in deploy.playbook

PLAY [Read username from deploy.json and use it for all tasks] *****************

TASK [Read the deploy.json file] ***********************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:6
looking for "deploy.json" at "/var/lib/jenkins/workspace/Bitroid/files/deploy.json"
looking for "deploy.json" at "/var/lib/jenkins/workspace/Bitroid/deploy.json"
File lookup using /var/lib/jenkins/workspace/Bitroid/deploy.json as file
ok: [localhost] =&amp;gt; {
    "ansible_facts": {
        "deploy_data": {
            "backupPath": "/home/bitra/backup/batch-jobs",
            "deploymentPath": "/home/bitra/apps/batch-jobs",
            "hostname": "centos8",
            "ipaddress": "193.16.16.9",
            "username": "bitra"
        }
    },
    "changed": false
}

TASK [Extract username] ********************************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:11
ok: [localhost] =&amp;gt; {
    "ansible_facts": {
        "deploy_username": "bitra"
    },
    "changed": false
}

TASK [Extract deploymentPath and backupPath] ***********************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:15
ok: [localhost] =&amp;gt; {
    "ansible_facts": {
        "backup_path": "/home/bitra/backup/batch-jobs",
        "deployment_path": "/home/bitra/apps/batch-jobs"
    },
    "changed": false
}

PLAY [Execute tasks as the extracted user] *************************************

TASK [Display the username] ****************************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:26
ok: [localhost] =&amp;gt; {
    "msg": "Running tasks as user: bitra"
}

TASK [Display backupPath] ******************************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:30
ok: [localhost] =&amp;gt; {
    "msg": "Backup Path: /home/bitra/backup/batch-jobs"
}

TASK [Display deploymentPath] **************************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:34
ok: [localhost] =&amp;gt; {
    "msg": "Deployment Path: /home/bitra/apps/batch-jobs"
}

TASK [Ensure deployment directory exists] **************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:38
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791468.711033-8335-94198148038812 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791468.711033-8335-94198148038812="` echo /var/tmp/ansible-tmp-1737791468.711033-8335-94198148038812 `" ) &amp;amp;&amp;amp; sleep 0'
Including module_utils file ansible/__init__.py
Including module_utils file ansible/module_utils/__init__.py
Including module_utils file ansible/module_utils/basic.py
Including module_utils file ansible/module_utils/_text.py
Including module_utils file ansible/module_utils/common/_utils.py
Including module_utils file ansible/module_utils/common/__init__.py
Including module_utils file ansible/module_utils/common/arg_spec.py
Including module_utils file ansible/module_utils/common/file.py
Including module_utils file ansible/module_utils/common/locale.py
Including module_utils file ansible/module_utils/common/parameters.py
Including module_utils file ansible/module_utils/common/collections.py
Including module_utils file ansible/module_utils/common/process.py
Including module_utils file ansible/module_utils/common/sys_info.py
Including module_utils file ansible/module_utils/common/text/converters.py
Including module_utils file ansible/module_utils/common/text/__init__.py
Including module_utils file ansible/module_utils/common/text/formatters.py
Including module_utils file ansible/module_utils/common/validation.py
Including module_utils file ansible/module_utils/common/warnings.py
Including module_utils file ansible/module_utils/compat/selinux.py
Including module_utils file ansible/module_utils/compat/__init__.py
Including module_utils file ansible/module_utils/distro/__init__.py
Including module_utils file ansible/module_utils/distro/_distro.py
Including module_utils file ansible/module_utils/errors.py
Including module_utils file ansible/module_utils/parsing/convert_bool.py
Including module_utils file ansible/module_utils/parsing/__init__.py
Including module_utils file ansible/module_utils/pycompat24.py
Including module_utils file ansible/module_utils/six/__init__.py
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/file.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmp7k1pdsef TO /var/tmp/ansible-tmp-1737791468.711033-8335-94198148038812/AnsiballZ_file.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791468.711033-8335-94198148038812/ /var/tmp/ansible-tmp-1737791468.711033-8335-94198148038812/AnsiballZ_file.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=duzhrazqjvsednihbkcxkcfevsttcomt] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-duzhrazqjvsednihbkcxkcfevsttcomt ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791468.711033-8335-94198148038812/AnsiballZ_file.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791468.711033-8335-94198148038812/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "diff": {
        "after": {
            "path": "/home/bitra/apps/batch-jobs",
            "state": "directory"
        },
        "before": {
            "path": "/home/bitra/apps/batch-jobs",
            "state": "absent"
        }
    },
    "gid": 1001,
    "group": "bitra",
    "invocation": {
        "module_args": {
            "_diff_peek": null,
            "_original_basename": null,
            "access_time": null,
            "access_time_format": "%Y%m%d%H%M.%S",
            "attributes": null,
            "follow": true,
            "force": false,
            "group": null,
            "mode": null,
            "modification_time": null,
            "modification_time_format": "%Y%m%d%H%M.%S",
            "owner": null,
            "path": "/home/bitra/apps/batch-jobs",
            "recurse": true,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": null,
            "state": "directory",
            "unsafe_writes": false
        }
    },
    "mode": "0755",
    "owner": "bitra",
    "path": "/home/bitra/apps/batch-jobs",
    "secontext": "system_u:object_r:user_home_t:s0",
    "size": 6,
    "state": "directory",
    "uid": 1001
}

TASK [Ensure backup directory exists] ******************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:44
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791469.8975558-8375-28902586999237 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791469.8975558-8375-28902586999237="` echo /var/tmp/ansible-tmp-1737791469.8975558-8375-28902586999237 `" ) &amp;amp;&amp;amp; sleep 0'
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/file.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpce4_50t8 TO /var/tmp/ansible-tmp-1737791469.8975558-8375-28902586999237/AnsiballZ_file.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791469.8975558-8375-28902586999237/ /var/tmp/ansible-tmp-1737791469.8975558-8375-28902586999237/AnsiballZ_file.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=rjxafcsntawsucjldrodjcmatocpzgbs] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-rjxafcsntawsucjldrodjcmatocpzgbs ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791469.8975558-8375-28902586999237/AnsiballZ_file.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791469.8975558-8375-28902586999237/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "diff": {
        "after": {
            "path": "/home/bitra/backup/batch-jobs",
            "state": "directory"
        },
        "before": {
            "path": "/home/bitra/backup/batch-jobs",
            "state": "absent"
        }
    },
    "gid": 1001,
    "group": "bitra",
    "invocation": {
        "module_args": {
            "_diff_peek": null,
            "_original_basename": null,
            "access_time": null,
            "access_time_format": "%Y%m%d%H%M.%S",
            "attributes": null,
            "follow": true,
            "force": false,
            "group": null,
            "mode": null,
            "modification_time": null,
            "modification_time_format": "%Y%m%d%H%M.%S",
            "owner": null,
            "path": "/home/bitra/backup/batch-jobs",
            "recurse": true,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": null,
            "state": "directory",
            "unsafe_writes": false
        }
    },
    "mode": "0755",
    "owner": "bitra",
    "path": "/home/bitra/backup/batch-jobs",
    "secontext": "system_u:object_r:user_home_t:s0",
    "size": 6,
    "state": "directory",
    "uid": 1001
}

TASK [Create backup folder in backupPath] **************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:50
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791470.7729065-8396-148604401664756 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791470.7729065-8396-148604401664756="` echo /var/tmp/ansible-tmp-1737791470.7729065-8396-148604401664756 `" ) &amp;amp;&amp;amp; sleep 0'
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/file.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmp3a8_4d7a TO /var/tmp/ansible-tmp-1737791470.7729065-8396-148604401664756/AnsiballZ_file.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791470.7729065-8396-148604401664756/ /var/tmp/ansible-tmp-1737791470.7729065-8396-148604401664756/AnsiballZ_file.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=baaslqvhdgdbmnsmahzpotmxeulgdoru] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-baaslqvhdgdbmnsmahzpotmxeulgdoru ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791470.7729065-8396-148604401664756/AnsiballZ_file.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791470.7729065-8396-148604401664756/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "diff": {
        "after": {
            "path": "/home/bitra/backup/batch-jobs/6_0a6a3b6",
            "state": "directory"
        },
        "before": {
            "path": "/home/bitra/backup/batch-jobs/6_0a6a3b6",
            "state": "absent"
        }
    },
    "gid": 1001,
    "group": "bitra",
    "invocation": {
        "module_args": {
            "_diff_peek": null,
            "_original_basename": null,
            "access_time": null,
            "access_time_format": "%Y%m%d%H%M.%S",
            "attributes": null,
            "follow": true,
            "force": false,
            "group": null,
            "mode": null,
            "modification_time": null,
            "modification_time_format": "%Y%m%d%H%M.%S",
            "owner": null,
            "path": "/home/bitra/backup/batch-jobs/6_0a6a3b6",
            "recurse": false,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": null,
            "state": "directory",
            "unsafe_writes": false
        }
    },
    "mode": "0755",
    "owner": "bitra",
    "path": "/home/bitra/backup/batch-jobs/6_0a6a3b6",
    "secontext": "system_u:object_r:user_home_t:s0",
    "size": 6,
    "state": "directory",
    "uid": 1001
}

TASK [Taking backup before deployment] *****************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:55
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791471.420877-8416-139413731791690 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791471.420877-8416-139413731791690="` echo /var/tmp/ansible-tmp-1737791471.420877-8416-139413731791690 `" ) &amp;amp;&amp;amp; sleep 0'
Including module_utils file ansible/__init__.py
Including module_utils file ansible/module_utils/__init__.py
Including module_utils file ansible/module_utils/basic.py
Including module_utils file ansible/module_utils/_text.py
Including module_utils file ansible/module_utils/common/_utils.py
Including module_utils file ansible/module_utils/common/__init__.py
Including module_utils file ansible/module_utils/common/arg_spec.py
Including module_utils file ansible/module_utils/common/file.py
Including module_utils file ansible/module_utils/common/locale.py
Including module_utils file ansible/module_utils/common/parameters.py
Including module_utils file ansible/module_utils/common/collections.py
Including module_utils file ansible/module_utils/common/process.py
Including module_utils file ansible/module_utils/common/sys_info.py
Including module_utils file ansible/module_utils/common/text/converters.py
Including module_utils file ansible/module_utils/common/text/__init__.py
Including module_utils file ansible/module_utils/common/text/formatters.py
Including module_utils file ansible/module_utils/common/validation.py
Including module_utils file ansible/module_utils/common/warnings.py
Including module_utils file ansible/module_utils/compat/selinux.py
Including module_utils file ansible/module_utils/compat/__init__.py
Including module_utils file ansible/module_utils/distro/__init__.py
Including module_utils file ansible/module_utils/distro/_distro.py
Including module_utils file ansible/module_utils/errors.py
Including module_utils file ansible/module_utils/parsing/convert_bool.py
Including module_utils file ansible/module_utils/parsing/__init__.py
Including module_utils file ansible/module_utils/pycompat24.py
Including module_utils file ansible/module_utils/six/__init__.py
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/copy.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpv3_qet4l TO /var/tmp/ansible-tmp-1737791471.420877-8416-139413731791690/AnsiballZ_copy.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791471.420877-8416-139413731791690/ /var/tmp/ansible-tmp-1737791471.420877-8416-139413731791690/AnsiballZ_copy.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=awpsixjfxcduyzlnyyossqkfzpgacgjf] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-awpsixjfxcduyzlnyyossqkfzpgacgjf ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791471.420877-8416-139413731791690/AnsiballZ_copy.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791471.420877-8416-139413731791690/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "checksum": null,
    "dest": "/home/bitra/backup/batch-jobs/6_0a6a3b6/batch-jobs",
    "gid": 1001,
    "group": "bitra",
    "invocation": {
        "module_args": {
            "_original_basename": null,
            "attributes": null,
            "backup": false,
            "checksum": null,
            "content": null,
            "dest": "/home/bitra/backup/batch-jobs/6_0a6a3b6",
            "directory_mode": null,
            "follow": false,
            "force": true,
            "group": null,
            "local_follow": null,
            "mode": null,
            "owner": null,
            "remote_src": true,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "/home/bitra/apps/batch-jobs",
            "unsafe_writes": false,
            "validate": null
        }
    },
    "md5sum": null,
    "mode": "0755",
    "owner": "bitra",
    "secontext": "system_u:object_r:user_home_t:s0",
    "size": 6,
    "src": "/home/bitra/apps/batch-jobs",
    "state": "directory",
    "uid": 1001
}

TASK [Copy archive.zip to the deployment path] *********************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:61
&amp;lt;localhost&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791472.580123-8436-162623729629536="` echo /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536 `" ) &amp;amp;&amp;amp; sleep 0'
Including module_utils file ansible/__init__.py
Including module_utils file ansible/module_utils/__init__.py
Including module_utils file ansible/module_utils/basic.py
Including module_utils file ansible/module_utils/_text.py
Including module_utils file ansible/module_utils/common/_utils.py
Including module_utils file ansible/module_utils/common/__init__.py
Including module_utils file ansible/module_utils/common/arg_spec.py
Including module_utils file ansible/module_utils/common/file.py
Including module_utils file ansible/module_utils/common/locale.py
Including module_utils file ansible/module_utils/common/parameters.py
Including module_utils file ansible/module_utils/common/collections.py
Including module_utils file ansible/module_utils/common/process.py
Including module_utils file ansible/module_utils/common/sys_info.py
Including module_utils file ansible/module_utils/common/text/converters.py
Including module_utils file ansible/module_utils/common/text/__init__.py
Including module_utils file ansible/module_utils/common/text/formatters.py
Including module_utils file ansible/module_utils/common/validation.py
Including module_utils file ansible/module_utils/common/warnings.py
Including module_utils file ansible/module_utils/compat/selinux.py
Including module_utils file ansible/module_utils/compat/__init__.py
Including module_utils file ansible/module_utils/distro/__init__.py
Including module_utils file ansible/module_utils/distro/_distro.py
Including module_utils file ansible/module_utils/errors.py
Including module_utils file ansible/module_utils/parsing/convert_bool.py
Including module_utils file ansible/module_utils/parsing/__init__.py
Including module_utils file ansible/module_utils/pycompat24.py
Including module_utils file ansible/module_utils/six/__init__.py
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/stat.py
&amp;lt;localhost&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpl8efrz28 TO /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/AnsiballZ_stat.py
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/ /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/AnsiballZ_stat.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=omvlahtjkltvhrhoywxkajqdcwgkgyfs] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-omvlahtjkltvhrhoywxkajqdcwgkgyfs ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/AnsiballZ_stat.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;localhost&amp;gt; PUT /var/lib/jenkins/workspace/Bitroid/archive.zip TO /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/.source.zip
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/ /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/.source.zip &amp;amp;&amp;amp; sleep 0'
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/copy.py
&amp;lt;localhost&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmp7ulbmu3s TO /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/AnsiballZ_copy.py
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/ /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/AnsiballZ_copy.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=lipwnrxztrlbzcliaurgnzwqngnfqeck] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-lipwnrxztrlbzcliaurgnzwqngnfqeck ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/AnsiballZ_copy.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;localhost&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "checksum": "8e4dcb0b9e8ef8a5098a2e17864d4f047227f144",
    "dest": "/home/bitra/apps/batch-jobs/archive.zip",
    "diff": [],
    "gid": 1001,
    "group": "bitra",
    "invocation": {
        "module_args": {
            "_original_basename": "archive.zip",
            "attributes": null,
            "backup": false,
            "checksum": "8e4dcb0b9e8ef8a5098a2e17864d4f047227f144",
            "content": null,
            "dest": "/home/bitra/apps/batch-jobs/archive.zip",
            "directory_mode": null,
            "follow": false,
            "force": true,
            "group": null,
            "local_follow": null,
            "mode": null,
            "owner": null,
            "remote_src": null,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "/var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/.source.zip",
            "unsafe_writes": false,
            "validate": null
        }
    },
    "md5sum": "dfc3a497e216f92713b75000a0b7cf99",
    "mode": "0644",
    "owner": "bitra",
    "secontext": "unconfined_u:object_r:user_home_t:s0",
    "size": 768,
    "src": "/var/tmp/ansible-tmp-1737791472.580123-8436-162623729629536/.source.zip",
    "state": "file",
    "uid": 1001
}

TASK [Unzip archive.zip in the deployment path] ********************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:67
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791473.9230413-8463-224736034219024="` echo /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024 `" ) &amp;amp;&amp;amp; sleep 0'
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/stat.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpfdrwi4ny TO /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/AnsiballZ_stat.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/ /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/AnsiballZ_stat.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=gtbypymgvzryymyyclttaitfiopztqnf] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-gtbypymgvzryymyyclttaitfiopztqnf ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/AnsiballZ_stat.py'"'"' &amp;amp;&amp;amp; sleep 0'
Including module_utils file ansible/__init__.py
Including module_utils file ansible/module_utils/__init__.py
Including module_utils file ansible/module_utils/basic.py
Including module_utils file ansible/module_utils/_text.py
Including module_utils file ansible/module_utils/common/_utils.py
Including module_utils file ansible/module_utils/common/__init__.py
Including module_utils file ansible/module_utils/common/arg_spec.py
Including module_utils file ansible/module_utils/common/file.py
Including module_utils file ansible/module_utils/common/locale.py
Including module_utils file ansible/module_utils/common/parameters.py
Including module_utils file ansible/module_utils/common/collections.py
Including module_utils file ansible/module_utils/common/process.py
Including module_utils file ansible/module_utils/common/sys_info.py
Including module_utils file ansible/module_utils/common/text/converters.py
Including module_utils file ansible/module_utils/common/text/__init__.py
Including module_utils file ansible/module_utils/common/text/formatters.py
Including module_utils file ansible/module_utils/common/validation.py
Including module_utils file ansible/module_utils/common/warnings.py
Including module_utils file ansible/module_utils/compat/selinux.py
Including module_utils file ansible/module_utils/compat/__init__.py
Including module_utils file ansible/module_utils/distro/__init__.py
Including module_utils file ansible/module_utils/distro/_distro.py
Including module_utils file ansible/module_utils/errors.py
Including module_utils file ansible/module_utils/parsing/convert_bool.py
Including module_utils file ansible/module_utils/parsing/__init__.py
Including module_utils file ansible/module_utils/pycompat24.py
Including module_utils file ansible/module_utils/six/__init__.py
Including module_utils file ansible/module_utils/urls.py
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/unarchive.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpcn47g6ck TO /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/AnsiballZ_unarchive.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/ /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/AnsiballZ_unarchive.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=mlgvxhvyozjbqcxjepfpdhmknjkwelln] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-mlgvxhvyozjbqcxjepfpdhmknjkwelln ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/AnsiballZ_unarchive.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791473.9230413-8463-224736034219024/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "dest": "/home/bitra/apps/batch-jobs",
    "diff": {
        "prepared": "&amp;gt;f++++++.?? healthcheck.sh\n&amp;gt;f++++++.?? checkspace.sh\n"
    },
    "extract_results": {
        "cmd": [
            "/bin/unzip",
            "-o",
            "/home/bitra/apps/batch-jobs/archive.zip",
            "-d",
            "/home/bitra/apps/batch-jobs"
        ],
        "err": "",
        "out": "Archive:  /home/bitra/apps/batch-jobs/archive.zip\n  inflating: /home/bitra/apps/batch-jobs/healthcheck.sh  \n  inflating: /home/bitra/apps/batch-jobs/checkspace.sh  \n",
        "rc": 0
    },
    "gid": 1001,
    "group": "bitra",
    "handler": "ZipArchive",
    "invocation": {
        "module_args": {
            "attributes": null,
            "copy": true,
            "creates": null,
            "decrypt": true,
            "dest": "/home/bitra/apps/batch-jobs",
            "exclude": [],
            "extra_opts": [],
            "group": null,
            "include": [],
            "io_buffer_size": 65536,
            "keep_newer": false,
            "list_files": false,
            "mode": null,
            "owner": null,
            "remote_src": true,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "/home/bitra/apps/batch-jobs/archive.zip",
            "unsafe_writes": false,
            "validate_certs": true
        }
    },
    "mode": "0755",
    "owner": "bitra",
    "secontext": "system_u:object_r:user_home_t:s0",
    "size": 68,
    "src": "/home/bitra/apps/batch-jobs/archive.zip",
    "state": "directory",
    "uid": 1001
}

TASK [Remove archive.zip after extraction] *************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:73
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791475.6690176-8491-203868210961988 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791475.6690176-8491-203868210961988="` echo /var/tmp/ansible-tmp-1737791475.6690176-8491-203868210961988 `" ) &amp;amp;&amp;amp; sleep 0'
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/file.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpfzfio98l TO /var/tmp/ansible-tmp-1737791475.6690176-8491-203868210961988/AnsiballZ_file.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791475.6690176-8491-203868210961988/ /var/tmp/ansible-tmp-1737791475.6690176-8491-203868210961988/AnsiballZ_file.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=pkkrvjehqcijdaafqflyhwctjxauagpx] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-pkkrvjehqcijdaafqflyhwctjxauagpx ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791475.6690176-8491-203868210961988/AnsiballZ_file.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791475.6690176-8491-203868210961988/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "diff": {
        "after": {
            "path": "/home/bitra/apps/batch-jobs/archive.zip",
            "state": "absent"
        },
        "before": {
            "path": "/home/bitra/apps/batch-jobs/archive.zip",
            "state": "file"
        }
    },
    "invocation": {
        "module_args": {
            "_diff_peek": null,
            "_original_basename": null,
            "access_time": null,
            "access_time_format": "%Y%m%d%H%M.%S",
            "attributes": null,
            "follow": true,
            "force": false,
            "group": null,
            "mode": null,
            "modification_time": null,
            "modification_time_format": "%Y%m%d%H%M.%S",
            "owner": null,
            "path": "/home/bitra/apps/batch-jobs/archive.zip",
            "recurse": false,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": null,
            "state": "absent",
            "unsafe_writes": false
        }
    },
    "path": "/home/bitra/apps/batch-jobs/archive.zip",
    "state": "absent"
}

TASK [Set execute permissions on checkspace.sh and healthcheck.sh] *************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:78
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791476.282747-8508-202932323902923 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791476.282747-8508-202932323902923="` echo /var/tmp/ansible-tmp-1737791476.282747-8508-202932323902923 `" ) &amp;amp;&amp;amp; sleep 0'
Including module_utils file ansible/__init__.py
Including module_utils file ansible/module_utils/__init__.py
Including module_utils file ansible/module_utils/basic.py
Including module_utils file ansible/module_utils/_text.py
Including module_utils file ansible/module_utils/common/_utils.py
Including module_utils file ansible/module_utils/common/__init__.py
Including module_utils file ansible/module_utils/common/arg_spec.py
Including module_utils file ansible/module_utils/common/collections.py
Including module_utils file ansible/module_utils/common/file.py
Including module_utils file ansible/module_utils/common/locale.py
Including module_utils file ansible/module_utils/common/parameters.py
Including module_utils file ansible/module_utils/common/process.py
Including module_utils file ansible/module_utils/common/sys_info.py
Including module_utils file ansible/module_utils/common/text/converters.py
Including module_utils file ansible/module_utils/common/text/__init__.py
Including module_utils file ansible/module_utils/common/text/formatters.py
Including module_utils file ansible/module_utils/common/validation.py
Including module_utils file ansible/module_utils/common/warnings.py
Including module_utils file ansible/module_utils/compat/selinux.py
Including module_utils file ansible/module_utils/compat/__init__.py
Including module_utils file ansible/module_utils/distro/__init__.py
Including module_utils file ansible/module_utils/distro/_distro.py
Including module_utils file ansible/module_utils/errors.py
Including module_utils file ansible/module_utils/parsing/convert_bool.py
Including module_utils file ansible/module_utils/parsing/__init__.py
Including module_utils file ansible/module_utils/pycompat24.py
Including module_utils file ansible/module_utils/six/__init__.py
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/command.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpmh4t5qxx TO /var/tmp/ansible-tmp-1737791476.282747-8508-202932323902923/AnsiballZ_command.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791476.282747-8508-202932323902923/ /var/tmp/ansible-tmp-1737791476.282747-8508-202932323902923/AnsiballZ_command.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=qjtyozfcxibbtdemehgoabfumvpkxyas] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-qjtyozfcxibbtdemehgoabfumvpkxyas ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791476.282747-8508-202932323902923/AnsiballZ_command.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791476.282747-8508-202932323902923/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "cmd": "chmod 755 checkspace.sh healthcheck.sh\n",
    "delta": "0:00:00.027129",
    "end": "2025-01-25 07:51:17.011779",
    "invocation": {
        "module_args": {
            "_raw_params": "chmod 755 checkspace.sh healthcheck.sh\n",
            "_uses_shell": true,
            "argv": null,
            "chdir": "/home/bitra/apps/batch-jobs",
            "creates": null,
            "executable": "/bin/bash",
            "expand_argument_vars": true,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true
        }
    },
    "msg": "",
    "rc": 0,
    "start": "2025-01-25 07:51:16.984650",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "",
    "stdout_lines": []
}

TASK [Execute healthcheck.sh script] *******************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:85
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791477.1430771-8528-262889491615249 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791477.1430771-8528-262889491615249="` echo /var/tmp/ansible-tmp-1737791477.1430771-8528-262889491615249 `" ) &amp;amp;&amp;amp; sleep 0'
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/command.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmpqj2bvtew TO /var/tmp/ansible-tmp-1737791477.1430771-8528-262889491615249/AnsiballZ_command.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791477.1430771-8528-262889491615249/ /var/tmp/ansible-tmp-1737791477.1430771-8528-262889491615249/AnsiballZ_command.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=sinemorgugkdyuicsrkuacdmabtgyjax] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-sinemorgugkdyuicsrkuacdmabtgyjax ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791477.1430771-8528-262889491615249/AnsiballZ_command.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791477.1430771-8528-262889491615249/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "cmd": [
        "sh",
        "healthcheck.sh"
    ],
    "delta": "0:00:00.098729",
    "end": "2025-01-25 07:51:17.634513",
    "invocation": {
        "module_args": {
            "_raw_params": "sh healthcheck.sh",
            "_uses_shell": false,
            "argv": null,
            "chdir": "/home/bitra/apps/batch-jobs",
            "creates": null,
            "executable": null,
            "expand_argument_vars": true,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true
        }
    },
    "msg": "",
    "rc": 0,
    "start": "2025-01-25 07:51:17.535784",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "\n\n\u001b[1;34m*******************\u001b[0m\n\u001b[1;34m*\u001b[0m App Healthcheck \u001b[1;34m*\u001b[0m\n\u001b[1;34m*******************\u001b[0m\n\n[Services]\n\u001b[0;31m[Container]\t\t podman Not OK\u001b[0m\n\u001b[0;31m[Container]\t\t vscode Not OK\u001b[0m\n\u001b[0;32m[Container]\t\t vault OK\u001b[0m",
    "stdout_lines": [
        "",
        "",
        "\u001b[1;34m*******************\u001b[0m",
        "\u001b[1;34m*\u001b[0m App Healthcheck \u001b[1;34m*\u001b[0m",
        "\u001b[1;34m*******************\u001b[0m",
        "",
        "[Services]",
        "\u001b[0;31m[Container]\t\t podman Not OK\u001b[0m",
        "\u001b[0;31m[Container]\t\t vscode Not OK\u001b[0m",
        "\u001b[0;32m[Container]\t\t vault OK\u001b[0m"
    ]
}

TASK [Execute checkspace.sh script] ********************************************
task path: /var/lib/jenkins/workspace/Bitroid/deploy.playbook:90
&amp;lt;127.0.0.1&amp;gt; ESTABLISH LOCAL CONNECTION FOR USER: jenkins
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'echo ~jenkins &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c '( umask 77 &amp;amp;&amp;amp; mkdir -p "` echo /var/tmp `"&amp;amp;&amp;amp; mkdir "` echo /var/tmp/ansible-tmp-1737791477.7906954-8564-162420420268825 `" &amp;amp;&amp;amp; echo ansible-tmp-1737791477.7906954-8564-162420420268825="` echo /var/tmp/ansible-tmp-1737791477.7906954-8564-162420420268825 `" ) &amp;amp;&amp;amp; sleep 0'
Using module file /usr/local/lib/python3.12/site-packages/ansible/modules/command.py
&amp;lt;127.0.0.1&amp;gt; PUT /var/lib/jenkins/.ansible/tmp/ansible-local-8322c8bps25m/tmp8j3jwjre TO /var/tmp/ansible-tmp-1737791477.7906954-8564-162420420268825/AnsiballZ_command.py
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'setfacl -m u:bitra:r-x /var/tmp/ansible-tmp-1737791477.7906954-8564-162420420268825/ /var/tmp/ansible-tmp-1737791477.7906954-8564-162420420268825/AnsiballZ_command.py &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=bmrjxwskahxzmdntdwyehqbmvzmxspdt] password:" -u bitra /bin/sh -c '"'"'echo BECOME-SUCCESS-bmrjxwskahxzmdntdwyehqbmvzmxspdt ; /usr/bin/python3.12 /var/tmp/ansible-tmp-1737791477.7906954-8564-162420420268825/AnsiballZ_command.py'"'"' &amp;amp;&amp;amp; sleep 0'
&amp;lt;127.0.0.1&amp;gt; EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1737791477.7906954-8564-162420420268825/ &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; sleep 0'
changed: [localhost] =&amp;gt; {
    "changed": true,
    "cmd": [
        "sh",
        "checkspace.sh"
    ],
    "delta": "0:00:00.135824",
    "end": "2025-01-25 07:51:18.464837",
    "failed_when_result": false,
    "invocation": {
        "module_args": {
            "_raw_params": "sh checkspace.sh",
            "_uses_shell": false,
            "argv": null,
            "chdir": "/home/bitra/apps/batch-jobs",
            "creates": null,
            "executable": null,
            "expand_argument_vars": true,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2025-01-25 07:51:18.329013",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "Used\tAvail\tUsed\tFilesystem\n/dev/sda5      xfs        29G  9.8G   20G  34% /\n/dev/sda2      xfs       936M  187M  750M  20% /boot",
    "stdout_lines": [
        "Used\tAvail\tUsed\tFilesystem",
        "/dev/sda5      xfs        29G  9.8G   20G  34% /",
        "/dev/sda2      xfs       936M  187M  750M  20% /boot"
    ]
}

PLAY RECAP *********************************************************************
localhost                  : ok=16   changed=10   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Pipeline completed. Last commit date was: 2025-01-22 14:26:13 +0530
[Pipeline] deleteDir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This process ensures that sensitive credentials are never hardcoded or exposed in the pipeline, leveraging HashiCorp Vault for secure and dynamic password management.&lt;/p&gt;

&lt;p&gt;By integrating Jenkins with HashiCorp Vault and Ansible, we’ve achieved a more efficient and secure deployment workflow.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Scale down specific multiple deployments in kubernetes</title>
      <dc:creator>Hemanth B</dc:creator>
      <pubDate>Sat, 11 Sep 2021 12:28:12 +0000</pubDate>
      <link>https://dev.to/hemanth22/scale-down-specific-multiple-deployments-in-kubernetes-685</link>
      <guid>https://dev.to/hemanth22/scale-down-specific-multiple-deployments-in-kubernetes-685</guid>
      <description>&lt;p&gt;In kubernetes, if there are multiple deployment like 5000 deployments deployed in kubernetes &lt;strong&gt;v1.20.0&lt;/strong&gt;, and in that around 800 deployments where migrated from kubernetes &lt;strong&gt;v1.20.0&lt;/strong&gt; to &lt;strong&gt;v1.22.0&lt;/strong&gt;,&lt;br&gt;
When it need to scale down to zero only for 800 deployment.&lt;/p&gt;

&lt;p&gt;We can use below shell script to scale down to zero for specific deployment.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;First list 800 specific deployments details should be listed below in the &lt;strong&gt;deploy.list&lt;/strong&gt; file&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;vi /tmp/deploy.list&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;abc-xyz-service
nyx-api-service
jkx-graphql-api-service
java-jws-service
dotnet-ams-service
xyz-python-service
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Execute below shell script to scale down the deployments to zero.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for pods in `cat /tmp/deploy.list`
do
    kubectl scale --replicas=0 $pods
done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should scale down the replicas of specific multiple deployments.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>linux</category>
      <category>scripting</category>
    </item>
    <item>
      <title>How to install terraform using ansible pull</title>
      <dc:creator>Hemanth B</dc:creator>
      <pubDate>Thu, 03 Dec 2020 03:46:36 +0000</pubDate>
      <link>https://dev.to/hemanth22/how-to-install-terraform-using-ansible-pull-2e82</link>
      <guid>https://dev.to/hemanth22/how-to-install-terraform-using-ansible-pull-2e82</guid>
      <description>&lt;p&gt;Recently, i have learnt how to use ansible pull from youtube videos, and tried practically.&lt;/p&gt;

&lt;p&gt;I have created terraform installation ansible playbook, that will execute with ansible pull.&lt;/p&gt;

&lt;p&gt;By executing below playbook from anywhere, that will connect to AWS EC2 instance and it will pull terraform installation and will install terraform automatically in aws ec2 instance, and it will create a cron job as well.&lt;/p&gt;

&lt;p&gt;Create a pre-requiste playbook as below.&lt;/p&gt;

&lt;p&gt;main.yaml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
- hosts: servers
  remote_user: centos
  become: true
  become_method: sudo
  gather_facts: no
  tasks:
    - name: Install pip on the servers
      yum:
        name: python-pip
        state: latest
        update_cache: true
      become: true

    - name: Install pip3 on the servers
      yum:
        name: python3-pip
        state: latest        
      become: true

    - name: Ensure ansible is installed on servers
      pip:
        name: ansible

    - name: Executing ansible-pull on servers
      command: ansible-pull -U https://gitlab.com/hemanth22/ansible-pull-terraform.git

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;inventory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[servers]
34.221.246.71
[servers:vars]
ansible_python_interpreter=/usr/bin/python
ansible_ssh_private_key_file=~/.ssh/filename.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ansible.cfg&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[defaults]
log_path = /var/log/ansible.log
command_warnings = False
system_warnings = False
action_warnings = False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Command to install execute ansible pull.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ansible-playbook main.yml -i inventory&lt;/code&gt;&lt;/p&gt;

</description>
      <category>ansible</category>
      <category>terraform</category>
    </item>
    <item>
      <title>How to add port on unpublished running docker container</title>
      <dc:creator>Hemanth B</dc:creator>
      <pubDate>Sat, 25 Jul 2020 05:16:17 +0000</pubDate>
      <link>https://dev.to/hemanth22/how-to-add-port-on-unpublished-running-docker-container-1g8o</link>
      <guid>https://dev.to/hemanth22/how-to-add-port-on-unpublished-running-docker-container-1g8o</guid>
      <description>&lt;p&gt;While executing a docker command, forgot give &lt;code&gt;-p&lt;/code&gt; as parameter, then container become inaccessible to others with locathost ip-address.&lt;/p&gt;

&lt;p&gt;To access the docker which is running is without publishing port using the tool &lt;a href="https://medium.com/@copyconstruct/socat-29453e9fc8a6" rel="noopener noreferrer"&gt;socat&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, you have nginx docker and executed below command to running nginx without publishing the port.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --name nginx -d nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you execute below command, you will not be able to access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl localhost:80
curl: (7) Failed connect to localhost:80; Connection refused
$ curl localhost:8080
curl: (7) Failed connect to localhost:8080; Connection refused
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make the port accessible, you don't need stop and remove &lt;br&gt;
 the container, instead without stopping the container, using socat docker port can be made accessible make sure running socat docker in same network where nginx is running.  &lt;/p&gt;

&lt;p&gt;Execute below docker command to get ip address of the nginx container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ docker inspect nginx -f "{{json .NetworkSettings.Networks }}" | jq
{
  "bridge": {
    "IPAMConfig": null,
    "Links": null,
    "Aliases": null,
    "NetworkID": "b813449892718ab3fb3559d1009df9ac8ce53a445ab1de3158396362371e99f6",
    "EndpointID": "bbc0b7510a66c9a84e49d6987daf8cdc7634af2f8615d4cb4c68f579fabb6a44",
    "Gateway": "172.17.0.1",
    "IPAddress": "172.17.0.2",
    "IPPrefixLen": 16,
    "IPv6Gateway": "",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "MacAddress": "02:42:ac:11:00:02",
    "DriverOpts": null
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the Ip Address of the nginx paste next to TCP-CONNECT in below docker command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d --name socat -p 8080:1234 alpine/socat TCP-LISTEN:1234,fork TCP-CONNECT:172.17.0.2:80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now nginx container output will be re-direct from socat through 1234 -&amp;gt; 8080.&lt;/p&gt;

&lt;p&gt;If you execute curl command, now nginx container will become accessible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl localhost:8080
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;title&amp;gt;Welcome to nginx!&amp;lt;/title&amp;gt;
&amp;lt;style&amp;gt;
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Welcome to nginx!&amp;lt;/h1&amp;gt;
&amp;lt;p&amp;gt;If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;For online documentation and support please refer to
&amp;lt;a href="http://nginx.org/"&amp;gt;nginx.org&amp;lt;/a&amp;gt;.&amp;lt;br/&amp;gt;
Commercial support is available at
&amp;lt;a href="http://nginx.com/"&amp;gt;nginx.com&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;&amp;lt;em&amp;gt;Thank you for using nginx.&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For demo, created a video through asciinema, please check below.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://asciinema.org/a/349556" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fasciinema.org%2Fa%2F349556.svg" alt="asciicast" width="1280" height="671"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Devops tools through ansible roles</title>
      <dc:creator>Hemanth B</dc:creator>
      <pubDate>Sat, 21 Dec 2019 06:51:57 +0000</pubDate>
      <link>https://dev.to/hemanth22/devops-tools-through-ansible-roles-2g0b</link>
      <guid>https://dev.to/hemanth22/devops-tools-through-ansible-roles-2g0b</guid>
      <description>&lt;p&gt;I have create some ansible roles which will connect to aws account and provision the devops tools in amazon ec2.&lt;/p&gt;

&lt;p&gt;Jenkins: &lt;a href="https://galaxy.ansible.com/hemanth22/jenkins" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22/jenkins&lt;/a&gt;&lt;br&gt;
Docker: &lt;a href="https://galaxy.ansible.com/hemanth22/aws_docker_instance" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22/aws_docker_instance&lt;/a&gt;&lt;br&gt;
Ansible Tower (i.e. AWX) : &lt;a href="https://galaxy.ansible.com/hemanth22/awx" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22/awx&lt;/a&gt;&lt;br&gt;
Sonarqube: &lt;a href="https://galaxy.ansible.com/hemanth22/sonarqube" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22/sonarqube&lt;/a&gt;&lt;br&gt;
JFrog: &lt;a href="https://galaxy.ansible.com/hemanth22/jfrog" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22/jfrog&lt;/a&gt;&lt;br&gt;
Nexus Repository: &lt;a href="https://galaxy.ansible.com/hemanth22/nexus_repository" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22/nexus_repository&lt;/a&gt;&lt;br&gt;
XL Deploy: &lt;a href="https://galaxy.ansible.com/hemanth22/xldeploy" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22/xldeploy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My Ansible roles: &lt;br&gt;
&lt;a href="https://galaxy.ansible.com/hemanth22" rel="noopener noreferrer"&gt;https://galaxy.ansible.com/hemanth22&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
    </item>
  </channel>
</rss>
