|
|
|
|
@ -17,58 +17,70 @@
|
|
|
|
|
gitweb_root: /home/gitweb/projects |
|
|
|
|
gitweb_stylesheet: custom_highlighting.css |
|
|
|
|
block: |
|
|
|
|
- name: make hash of a random password |
|
|
|
|
set_fact: |
|
|
|
|
gitweb_pass: "{{ lookup('password', |
|
|
|
|
'/dev/null length=15 chars=ascii_letters') |
|
|
|
|
| password_hash('sha512') }}" |
|
|
|
|
- name: test if gitweb is already installed |
|
|
|
|
find: |
|
|
|
|
paths: /etc |
|
|
|
|
pattern: gitweb.conf |
|
|
|
|
register: check_installed |
|
|
|
|
|
|
|
|
|
- name: add gitweb user |
|
|
|
|
user: |
|
|
|
|
name: "{{ gitweb_user }}" |
|
|
|
|
password: "{{ gitweb_pass }}" |
|
|
|
|
shell: /usr/bin/git-shell |
|
|
|
|
- set_fact: |
|
|
|
|
install_gitweb: "{{ check_installed.matched == 0 }}" |
|
|
|
|
|
|
|
|
|
- name: create ssh directory |
|
|
|
|
file: |
|
|
|
|
state: directory |
|
|
|
|
mode: 0700 |
|
|
|
|
owner: "{{ gitweb_user }}" |
|
|
|
|
path: "/home/{{ gitweb_user }}/.ssh" |
|
|
|
|
- name: install block |
|
|
|
|
when: install_gitweb |
|
|
|
|
block: |
|
|
|
|
- name: make hash of a random password |
|
|
|
|
set_fact: |
|
|
|
|
gitweb_pass: "{{ lookup('password', |
|
|
|
|
'/dev/null length=15 chars=ascii_letters') |
|
|
|
|
| password_hash('sha512') }}" |
|
|
|
|
|
|
|
|
|
- name: copy ssh_pubkey for gitweb user |
|
|
|
|
copy: |
|
|
|
|
remote_src: yes |
|
|
|
|
src: /root/.ssh/authorized_keys |
|
|
|
|
dest: "/home/{{ gitweb_user }}/.ssh/authorized_keys" |
|
|
|
|
owner: "{{ gitweb_user }}" |
|
|
|
|
group: "{{ gitweb_user }}" |
|
|
|
|
mode: 0600 |
|
|
|
|
- name: add gitweb user |
|
|
|
|
user: |
|
|
|
|
name: "{{ gitweb_user }}" |
|
|
|
|
password: "{{ gitweb_pass }}" |
|
|
|
|
shell: /usr/bin/git-shell |
|
|
|
|
|
|
|
|
|
- name: create project directory |
|
|
|
|
file: |
|
|
|
|
path: "{{ gitweb_root }}" |
|
|
|
|
state: directory |
|
|
|
|
owner: "{{ gitweb_user }}" |
|
|
|
|
- name: create ssh directory |
|
|
|
|
file: |
|
|
|
|
state: directory |
|
|
|
|
mode: 0700 |
|
|
|
|
owner: "{{ gitweb_user }}" |
|
|
|
|
path: "/home/{{ gitweb_user }}/.ssh" |
|
|
|
|
|
|
|
|
|
- name: install lighttpd template |
|
|
|
|
template: |
|
|
|
|
src: lighttpd.conf.j2 |
|
|
|
|
dest: /etc/lighttpd/lighttpd.conf |
|
|
|
|
- name: copy ssh_pubkey for gitweb user |
|
|
|
|
copy: |
|
|
|
|
remote_src: yes |
|
|
|
|
src: /root/.ssh/authorized_keys |
|
|
|
|
dest: "/home/{{ gitweb_user }}/.ssh/authorized_keys" |
|
|
|
|
owner: "{{ gitweb_user }}" |
|
|
|
|
group: "{{ gitweb_user }}" |
|
|
|
|
mode: 0600 |
|
|
|
|
|
|
|
|
|
- name: install gitweb template |
|
|
|
|
template: |
|
|
|
|
src: gitweb.conf.j2 |
|
|
|
|
dest: /etc/gitweb.conf |
|
|
|
|
- name: create project directory |
|
|
|
|
file: |
|
|
|
|
path: "{{ gitweb_root }}" |
|
|
|
|
state: directory |
|
|
|
|
owner: "{{ gitweb_user }}" |
|
|
|
|
|
|
|
|
|
- name: install gitweb stylesheet |
|
|
|
|
template: |
|
|
|
|
src: "{{ gitweb_stylesheet }}.j2" |
|
|
|
|
dest: "/usr/share/gitweb/static/{{ gitweb_stylesheet }}" |
|
|
|
|
- name: install lighttpd template |
|
|
|
|
template: |
|
|
|
|
src: lighttpd.conf.j2 |
|
|
|
|
dest: /etc/lighttpd/lighttpd.conf |
|
|
|
|
|
|
|
|
|
- name: enable and (re)start lighttpd |
|
|
|
|
service: |
|
|
|
|
name: lighttpd |
|
|
|
|
enabled: yes |
|
|
|
|
state: restarted |
|
|
|
|
- name: install gitweb template |
|
|
|
|
template: |
|
|
|
|
src: gitweb.conf.j2 |
|
|
|
|
dest: /etc/gitweb.conf |
|
|
|
|
|
|
|
|
|
- name: install gitweb stylesheet |
|
|
|
|
template: |
|
|
|
|
src: "{{ gitweb_stylesheet }}.j2" |
|
|
|
|
dest: "/usr/share/gitweb/static/{{ gitweb_stylesheet }}" |
|
|
|
|
|
|
|
|
|
- name: enable and (re)start lighttpd |
|
|
|
|
service: |
|
|
|
|
name: lighttpd |
|
|
|
|
enabled: yes |
|
|
|
|
state: restarted |
|
|
|
|
|
|
|
|
|
|