add libretls and use vars files for roles

This commit is contained in:
rick 2022-06-24 20:58:53 +02:00
parent 068fe90825
commit b4dea966fc
Signed by: Rick
GPG key ID: 4A6223D66294EB20
10 changed files with 100 additions and 26 deletions

View file

@ -5,6 +5,8 @@ Ils ne sont pas beau et je prévois de repasser dessus pour avoir une jolie
structure de dossier et playbook. Tous les services sont destinés à être
installé sur une même machine (pour l'instant).
Ils ont été écris afin d'être lancé sur Debian 10.
`ansible-playbook main.yml -i inventaire.ini` pour lancer l'installation.
## inventaire.ini

View file

@ -23,8 +23,6 @@
vars_files:
- vars/sites.yml
- vars/cgit.yml
- vars/principal.yml
vars:
pounce_user: "pounce"
pounce_home: "/home/{{ pounce_user }}"
@ -41,15 +39,16 @@
apt:
name:
- acl
- make
- gcc
- nginx
- certbot
- gcc
- git
- sudo
- make
- nginx
- python3-pip
- sudo
roles:
- libretls
- cgit
- site

View file

@ -30,15 +30,17 @@
- zlib1g-dev
- python3-certbot-nginx
- fcgiwrap
- python3-zipp
#- python3-zipp
- name: installation de pygments
ansible.builtin.pip:
name: pygments
name:
- pygments
- zipp
- name: création utilisateur cgit
ansible.builtin.user:
name: "{{ git_user }}"
name: "{{ user }}"
shell: "/bin/bash"
state: present
@ -46,23 +48,23 @@
block:
- name: clonage de cgit
ansible.builtin.git:
dest: "{{ path_tmp_cgit }}"
repo: "https://git.zx2c4.com/cgit"
dest: "{{ path_tmp_git }}"
repo: "{{ git }}"
single_branch: yes
- name: configuration de la compilation de cgit
template:
src: "config-cgit.conf"
dest: "{{ path_tmp_cgit }}/cgit.conf"
dest: "{{ path_tmp_git }}/cgit.conf"
mode: 0644
- name: compilation de cgit
community.general.make:
chdir: "{{ path_tmp_cgit }}"
chdir: "{{ path_tmp_git }}"
- name: installation de cgit
community.general.make:
chdir: "{{ path_tmp_cgit }}"
chdir: "{{ path_tmp_git }}"
target: install
- name: configuration de cgit
@ -74,7 +76,7 @@
- name: clonage de gitolite
ansible.builtin.git:
dest: "{{ path_gitolite }}"
repo: "https://github.com/sitaramc/gitolite"
repo: "{{ git_gitolite }}"
single_branch: yes
- name: création du dossier bin
@ -113,7 +115,7 @@
regex: "UMASK"
line: "\tUMASK => 0072,"
become: yes
become_user: git
become_user: "{{ user }}"
- name: configuration de Nginx
template:

9
roles/cgit/vars/main.yml Normal file
View file

@ -0,0 +1,9 @@
---
git: "https://git.zx2c4.com/cgit"
git_gitolite: "https://github.com/sitaramc/gitolite"
user: "git"
home_user: "/home/{{ user }}"
path_tmp_git: "{{ home_user }}/tmp"
path_cgit: "{{ home_user }}/cgit"
path_gitolite: "{{ home_user }}/gitolite"
admin_key: "cgit.pub"

View file

@ -0,0 +1,63 @@
################################################################################
# installation de libretls
#
# 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: update de la machine
apt:
update_cache: true
upgrade: yes
- name: installation des paquets nécessaires
apt:
name:
- autoconf
- automake
- libtool
- libssl-dev
- name: clonage de libretls
ansible.builtin.git:
dest: "{{ path_tmp_git }}"
repo: "{{ git }}"
single_branch: yes
- name: autoreconf
ansible.builtin.command:
cmd: "autoreconf -fi"
chdir: "{{ path_tmp_git }}"
- name: configure
ansible.builtin.command:
cmd: "{{ path_tmp_git }}/configure --disable-dependency-tracking"
chdir: "{{ path_tmp_git }}"
- name: compilation de libretls
community.general.make:
chdir: "{{ path_tmp_git }}"
target: all
- name: installation de libretls
community.general.make:
chdir: "{{ path_tmp_git }}"
target: install
- name: copie de la bibliothèque de libretls
file:
src: "{{ path_local_lib }}"
dest: "{{ path_global_lib }}"
state: link

View file

@ -0,0 +1,6 @@
---
git: "https://git.causal.agency/libretls/"
path_tmp_git: "/tmp/libretls"
lib_name: "libtls.so.25"
path_local_lib: "/usr/local/lib/{{ lib_name }}"
path_global_lib: "/usr/lib/{{ lib_name }}"

View file

@ -1,5 +1,5 @@
################################################################################
# installation de cgit et configuration de nginx et gitolite
# installation de mon site personnel
#
# Copyright (C) 2022 rick G. <rick@gnous.eu>
#
@ -36,7 +36,7 @@
- name: installation de htmlize
ansible.builtin.command:
cmd: "emacs -u {{ user }} --script /tmp/init.el"
cmd: "emacs -u {{ user_default }} --script /tmp/init.el"
ignore_errors: yes
- name: clonage du site

View file

@ -1,7 +0,0 @@
---
git_user: "git"
home_user: "/home/{{ git_user }}"
path_tmp_cgit: "{{ home_user }}/tmp"
path_cgit: "{{ home_user }}/cgit"
path_gitolite: "{{ home_user }}/gitolite"
admin_key: "cgit.pub"

View file

@ -2,6 +2,6 @@
site: ""
cgit_site: ""
user: "ubuntu"
user_default: "ubuntu"
ava: "/etc/nginx/sites-available"
ena: "/etc/nginx/sites-enabled"