Skip to content

Commit c59964c

Browse files
committed
install git in a multiplatform way
1 parent dbb7102 commit c59964c

File tree

6 files changed

+122
-0
lines changed

6 files changed

+122
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
=========
2+
3+
base_git is a role to install the Git version control client
4+
5+
Requirements
6+
------------
7+
8+
RHEL-like, or Debian/Ubuntu system
9+
10+
11+
Role Variables
12+
--------------
13+
none
14+
15+
Dependencies
16+
------------
17+
18+
Yum infrastructure, or internet.
19+
20+
Example Usage
21+
----------------
22+
23+
Refer to a complete build server https://github.com/bbaassssiiee/buildserver
24+
25+
License
26+
-------
27+
28+
MIT
29+
30+
Author Information
31+
------------------
32+
33+
Bas Meijer
34+
@bbaassssiiee

meta/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
# Standards: 0.2
3+
galaxy_info:
4+
author: bbaassssiiee
5+
description: GIT - Source code version control.
6+
company: bbaassssiiee
7+
8+
license: MIT
9+
10+
min_ansible_version: 1.9.0
11+
12+
platforms:
13+
- name: EL
14+
versions:
15+
- 7
16+
- name: Ubuntu
17+
versions:
18+
- trusty
19+
- name: Debian
20+
versions:
21+
- jessie
22+
galaxy_tags:
23+
- system
24+
- development
25+
26+
dependencies: []

molecule.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# Standards: 0.2
3+
dependency:
4+
name: galaxy
5+
driver:
6+
name: docker
7+
docker:
8+
containers:
9+
- name: base-git-centos
10+
image: milcom/centos7-systemd
11+
image_version: latest
12+
ansible_groups:
13+
- group1
14+
- name: base-git-ubuntu
15+
image: ubuntu
16+
image_version: latest
17+
ansible_groups:
18+
- group2
19+
- name: base-git-debian
20+
image: maint/debian-systemd
21+
image_version: latest
22+
ansible_groups:
23+
- group3
24+
verifier:
25+
name: testinfra

playbook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
# Standards: 0.2
3+
- hosts: all
4+
roles:
5+
- role: base_git

tasks/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
3+
- name: Install Git from yum repo
4+
become: yes
5+
when: ansible_os_family == 'RedHat'
6+
yum:
7+
name: git
8+
state: present
9+
update_cache: yes
10+
tags:
11+
- git
12+
13+
- name: Install Git from apt repo
14+
become: yes
15+
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
16+
apt:
17+
name: git
18+
state: present
19+
tags:
20+
- git

tests/test_default.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import testinfra.utils.ansible_runner
2+
3+
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
4+
'.molecule/ansible_inventory').get_hosts('all')
5+
6+
7+
def test_hosts_file(File):
8+
f = File('/etc/hosts')
9+
10+
assert f.exists
11+
assert f.user == 'root'
12+
assert f.group == 'root'

0 commit comments

Comments
 (0)