diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-04-09 18:28:42 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-04-09 18:28:42 -0400 |
commit | 449688096d3cda8e0ea843fe0a8bbf76ff7bd94a (patch) | |
tree | 6d2cf0ffbf7ed5d283790efef1023261f51a8bc7 /roles/git/tasks | |
parent | 76c09caaf4d9952cabb75ae12f917e88fe636f4e (diff) | |
download | infra-449688096d3cda8e0ea843fe0a8bbf76ff7bd94a.tar.gz infra-449688096d3cda8e0ea843fe0a8bbf76ff7bd94a.zip |
import git hosting from sovereign
Diffstat (limited to 'roles/git/tasks')
-rw-r--r-- | roles/git/tasks/cgit.yml | 59 | ||||
-rw-r--r-- | roles/git/tasks/gitolite.yml | 31 | ||||
-rw-r--r-- | roles/git/tasks/main.yml | 2 |
3 files changed, 92 insertions, 0 deletions
diff --git a/roles/git/tasks/cgit.yml b/roles/git/tasks/cgit.yml new file mode 100644 index 0000000..fd9f549 --- /dev/null +++ b/roles/git/tasks/cgit.yml @@ -0,0 +1,59 @@ + +- name: Install cgit dependencies + apt: pkg={{ item }} state=installed + with_items: + - groff + - libssl-dev + - python-pip + tags: + - dependencies + +- name: Install cgit pip dependencies + pip: name={{ item }} + with_items: + - docutils + - pygments + +- name: Download cgit release + get_url: url=http://git.zx2c4.com/cgit/snapshot/cgit-{{ cgit_version }}.tar.xz + dest=/root/cgit-{{ cgit_version }}.tar.xz + +- name: Decompress cgit source + unarchive: src=/root/cgit-{{ cgit_version }}.tar.xz + dest=/root copy=no + creates=/root/cgit-{{ cgit_version }}/configure + +- name: Build and install cgit + shell: make get-git ; make ; make install + executable=/bin/bash + chdir=/root/cgit-{{ cgit_version }} + creates=/var/www/htdocs/cgit/cgit.cgi + +- name: Copy cgitrc + template: src=etc_cgitrc.j2 dest=/etc/cgitrc + group=www-data + owner=root + +- name: Rename existing Apache cgit virtualhost + command: mv /etc/apache2/sites-available/cgit /etc/apache2/sites-available/cgit.conf removes=/etc/apache2/sites-available/cgit + +- name: Remove old sites-enabled/cgit symlink (new one will be created by a2ensite) + file: path=/etc/apache2/sites-enabled/cgit state=absent + +- name: Configure the Apache HTTP server for cgit + template: src=etc_apache2_sites-available_cgit.j2 + dest=/etc/apache2/sites-available/cgit.conf + group=root + owner=root + +- name: Enable Apache CGI module + command: a2enmod cgi creates=/etc/apache2/mods-enabled/cgi.load + notify: restart apache + +- name: Enable Apache rewrite module + command: a2enmod rewrite creates=/etc/apache2/mods-enabled/rewrite.load + notify: restart apache + +- name: Enable cgit site + command: a2ensite cgit.conf creates=/etc/apache2/sites-enabled/cgit.conf + notify: restart apache diff --git a/roles/git/tasks/gitolite.yml b/roles/git/tasks/gitolite.yml new file mode 100644 index 0000000..8e2538f --- /dev/null +++ b/roles/git/tasks/gitolite.yml @@ -0,0 +1,31 @@ +- name: Create gitolite group + group: name=git state=present + +- name: Create gitolite user + user: name=git state=present home=/home/git system=yes group=git + +- name: Add www-data to the git group + user: name=www-data groups=git append=yes + +- name: Install gitolite3 package + apt: pkg=gitolite3 state=installed + tags: + - dependencies + +- name: Copy .gitolite.rc file + copy: src=home_git_.gitolite.rc + dest=/home/git/.gitolite.rc + group=git + owner=git + mode=0644 + +- name: Copy SSH public key to server + copy: src=gitolite.pub + dest=/home/git/{{ main_user_name }}.pub + group=git + owner=git + mode=0644 + +- name: Setup gitolite + command: su - git -c 'gitolite setup -pk {{ main_user_name }}.pub' + chdir=/home/git diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml new file mode 100644 index 0000000..33302ee --- /dev/null +++ b/roles/git/tasks/main.yml @@ -0,0 +1,2 @@ +- include: gitolite.yml tags=gitolite +- include: cgit.yml tags=cgit |