diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce8403c --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Created by https://www.toptal.com/developers/gitignore/api/ansible,vim +# Edit at https://www.toptal.com/developers/gitignore?templates=ansible,vim + +### Ansible ### +*.retry + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# End of https://www.toptal.com/developers/gitignore/api/ansible,vim diff --git a/README.md b/README.md index 36ac2c2..3259518 100644 --- a/README.md +++ b/README.md @@ -9,23 +9,29 @@ Ils ont été écris afin d'être lancé sur Debian 10. `ansible-playbook main.yml -i inventaire.ini` pour lancer l'installation. +Chaque dossier `vars` des différents rôles contient des variables pour indiquer +le chemin du site, l'utilisateur, etc. Les variables propres à chaque rôle +sont expliquées en commentaires. + +## Services + + * bubger : permet de faire des archives html de mailing lists + * cgit : serveur web git (utilise gitolite pour gérer les dépôts) + * libretls : bibliothèque alternative pour pounce + * pounce : bouncer irc (contient litterbox, logger, et scooper, interface + graphique; installe aussi sqlite) + * site : mon site personnel (installe emacs) + ## inventaire.ini Mettez ou l'ip ou le nom de la configuration SSH de votre machine distante. Ici, il s'agit du nom de la configuration SSH pour cacher l'IP de la machine de test. -## vars - -* sites : Contient les différents noms de domains à utiliser. -* cgit : variables pour cgit - ## cgit -Ces fichiers se trouvent dans `roles/cgit/` dans les dossiers `tasks` -et `templates`. +Ces fichiers se trouvent dans `roles/cgit/` dans le dossier `templates`. -- cgit.yml : script ansible d'installation - config-cgit.conf : template de configuration pour la compilation de cgit. Ici, tout est installé dans le même dossier (/home/git). - cgit-nginx : template pour la configuration nginx de cgit diff --git a/main.yml b/main.yml index dd813a2..c07883d 100644 --- a/main.yml +++ b/main.yml @@ -39,19 +39,22 @@ apt: name: - acl + - apache2-utils - certbot - gcc - git - make - nginx + - python3 - python3-pip - sudo + - ufw roles: - libretls - cgit - site - - bubger + - pounce post_tasks: - name: démarrage par défaut de nginx diff --git a/roles/bubger/vars/main.yml b/roles/bubger/vars/main.yml index bb4f28f..66fda05 100644 --- a/roles/bubger/vars/main.yml +++ b/roles/bubger/vars/main.yml @@ -1,8 +1,16 @@ --- -private_name: "" +# nom du dossier des archives privées +private_name: "perso" +# chemin d'installation du binaire compilé path: "{{ home_user_default }}/bubger" +# chemin où sera enregistré les fichiers HTML path_site: "/var/www/mailing_list" +# chemins où seront lié par lien symbolique les dossiers public et private path_site_public: "{{ path_site }}/archives" path_site_private: "{{ path_site }}/{{ private_name }}" + +# dossiers contenant les fichiers HTML générés +# les archives publiques public: "{{ path }}/archives" +# les archives privées private: "{{ path }}/{{ private_name }}" diff --git a/roles/cgit/tasks/main.yml b/roles/cgit/tasks/main.yml index 9060f48..e5806c6 100644 --- a/roles/cgit/tasks/main.yml +++ b/roles/cgit/tasks/main.yml @@ -115,7 +115,7 @@ ansible.builtin.lineinfile: path: "{{ home_user }}/.gitolite.rc" regex: "GIT_CONFIG_KEYS" - line: "\tGIT_CONFIG_KEYS => 'cgit\.owner cgit\.section cgit\.hide cgit\.desc'," + 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: diff --git a/roles/libretls/tasks/main.yml b/roles/libretls/tasks/main.yml index ec63ad0..3b8aea4 100644 --- a/roles/libretls/tasks/main.yml +++ b/roles/libretls/tasks/main.yml @@ -29,6 +29,7 @@ ansible.builtin.git: dest: "{{ path_tmp_git }}" repo: "{{ git }}" + refspec: "{{ tag_git }}" single_branch: yes - name: autoreconf diff --git a/roles/libretls/vars/main.yml b/roles/libretls/vars/main.yml index 3662f0b..403fddb 100644 --- a/roles/libretls/vars/main.yml +++ b/roles/libretls/vars/main.yml @@ -1,6 +1,7 @@ --- git: "https://git.causal.agency/libretls/" +tag_git: "3.7.0" path_tmp_git: "/tmp/libretls" -lib_name: "libtls.so.25" +lib_name: "libtls.so.26.0.1" path_local_lib: "/usr/local/lib/{{ lib_name }}" path_global_lib: "/usr/lib/{{ lib_name }}" diff --git a/roles/pounce/tasks/litterbox.yml b/roles/pounce/tasks/litterbox.yml new file mode 100644 index 0000000..e341ebd --- /dev/null +++ b/roles/pounce/tasks/litterbox.yml @@ -0,0 +1,49 @@ +################################################################################ +# installation de litterbox +# +# 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: création utilisateur litterbox + ansible.builtin.user: + name: "{{ litterbox.user }}" + shell: "/bin/bash" + state: present + +- name: mise en place de litterbox + block: + - name: clonage de litterbox + ansible.builtin.git: + dest: "{{ litterbox.path_tmp_git }}" + repo: "{{ litterbox.git }}" + single_branch: yes + + - name: configuration de la compilation de litterbox + ansible.builtin.command: + cmd: "./configure" + chdir: "{{ litterbox.path_tmp_git }}" + + - name: compilation de litterbox + community.general.make: + chdir: "{{ litterbox.path_tmp_git }}" + + become: yes + become_user: "{{ litterbox.user }}" + +- name: installation de litterbox + community.general.make: + chdir: "{{ litterbox.path_tmp_git }}" + target: install diff --git a/roles/pounce/tasks/main.yml b/roles/pounce/tasks/main.yml new file mode 100644 index 0000000..e96cb0e --- /dev/null +++ b/roles/pounce/tasks/main.yml @@ -0,0 +1,68 @@ +################################################################################ +# installation de pounce et de litterbox, scooper et kcgi +# +# 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: + - bmake + - sqlite3 + - libsqlite3-dev + - universal-ctags + - pkg-config + +- name: création utilisateur pounce + ansible.builtin.user: + name: "{{ user }}" + shell: "/bin/bash" + state: present + +- name: mise en place de pounce + block: + - name: clonage de pounce + ansible.builtin.git: + dest: "{{ path_tmp_git }}" + repo: "{{ git }}" + single_branch: yes + + - name: configuration de la compilation de pounce + ansible.builtin.command: + cmd: "{{ path_tmp_git }}/configure" + chdir: "{{ path_tmp_git }}" + + - name: compilation de pounce + community.general.make: + chdir: "{{ path_tmp_git }}" + + become: yes + become_user: "{{ user }}" + +- name: installation de pounce + community.general.make: + chdir: "{{ path_tmp_git }}" + target: install + +- name: installation du logger + include_role: + name: pounce + tasks_from: litterbox + +- name: installation de l'interface graphique + include_role: + name: pounce + tasks_from: scooper diff --git a/roles/pounce/tasks/scooper.yml b/roles/pounce/tasks/scooper.yml new file mode 100644 index 0000000..ee311bd --- /dev/null +++ b/roles/pounce/tasks/scooper.yml @@ -0,0 +1,78 @@ +################################################################################ +# installation de kcgi et scooper +# +# 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: téléchargement de kcgi + ansible.builtin.get_url: + dest: "{{ kcgi.path_tmp }}" + url: "{{ kcgi.url_file }}" + +- name: décompression de kcgi + ansible.builtin.unarchive: + dest: "{{ kcgi.path_tmp }}" + src: "{{ kcgi.path_tmp }}/{{ kcgi.file_name }}" + list_files: true + register: result + +- name: tset + debug: + msg: "{{ result.files[0] }}" + +- name: modification du makefile + ansible.builtin.command: + cmd: "sed -i -e 's/#CPPFLAG/CPPFLAG/' {{ kcgi.path_tmp }}/{{ result.files[0] }}/Makefile" + +- name: configuration de la compilation de kcgi + ansible.builtin.command: + cmd: "./configure" + chdir: "{{ kcgi.path_tmp }}/{{ result.files[0] }}" + +- name: compilation de kcgi + ansible.builtin.command: + cmd: "bmake" + chdir: "{{ kcgi.path_tmp }}/{{ result.files[0] }}" + +- name: installation de kcgi + ansible.builtin.command: + cmd: "bmake install" + chdir: "{{ kcgi.path_tmp }}/{{ result.files[0] }}" + +- name: mise en place de scooper + block: + - name: téléchargement de scooper + ansible.builtin.git: + dest: "{{ scooper.path_tmp_git }}" + repo: "{{ scooper.git }}" + single_branch: yes + + - name: configuration de la compilation de scooper + ansible.builtin.command: + cmd: "./configure" + chdir: "{{ scooper.path_tmp_git }}" + + - name: compilation de scooper + community.general.make: + chdir: "{{ scooper.path_tmp_git }}" + + - name: installation de scooper + community.general.make: + chdir: "{{ scooper.path_tmp_git }}" + target: install + + become: yes + become_user: "{{ litterbox.user }}" diff --git a/roles/pounce/vars/main.yml b/roles/pounce/vars/main.yml new file mode 100644 index 0000000..f0bfed3 --- /dev/null +++ b/roles/pounce/vars/main.yml @@ -0,0 +1,20 @@ +--- +git: "https://git.causal.agency/pounce" +user: "pounce" +home_user: "/home/{{ user }}" +path_tmp_git: "{{ home_user }}/pounce" + +litterbox: + git: "https://git.causal.agency/litterbox" + user: "litterbox" + home_user: "/home/litterbox" + path_tmp_git: "/home/litterbox/litterbox" + +kcgi: + path_tmp: "/tmp/" + url_file: "https://kristaps.bsd.lv/kcgi/snapshots/kcgi.tgz" + file_name: "kcgi.tgz" + +scooper: + path_tmp_git: "{{ litterbox.home_user }}/scooper" + git: "https://git.causal.agency/scooper/" diff --git a/vars/sites.yml b/vars/sites.yml index 9923358..ea25b10 100644 --- a/vars/sites.yml +++ b/vars/sites.yml @@ -1,8 +1,13 @@ --- +# contient les différents noms de domaines ainsi que les informations de base +# de la machine qui peuvent être utilisées dans ni'mporte quel rôle. + +# nom-service_site site: "" cgit_site: "" +pounce_site: "" -user_default: "ubuntu" +user_default: "" home_user_default: "/home/{{ user_default }}" ava: "/etc/nginx/sites-available" ena: "/etc/nginx/sites-enabled"