Ansible playbook to install Git credential manager Core
The following playbook will install Git credential manager core (GCMCore) on Ubuntu or Debian based distributions.
---
- name: Install Git and Git Credential Manager
hosts: all
become: true
vars:
gcm_version: "2.6.1"
tasks:
- name: Install Git
apt:
name: git
state: present
- name: Check if GCM is already installed
command: dpkg-query -W git-credential-manager
register: gcm_check
failed_when: false
changed_when: false
- name: Download GCM .deb package
get_url:
url: "https://github.com/git-ecosystem/git-credential-manager/releases/download/v{{ gcm_version }}/gcm-linux_amd64.{{ gcm_version }}.deb"
dest: "/tmp/gcm-linux_amd64.{{ gcm_version }}.deb"
mode: '0644'
when: gcm_check.rc != 0 or gcm_check.stdout is not search(gcm_version ~ '*')
- name: Install GCM package
apt:
deb: "/tmp/gcm-linux_amd64.{{ gcm_version }}.deb"
state: present
when: gcm_check.rc != 0 or gcm_check.stdout is not search(gcm_version ~ '*')
- name: Clean up downloaded .deb file
file:
path: "/tmp/gcm-linux_amd64.{{ gcm_version }}.deb"
state: absent
when: gcm_check.rc != 0 or gcm_check.stdout is not search(gcm_version ~ '*')
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow