You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ansible-role-nginx/roles/ansible-role-git/tasks/install-from-source.yml

62 lines
1.8 KiB

---
- name: Ensure git's dependencies are installed (RedHat).
yum: "pkg={{ item }} state=installed"
with_items:
- gettext-devel
- expat-devel
- curl-devel
- zlib-devel
- perl-devel
- openssl-devel
- subversion-perl
- make
- gcc
when: ansible_os_family == 'RedHat'
- name: Ensure git's dependencies are installed (Debian).
apt: "pkg={{ item }} state=installed"
with_items:
- libcurl4-gnutls-dev
- libexpat1-dev
- gettext
- libssl-dev
- build-essential
- gcc
when: ansible_os_family == 'Debian'
- name: Get installed version
command: git --version
changed_when: false
failed_when: false
# Ansible 1.8 feature.
# warn: no
register: git_installed_version
- name: Force git install if the version numbers do not match
set_fact:
git_reinstall_from_source: true
when: 'git_install_from_source_force_update and (git_installed_version|success and (git_installed_version.stdout | regex_replace("^.*?([0-9\.]+)$", "\\1") | version_compare(git_version, operator="!=")))'
- name: Download git.
get_url:
url: "https://www.kernel.org/pub/software/scm/git/git-{{ git_version }}.tar.gz"
dest: "{{ workspace }}/git-{{ git_version }}.tar.gz"
when: git_installed_version|failed or git_reinstall_from_source
- name: Expand git archive.
unarchive:
src: "{{ workspace }}/git-{{ git_version }}.tar.gz"
dest: "{{ workspace }}"
creates: "{{ workspace }}/git-{{ git_version }}/README"
copy: no
when: git_installed_version|failed or git_reinstall_from_source
- name: Build git.
command: >
make prefix={{ git_install_path }} {{ item }}
chdir={{ workspace }}/git-{{ git_version }}
with_items:
- all
- install
when: git_installed_version|failed or git_reinstall_from_source
become: yes