ansible git clone on windows | ansible windows deployment

Опубликовано: 03 Октябрь 2024
на канале: Devops Learning
1,463
5

Hello Guy's,

In this video , I will show you, how we can use win_command module to deploy the git file on windows server through Ansible. In this video you will see auto deployment from Ansible to windows.

The playbook is very simple you can use for your projects.

Here is a sample of Playbook:
---
hosts: windows
gather_facts: no
vars:
GIT_DIR: "C:/ansible-project/learnJenkins/.git"
SOURCE_DIR: "C:/ansible-project/learnJenkins/"
tasks:
name: To check the status
win_command: git --git-dir="{{ GIT_DIR }}" --work-tree="{{ SOURCE_DIR }}" status
name: For Git Checkout
win_command: git --git-dir="{{ GIT_DIR }}" --work-tree="{{ SOURCE_DIR }}" checkout .
name: Pull the Branch Code
win_command: git --git-dir="{{ GIT_DIR }}" --work-tree="{{ SOURCE_DIR }}" pull

Prerequisites:
Please install ansible and other settings on windows machine by watch below video. It is mandatory. Without these settings this is not possible.

   • Ansible Winrm Setup | PowerShell Winr...  

Useful search:
windows git auto deployment though ansible | ansible playbook git clone on windows machine | ansible git checkout branch | how to use git with ansible | ansible git clone private repo | ansible-win_git | ansible-windows git | ansible windows git config | ansible windows playbook example github | github ansible windows | ansible windows playbook github | ansible windows update github | ansible playbook for windows | ansible windows path | ansible windows file module | win_git | win_git ansible module | ansible-pull from git | ansible windows modules | git - Deploy files from git checkouts

Thanks.