add main site
This commit is contained in:
parent
c7b6f93205
commit
57ff2b71f4
5 changed files with 102 additions and 0 deletions
7
roles/site/files/install-packages.el
Normal file
7
roles/site/files/install-packages.el
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
(require 'package)
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa" . "https://stable.melpa.org/packages/") t)
|
||||||
|
(package-initialize)
|
||||||
|
(package-initialize)
|
||||||
|
(package-refresh-contents)
|
||||||
|
(package-install 'htmlize)
|
74
roles/site/tasks/main.yml
Normal file
74
roles/site/tasks/main.yml
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
################################################################################
|
||||||
|
# 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: update de la machine
|
||||||
|
apt:
|
||||||
|
update_cache: true
|
||||||
|
upgrade: yes
|
||||||
|
|
||||||
|
- name: installation des paquets nécessaires
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- emacs
|
||||||
|
|
||||||
|
- name: installation de htmlize
|
||||||
|
block:
|
||||||
|
- name: copie du script d'installation
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "../files/install-packages.el"
|
||||||
|
dest: "/tmp/init.el"
|
||||||
|
|
||||||
|
- name: installation de htmlize
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "emacs -u {{ user }} --script /tmp/init.el"
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: clonage du site
|
||||||
|
ansible.builtin.git:
|
||||||
|
dest: "{{ path_clone }}"
|
||||||
|
repo: "{{ git }}"
|
||||||
|
single_branch: yes
|
||||||
|
|
||||||
|
- name: compilation du site
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "{{ path_clone }}/generate.sh"
|
||||||
|
chdir: "{{ path_clone }}"
|
||||||
|
|
||||||
|
- name: génération du lien symbolique
|
||||||
|
file:
|
||||||
|
src: "{{ path_clone }}/www"
|
||||||
|
path: "{{ path_site }}"
|
||||||
|
state: link
|
||||||
|
|
||||||
|
- name: configuration de nginx
|
||||||
|
template:
|
||||||
|
src: "site-nginx"
|
||||||
|
dest: "{{ ava }}/gyiwr.conf"
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: suppression de la configuration par défaut
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ ena }}/default"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: lien symbolique pour le site
|
||||||
|
file:
|
||||||
|
src: "{{ ava }}/gyiwr.conf"
|
||||||
|
dest: "{{ ena }}/gyiwr.conf"
|
||||||
|
state: link
|
13
roles/site/templates/site-nginx
Normal file
13
roles/site/templates/site-nginx
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
server {
|
||||||
|
server_name {{ site }};
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
root {{ path_site }};
|
||||||
|
|
||||||
|
index index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
}
|
4
vars/principal.yml
Normal file
4
vars/principal.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
path_site: "/var/www/gyiwr"
|
||||||
|
git: "https://git.gyiwr.tf/gyiwr"
|
||||||
|
path_clone: "/home/ubuntu/gyiwr"
|
|
@ -1,3 +1,7 @@
|
||||||
---
|
---
|
||||||
site: ""
|
site: ""
|
||||||
cgit_site: ""
|
cgit_site: ""
|
||||||
|
|
||||||
|
user: "ubuntu"
|
||||||
|
ava: "/etc/nginx/sites-available"
|
||||||
|
ena: "/etc/nginx/sites-enabled"
|
||||||
|
|
Loading…
Reference in a new issue