Git Product home page Git Product logo

ansible-code-gitolite's Introduction

Ansible

A little project to start learning ansible. This project contains a playbook to set up gitolite on a server (like amor and code).

This project would currently work perfectly for code, which already has git set up.

To support amor (which has gcc installed), we would additionally need to get git working.

Dependencies

sudo apt install ansible ansible-lint vagrant

vagrant for testing

vagrant up

vagrant ssh-config

IP is dynamic, user is vagrant

vagrant ssh sudo -s apt install git adduser robertsw logout

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

vagrant destroy

To test gcc building of git:

apt install build-essential libz-dev gettext

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz

Setup virtualbox for testing

http://www.brianlinkletter.com/installing-debian-linux-in-a-virtualbox-virtual-machine/

setup

hostname: amor2 root pwd: root user: robertsw pwd: Queens

install only ssh server and standard system utilities

stop machine

virtualbox: network settings Open Tab: Adapter 1 Enable the Adapter and select “NAT” Open Tab: Adapter 2 Enable the adapter and select: “Host-only Adapter” Select Name: “VirtualBox Host-only Ethernet Adapter” Click at “Extended” Select the adapter: “Intel PRO/1000 MT Desktop…” Select the modus: “Allow all and host” Click on “Ok” to save all settings.

start machine, log in as root

apt install net-tools git ifconfig

nano /etc/network/interfaces, add lines:

allow-hotplug enp0s8 iface enp0s8 inet dhcp

reboot the machine, log in as root, ifconfig

IP 192.168.99.100

log out, from terminal:

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

then ansible –list all should work

How to run

Run the playbook:

$ ansible-playbook amor2.yml

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [192.168.99.100]

TASK [Create local directory] **************************************************
ok: [192.168.99.100] => (item=.gitolite/logs)
ok: [192.168.99.100] => (item=.ssh)
changed: [192.168.99.100] => (item=local/src)
changed: [192.168.99.100] => (item=local/bin)

TASK [Download and extract gitolite release] ***********************************
changed: [192.168.99.100]

TASK [Install gitolite] ********************************************************
changed: [192.168.99.100]

TASK [Copy public key] *********************************************************
changed: [192.168.99.100]

TASK [Setup gitolite] **********************************************************
changed: [192.168.99.100]

PLAY RECAP *********************************************************************
192.168.99.100             : ok=6    changed=5    unreachable=0    failed=0

After that, we can access the gitolite using our gitolite SSH key:

$ ssh -i ~/.ssh/gitolite_rsa.pub [email protected]
PTY allocation request failed on channel 0
hello gitolite_rsa, this is robertsw@amor2 running gitolite3 (unknown) on git 2.20.1

R W	gitolite-admin
R W	testing
Connection to 192.168.99.100 closed.

We can also verify that paths are set up and repos are visible to gitolite on the command line:

$ ansible -m shell -a "local/bin/gitolite list-repos" all
192.168.99.100 | SUCCESS | rc=0 >>
gitolite-admin
testing

Bad idea

doesn’t work?: docker run -d debian:stretch –init –name amor2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.