fix bug when clone repo + rewrite
rewrite the installation of cgit to use git user.
This commit is contained in:
parent
57ff2b71f4
commit
a9513167ca
2 changed files with 65 additions and 74 deletions
7
main.yml
7
main.yml
|
@ -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
|
||||||
|
|
|
@ -41,91 +41,79 @@
|
||||||
name: "{{ git_user }}"
|
name: "{{ git_user }}"
|
||||||
shell: "/bin/bash"
|
shell: "/bin/bash"
|
||||||
state: present
|
state: present
|
||||||
#groups: "www"
|
|
||||||
|
|
||||||
- name: clonage de cgit
|
- name: mise en place de cgit
|
||||||
|
block:
|
||||||
|
- name: clonage de cgit
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
dest: "{{ path_tmp_cgit }}"
|
dest: "{{ path_tmp_cgit }}"
|
||||||
repo: "https://git.zx2c4.com/cgit"
|
repo: "https://git.zx2c4.com/cgit"
|
||||||
single_branch: yes
|
single_branch: yes
|
||||||
|
|
||||||
- name: configuration de la compilation de cgit
|
- name: configuration de la compilation de cgit
|
||||||
template:
|
template:
|
||||||
src: "config-cgit.conf"
|
src: "config-cgit.conf"
|
||||||
dest: "{{ path_tmp_cgit }}/cgit.conf"
|
dest: "{{ path_tmp_cgit }}/cgit.conf"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: compilation de cgit
|
- name: compilation de cgit
|
||||||
community.general.make:
|
community.general.make:
|
||||||
chdir: "{{ path_tmp_cgit }}"
|
chdir: "{{ path_tmp_cgit }}"
|
||||||
|
|
||||||
- name: installation de cgit
|
- name: installation de cgit
|
||||||
community.general.make:
|
community.general.make:
|
||||||
chdir: "{{ path_tmp_cgit }}"
|
chdir: "{{ path_tmp_cgit }}"
|
||||||
target: install
|
target: install
|
||||||
|
|
||||||
- name: configuration de cgit
|
- name: configuration de cgit
|
||||||
template:
|
template:
|
||||||
src: "cgitrc"
|
src: "cgitrc"
|
||||||
dest: "{{ path_cgit }}"
|
dest: "{{ path_cgit }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: clonage de gitolite
|
- name: clonage de gitolite
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
dest: "{{ path_gitolite }}"
|
dest: "{{ path_gitolite }}"
|
||||||
repo: "https://github.com/sitaramc/gitolite"
|
repo: "https://github.com/sitaramc/gitolite"
|
||||||
single_branch: yes
|
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:
|
ansible.builtin.command:
|
||||||
cmd: "{{ path_gitolite }}/install -to {{ home_user }}/bin"
|
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:
|
ansible.builtin.copy:
|
||||||
src: "../files/{{ admin_key }}"
|
src: "../files/{{ admin_key }}"
|
||||||
dest: "/tmp/{{ admin_key }}"
|
dest: "/tmp/{{ admin_key }}"
|
||||||
|
|
||||||
- name: configuration du premier utilisateur
|
- name: configuration du premier utilisateur
|
||||||
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
|
- name: configuration des droits du dossier repositories
|
||||||
ansible.builtin.copy:
|
ansible.builtin.file:
|
||||||
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:
|
|
||||||
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:
|
||||||
|
|
Loading…
Reference in a new issue