Reputation: 2104
I am trying to upgrade git package to latest version on five of my ubuntu-18.04
systems using ansible playbook
. My ansible code as follows,
---
- hosts: gitservers
tasks:
- name: Update APT package manager repositories cache
become: true
apt:
update_cache: yes
- name: Install Git Package
become: true
apt:
name: git
state: latest
update_cache: yes
Last few lines of output:-
TASK [Install Git Package] ******************************************************************************************************
ok: [50.51.52.24]
ok: [50.51.52.23]
ok: [50.51.52.22]
ok: [50.51.52.25]
changed: [50.51.52.21]
PLAY RECAP ***********************************************************************************************************************
50.51.52.21 : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
50.51.52.22 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
50.51.52.23 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
50.51.52.24 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
50.51.52.25 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
It has upgraded git package only on 50.51.52.21
and i can see below given latest version.
# git --version
git version 2.31.1
However for remaining systems still have older version of git ( 2.17.1)
. I am not sure what is wrong in this. Can someone provide me pointers to solve this issue?
Manually on 50.51.52.22
system with below commands have upgraded successfully to git version 2.31.1
add-apt-repository ppa:git-core/ppa -y
apt-get update
apt-get install git -y
Upvotes: 3
Views: 1898
Reputation: 11280
Ansible executes the same code, across all the inventory hosts. You should start with what's different on 50.51.52.21
. It probably has a different repo that provides git.
Validate that with grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep git
(on the working node), it will list all the installed repositories.
Add a task to validate the git repository is installed on your ubuntu server.
- apt_repository:
repo: 'ppa:git-core/ppa'
state: present
This should be set as the first task, then run the apt update and ultimately install git task.
Upvotes: 2