ADD DNSDist(DoH DoT) service

This commit is contained in:
kitoy 2023-05-22 14:51:55 +02:00
parent 9670b323c0
commit b5852d788d
11 changed files with 73 additions and 74 deletions

View File

@ -1,11 +1,12 @@
---
- hosts: test
roles:
- common
# déclaration de la variables globales
vars:
email: your_email@your_domain.com
cthostname: machine_hostname
domain: domain_name
email: kitoy@kitoy.me
cthostname: tablette
domain: kitoy.me
create_user: false
installCertbot: false

View File

@ -1,20 +1,24 @@
---
- hosts: bim
- hosts: test
roles:
- common
- rbenv
- nginx
- postgresql
- mastodon
- common
- rbenv
- nginx
- postgresql
- nodejs
- yarn
- mastodon
# Déclaration des variables globales
vars:
email: contact@bim.land
domain: social.bim.land
cthostname: social
create_user: true
create_user: True
username: mastodon
installCertbot: true
debian_version: buster
nodejs_version: 12
ruby_version: 2.7.2
installCertbot: True
debian_version: bullseye
nodejs_version: 14
ruby_version: 2.7.5
mastodon_version: 3.4.10
restore: True

View File

@ -4,7 +4,6 @@ commonRequirePackages:
- man
- bash-completion
- locales
- python-pip
- wget
- bzip2
- lsof

View File

@ -28,3 +28,7 @@ requiredPackages:
- libjemalloc-dev
- redis-tools
- redis-server
- gnupg
- apt-transport-https
- lsb-release
- ca-certificates

View File

@ -1,40 +1,29 @@
---
- name: Add Yarn apt key
apt_key:
url: https://dl.yarnpkg.com/debian/pubkey.gpg
state: present
- name: Add Yarn Repository
apt_repository:
repo: deb https://dl.yarnpkg.com/debian/ stable main
state: present
- name: Install Yarn
apt:
name: yarn
state: present
- name: Add Nodejs apt key
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
- name: Add Nodes 12 repository
apt_repository:
repo: deb https://deb.nodesource.com/node_12.x buster main
state: present
- name: Install NodeJs
apt:
name: nodejs
state: present
- name: Install required by mastodon
apt:
name: "{{ requiredPackages }}"
state: present
- name: ensure postgresql is running
service:
name: postgresql
state: restarted
- name: Create postgresql User Mastodon
become: yes
become_user: postgres
shell: psql -c "CREATE USER mastodon CREATEDB;"
- name: Create Mastodon Database for restauration
become: yes
become_user: "{{ username }}"
shell: |
createdb -T template0 -E UTF8 mastodon_production
args:
executable: /bin/bash
when: restore == True
- name: Install Mastodon from git
become: yes
become_user: "{{ username }}"
@ -44,24 +33,27 @@
eval "$(rbenv init -)"
git clone https://github.com/tootsuite/mastodon.git live
cd live
git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
git checkout v"{{ mastodon_version }}"
gem install bundler --no-document
bundle config set deployment 'true'
bundle config set without 'development test'
bundle install
args:
executable: /bin/bash
- name: Exec yarn install
become: yes
become_user: "{{ username }}"
ignore_errors: True
shell: |
cd
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
cd live
yarn install --pure-lockfile --non-interactive
args:
executable: /bin/bash
- name: ensure postgresql is running
service:
name: postgresql
state: restarted
- name: Create postgresql Database
become: yes
become_user: postgres
shell: psql -c "CREATE USER mastodon CREATEDB;"
- name: Copy nginx configuration
copy:

View File

@ -2,4 +2,4 @@ requiredPackages:
- apt-transport-https
nodejs_version: 12
debian_version: buster
debian_version: bullseyes

View File

@ -3,9 +3,9 @@
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
- name: Add Nodes 12 repository
- name: Add Nodes {{nodejs_version }} repository
apt_repository:
repo: deb https://deb.nodesource.com/node_"{{ nodejs_version }}".x "{{ debian_version }}" main
repo: deb https://deb.nodesource.com/node_{{ nodejs_version }}.x {{ debian_version }} main
state: present
- name: Install NodeJs

View File

@ -1,8 +1,18 @@
---
- name: Add Postgresql apt key
apt_key:
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
state: present
- name: Add Postgresql Repository
apt_repository:
repo: deb http://apt.postgresql.org/pub/repos/apt {{ debian_version }}-pgdg main
state: present
- name: Install Postresql Server
apt:
name:
- postgresql
- postgresql-contrib
- python-psycopg2
- python3-psycopg2

View File

@ -4,16 +4,6 @@
name: "{{ requiredPackages }}"
state: present
- name: Copy rbenv installer
become: yes
become_user: "{{ username }}"
copy:
src: rbenv_installer.sh
dest: rbenv_installer.sh
owner: "{{ username }}"
group: "{{ username }}"
mode: 0755
when: create_user
- name: Install rbenv
become: yes
@ -33,7 +23,7 @@
cd ~
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install "{{ ruby_version }}"
rbenv install "{{ ruby_version }}"
rbenv global "{{ ruby_version }}"
args:
executable: /bin/bash

View File

@ -17,9 +17,9 @@
when: installCertbot == False
- name: Create self-signed certificate, if configured.
shell: "openssl req -x509 -nodes -subj '/CN={{ domain }}' -days 365 -newkey rsa:4096 -sha256 -keyout /etc/server/{{ domain }}/server.key -out /etc/server/{{ domain }}/server.crt"
shell: openssl req -x509 -nodes -subj '/CN={{ domain }}' -days 3650 -newkey rsa:4096 -sha256 -keyout /etc/ssl/"{{ domain }}".key -out /etc/ssl/"{{ domain }}".crt
when: installCertbot == False
- name: Create self-signed certificate, if configured.
shell: "certbot -certonly -d {{ domain }} --nginx -m contact@bim.land --agree-tos"
shell: "certbot -certonly -d {{ domain }} {{ alt_domains }} --{{ mode }} -m {{ email }} --agree-tos"
when: installCertbot == True

View File

@ -1,5 +1,4 @@
---
---
- name: Add Yarn apt key
apt_key: