From: Andrew Grimberg Date: Tue, 25 Jun 2019 00:51:18 +0000 (+1000) Subject: Make git2u swap idempotent X-Git-Tag: v0.4.0~18^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=403407feb4f1f9b5295ee187c4f4c1cab7bebf39;p=releng%2Fcommon-packer.git Make git2u swap idempotent Issue: RELENG-2143 Change-Id: Icba128bf8d775edd2b750f05c7662162fcdf9371 Signed-off-by: Andrew Grimberg Signed-off-by: Anil Belur --- diff --git a/provision/install-base-pkgs-RedHat.yaml b/provision/install-base-pkgs-RedHat.yaml index 29cdc3b..5d6f49d 100644 --- a/provision/install-base-pkgs-RedHat.yaml +++ b/provision/install-base-pkgs-RedHat.yaml @@ -8,17 +8,19 @@ - https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - https://centos7.iuscommunity.org/ius-release.rpm state: latest - become: yes + become: true -# yum-plugin-replace comes from ius and therefore must be a separate step -- name: Install yum-plugin-replace - yum: - name: yum-plugin-replace - state: latest - update_cache: yes - become: yes - -# calling yum replace is not possible via standard ansible -- name: Switch to git2u - shell: yum -y replace git --replace-with git2u - become: yes +- name: Swap to git2u + block: + - name: Install yum-plugin-replace + yum: + name: yum-plugin-replace + state: present + update_cache: true + - name: Gather rpm package facts + package_facts: + manager: auto + - name: Replace git with git2u + command: yum replace -y git --replace-with git2u + when: ansible_facts.packages['git'] is defined + become: true