141 lines
3.6 KiB
YAML
141 lines
3.6 KiB
YAML
---
|
|
# Configura e lancia il servizio git-daemon per servire i repository locali
|
|
|
|
- name: Installo git-daemon
|
|
yum: pkg=git-daemon state=present
|
|
become: yes
|
|
|
|
- name: Creazione gruppo git
|
|
group:
|
|
name: git
|
|
system: yes
|
|
state: present
|
|
become: yes
|
|
|
|
- name: Creazione utente git-daemon
|
|
user:
|
|
name: git-daemon
|
|
system: yes
|
|
group: git
|
|
home: /var/lib/git-daemon
|
|
state: present
|
|
become: yes
|
|
|
|
- name: Creo directory repositories
|
|
file:
|
|
path: /var/lib/git-daemon/repositories
|
|
state: directory
|
|
become: yes
|
|
become_user: git-daemon
|
|
|
|
- name: Verifica presenza repo
|
|
shell: test -d /var/lib/git-daemon/repositories/client-pull-installation.git
|
|
register: chk_clientpullinstall_repo
|
|
changed_when: chk_clientpullinstall_repo.rc != 0
|
|
ignore_errors: yes
|
|
become: yes
|
|
tags:
|
|
- git-daemon-update
|
|
|
|
- name: Aggiorno il repo se già esistente
|
|
shell: pushd /var/lib/git-daemon/repositories/client-pull-installation.git; git fetch -p origin; popd
|
|
become: yes
|
|
become_user: git-daemon
|
|
when: chk_clientpullinstall_repo|success
|
|
tags:
|
|
- git-daemon-update
|
|
|
|
# E' in forma di shell perché non c'è modo di passare ad ansible
|
|
# il parametro --mirror
|
|
- name: Clono il repository client-pull-installation
|
|
shell: git clone --mirror https://github.com/bglug-it/client-pull-installation.git /var/lib/git-daemon/repositories/client-pull-installation.git
|
|
become: yes
|
|
become_user: git-daemon
|
|
when: chk_clientpullinstall_repo|changed
|
|
|
|
- name: Rendo il repository esportabile
|
|
file:
|
|
path: /var/lib/git-daemon/repositories/client-pull-installation.git/git-daemon-export-ok
|
|
state: touch
|
|
become: yes
|
|
become_user: git-daemon
|
|
tags:
|
|
- git-daemon-update
|
|
|
|
- name: Installo task di cron per aggiornamento repo
|
|
copy:
|
|
src: git-daemon-crontab
|
|
dest: /etc/cron.d/git-daemon
|
|
mode: 0644
|
|
owner: root
|
|
group: root
|
|
become: yes
|
|
|
|
- name: Installo l'init
|
|
copy:
|
|
src: git-daemon-init
|
|
dest: /etc/init.d/git-daemon
|
|
mode: 0755
|
|
owner: root
|
|
group: root
|
|
become: yes
|
|
|
|
- name: Configuro l'avvio di git-daemon
|
|
shell: /sbin/chkconfig --add git-daemon
|
|
become: yes
|
|
|
|
- name: Verifica aggiunta servizio
|
|
shell: /sbin/e-smith/db configuration show git-daemon
|
|
become: yes
|
|
register: chk_gitdaemon_srv
|
|
changed_when: chk_gitdaemon_srv.rc != 0
|
|
ignore_errors: yes
|
|
|
|
- name: Aggiungo servizio a gestione NethServer
|
|
shell: /sbin/e-smith/db configuration set git-daemon service status enabled TCPPort 9418 access private
|
|
become: yes
|
|
when: chk_gitdaemon_srv|changed
|
|
|
|
- name: Creazione directory defaults per NethServer
|
|
file:
|
|
path: /etc/e-smith/db/configuration/defaults/git-daemon
|
|
recurse: yes
|
|
state: directory
|
|
become: yes
|
|
when: chk_gitdaemon_srv|changed
|
|
|
|
- name: Creazione tipo default per NethServer
|
|
lineinfile:
|
|
dest: /etc/e-smith/db/configuration/defaults/git-daemon/type
|
|
regexp: "^service"
|
|
line: "service"
|
|
create: yes
|
|
state: present
|
|
become: yes
|
|
when: chk_gitdaemon_srv|changed
|
|
|
|
- name: Creazione stato default per NethServer
|
|
lineinfile:
|
|
dest: /etc/e-smith/db/configuration/defaults/git-daemon/status
|
|
regexp: "^enabled"
|
|
line: "enabled"
|
|
create: yes
|
|
state: present
|
|
become: yes
|
|
when: chk_gitdaemon_srv|changed
|
|
|
|
- name: Aggiunta servizio
|
|
shell: /sbin/e-smith/signal-event runlevel-adjust
|
|
become: yes
|
|
when: chk_gitdaemon_srv|changed
|
|
|
|
- name: Aggiunta servizio di rete e cambio firewall
|
|
shell: /sbin/e-smith/signal-event firewall-adjust
|
|
become: yes
|
|
when: chk_gitdaemon_srv|changed
|
|
|
|
- name: Avvio servizio
|
|
shell: service git-daemon start
|
|
become: yes
|
|
when: chk_gitdaemon_srv|changed
|