Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing specific apt version with ansible

Tags:

I used an ansible playbook to install git:

--- - hosts: "www"   tasks:   - name: Update apt repo     apt: update_cache=yes   - name: Install dependencies     apt: name={{item}} state=installed     with_items:       - git 

I checked the installed versions:

$ git --version git version 1.9.1 

But adding these to the ansible playbook: apt: name=git=1.9.1 state=installed

and rerunning results in the following error:

fatal: [46.101.94.110]: FAILED! => {"cache_update_time": 0, "cache_updated": false, "changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'git=1.9.1'' failed: E: Version '1.9.1' for 'git' was not found\n", "stderr": "E: Version '1.9.1' for 'git' was not found\n", "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information..."]}

like image 361
AJP Avatar asked Mar 22 '16 09:03

AJP


People also ask

How do I install Ansible specific version?

Selecting an Ansible version to install Install the latest release with your OS package manager (for Red Hat Enterprise Linux (TM), CentOS, Fedora, Debian, or Ubuntu). Install with pip (the Python package manager). Install from source to access the development ( devel ) version to develop or test the latest features.

What is Ansible apt?

Ansible APT Package manager is an Ubuntu equivalent for RedHat yum package manager. Just like all other ansible modules apt ansible module is built after one specific unix command of Debian apt-get.

Do I need to install Ansible on remote host?

Ansible is agent-less, that means no need of any agent installation on remote nodes, so it means there are no any background daemons or programs are executing for Ansible, when it's not managing any nodes.


1 Answers

Git package with that specific version is as follows:

git=1:1.9.1-1ubuntu0.2 

Your task should be:

apt: name=git=1:1.9.1-1ubuntu0.2 state=present 

Regards

like image 118
Eduardo Gonzalez Avatar answered Oct 05 '22 19:10

Eduardo Gonzalez