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

View file

@ -41,8 +41,9 @@
name: "{{ git_user }}" name: "{{ git_user }}"
shell: "/bin/bash" shell: "/bin/bash"
state: present state: present
#groups: "www"
- name: mise en place de cgit
block:
- name: clonage de cgit - name: clonage de cgit
ansible.builtin.git: ansible.builtin.git:
dest: "{{ path_tmp_cgit }}" dest: "{{ path_tmp_cgit }}"
@ -76,6 +77,11 @@
repo: "https://github.com/sitaramc/gitolite" repo: "https://github.com/sitaramc/gitolite"
single_branch: yes single_branch: yes
- name: création du dossier bin
file:
path: "{{ home_user }}/bin"
state: directory
- name: installation de gitolite - name: installation de gitolite
ansible.builtin.command: ansible.builtin.command:
cmd: "{{ path_gitolite }}/install -to {{ home_user }}/bin" cmd: "{{ path_gitolite }}/install -to {{ home_user }}/bin"
@ -89,43 +95,25 @@
ansible.builtin.command: ansible.builtin.command:
cmd: "{{ home_user }}/bin/gitolite setup -pk /tmp/{{ admin_key }}" 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 - name: configuration des droits du dossier repositories
file: ansible.builtin.file:
path: "{{ home_user }}/repositories" path: "{{ home_user }}/repositories"
mode: 0705 mode: 0705
state: directory state: directory
recurse: yes recurse: yes
- name: configuration des droits des dossiers de cgit et gitolite - name: configuration des droits de la liste des repositories
file: ansible.builtin.file:
path: "{{ item }}" path: "{{ home_user }}/projects.list"
owner: "{{ git_user }}" mode: 0705
group: "{{ git_user }}"
recurse: yes
state: directory
loop:
- "{{ home_user }}/bin"
- "{{ path_cgit }}"
- "{{ path_gitolite }}"
- name: configuration des dépots - name: configuration des dépots
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "{{ home_user }}/.gitolite.rc" path: "{{ home_user }}/.gitolite.rc"
regex: "UMASK" regex: "UMASK"
line: "\tUMASK => 0072," line: "\tUMASK => 0072,"
become: yes
become_user: git
- name: configuration de Nginx - name: configuration de Nginx
template: template: