fix bug when clone repo + rewrite

rewrite the installation of cgit to use git user.
This commit is contained in:
rick 2022-06-12 03:40:13 +02:00
parent 57ff2b71f4
commit a9513167ca
Signed by: Rick
GPG key ID: 4A6223D66294EB20
2 changed files with 65 additions and 74 deletions

View file

@ -17,13 +17,14 @@
################################################################################
---
- name: cgit
- name: site
hosts: ubuntu
become: true
become: yes
vars_files:
- vars/sites.yml
- vars/cgit.yml
- vars/principal.yml
vars:
pounce_user: "pounce"
pounce_home: "/home/{{ pounce_user }}"
@ -39,6 +40,7 @@
- name: installation des paquets nécessaires
apt:
name:
- acl
- make
- gcc
- nginx
@ -49,6 +51,7 @@
roles:
- cgit
- site
post_tasks:
- name: démarrage par défaut de nginx

View file

@ -41,91 +41,79 @@
name: "{{ git_user }}"
shell: "/bin/bash"
state: present
#groups: "www"
- name: clonage de cgit
- name: mise en place de cgit
block:
- name: clonage de cgit
ansible.builtin.git:
dest: "{{ path_tmp_cgit }}"
repo: "https://git.zx2c4.com/cgit"
single_branch: yes
- name: configuration de la compilation de cgit
- name: configuration de la compilation de cgit
template:
src: "config-cgit.conf"
dest: "{{ path_tmp_cgit }}/cgit.conf"
mode: 0644
- name: compilation de cgit
- name: compilation de cgit
community.general.make:
chdir: "{{ path_tmp_cgit }}"
- name: installation de cgit
- name: installation de cgit
community.general.make:
chdir: "{{ path_tmp_cgit }}"
target: install
- name: configuration de cgit
- name: configuration de cgit
template:
src: "cgitrc"
dest: "{{ path_cgit }}"
mode: 0644
- name: clonage de gitolite
- name: clonage de gitolite
ansible.builtin.git:
dest: "{{ path_gitolite }}"
repo: "https://github.com/sitaramc/gitolite"
single_branch: yes
- name: installation de gitolite
- name: création du dossier bin
file:
path: "{{ home_user }}/bin"
state: directory
- name: installation de gitolite
ansible.builtin.command:
cmd: "{{ path_gitolite }}/install -to {{ home_user }}/bin"
- name: upload de la clé SSH de l'admin
- name: upload de la clé SSH de l'admin
ansible.builtin.copy:
src: "../files/{{ admin_key }}"
dest: "/tmp/{{ admin_key }}"
- name: configuration du premier utilisateur
- name: configuration du premier utilisateur
ansible.builtin.command:
cmd: "{{ home_user }}/bin/gitolite setup -pk /tmp/{{ admin_key }}"
- name: déplacement des dossiers de configuration de gitolite
ansible.builtin.copy:
src: "/root/{{ item }}"
dest: "{{ home_user }}"
remote_src: yes
owner: "{{ git_user }}"
group: "{{ git_user }}"
loop:
- ".gitolite"
- ".gitolite.rc"
- "projects.list"
- "repositories"
- name: configuration des droits du dossier repositories
file:
- name: configuration des droits du dossier repositories
ansible.builtin.file:
path: "{{ home_user }}/repositories"
mode: 0705
state: directory
recurse: yes
- name: configuration des droits des dossiers de cgit et gitolite
file:
path: "{{ item }}"
owner: "{{ git_user }}"
group: "{{ git_user }}"
recurse: yes
state: directory
loop:
- "{{ home_user }}/bin"
- "{{ path_cgit }}"
- "{{ path_gitolite }}"
- name: configuration des droits de la liste des repositories
ansible.builtin.file:
path: "{{ home_user }}/projects.list"
mode: 0705
- name: configuration des dépots
- name: configuration des dépots
ansible.builtin.lineinfile:
path: "{{ home_user }}/.gitolite.rc"
regex: "UMASK"
line: "\tUMASK => 0072,"
become: yes
become_user: git
- name: configuration de Nginx
template: