deploiement/roles/cgit/tasks/main.yml

146 lines
4.1 KiB
YAML
Raw Normal View History

2022-05-18 20:18:30 +02:00
################################################################################
# installation de cgit et configuration de nginx et gitolite
#
# Copyright (C) 2022 rick G. <rick@gnous.eu>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.
################################################################################
---
- name: installation des paquets nécessaires
apt:
name:
- libzip-dev
- libssl-dev
- zlib1g-dev
2023-01-02 17:55:19 +01:00
- python3-markdown
2022-05-18 20:18:30 +02:00
- python3-certbot-nginx
- fcgiwrap
#- python3-zipp
2022-05-18 20:18:30 +02:00
- name: installation de pygments
ansible.builtin.pip:
name:
- pygments
- zipp
2022-05-18 20:18:30 +02:00
- name: création utilisateur cgit
ansible.builtin.user:
name: "{{ user }}"
2022-05-18 20:18:30 +02:00
shell: "/bin/bash"
state: present
- name: mise en place de cgit
block:
- name: clonage de cgit
ansible.builtin.git:
dest: "{{ path_tmp_git }}"
repo: "{{ git }}"
single_branch: yes
- name: configuration de la compilation de cgit
template:
src: "config-cgit.conf"
dest: "{{ path_tmp_git }}/cgit.conf"
mode: 0644
- name: compilation de cgit
community.general.make:
chdir: "{{ path_tmp_git }}"
- name: installation de cgit
community.general.make:
chdir: "{{ path_tmp_git }}"
target: install
- name: configuration de cgit
template:
src: "cgitrc"
dest: "{{ path_cgit }}"
mode: 0644
- name: clonage de gitolite
ansible.builtin.git:
dest: "{{ path_gitolite }}"
repo: "{{ git_gitolite }}"
single_branch: yes
- 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
ansible.builtin.copy:
src: "../files/{{ admin_key }}"
dest: "/tmp/{{ admin_key }}"
- name: configuration du premier utilisateur
ansible.builtin.command:
cmd: "{{ home_user }}/bin/gitolite setup -pk /tmp/{{ admin_key }}"
- name: configuration des droits du dossier repositories
ansible.builtin.file:
path: "{{ home_user }}/repositories"
mode: 0705
state: directory
recurse: yes
- name: configuration des droits de la liste des repositories
ansible.builtin.file:
path: "{{ home_user }}/projects.list"
mode: 0705
- name: configuration des dépots
ansible.builtin.lineinfile:
path: "{{ home_user }}/.gitolite.rc"
regex: "UMASK"
line: "\tUMASK => 0072,"
- name: configuration de gitolite avec les clés cgit
ansible.builtin.lineinfile:
path: "{{ home_user }}/.gitolite.rc"
regex: "GIT_CONFIG_KEYS"
2023-01-21 20:10:15 +01:00
line: "\tGIT_CONFIG_KEYS => 'cgit\\.owner cgit\\.section cgit\\.hide cgit\\.desc',"
- name: configuration de la branche par défaut de git
community.general.git_config:
name: init.defaultBranch
scope: global
value: master
become: yes
become_user: "{{ user }}"
- name: configuration de Nginx
template:
src: "cgit-nginx"
2022-06-12 03:44:53 +02:00
dest: "{{ ava }}/cgit.conf"
mode: 0644
- name: lien symbolique pour le site cgit
file:
2022-06-12 03:44:53 +02:00
src: "{{ ava }}/cgit.conf"
dest: "{{ ena }}/cgit.conf"
state: link
2022-05-18 20:18:30 +02:00
- name: démarrage par défaut de fcgiwrap
ansible.builtin.service:
name: fcgiwrap
enabled: yes
notify:
- restart fcgiwrap