ADD DNSDist(DoH DoT) service
This commit is contained in:
parent
9670b323c0
commit
b5852d788d
|
@ -1,11 +1,12 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
- hosts: test
|
- hosts: test
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
|
|
||||||
# déclaration de la variables globales
|
# déclaration de la variables globales
|
||||||
vars:
|
vars:
|
||||||
email: your_email@your_domain.com
|
email: kitoy@kitoy.me
|
||||||
cthostname: machine_hostname
|
cthostname: tablette
|
||||||
domain: domain_name
|
domain: kitoy.me
|
||||||
create_user: false
|
create_user: false
|
||||||
|
installCertbot: false
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
---
|
---
|
||||||
- hosts: bim
|
- hosts: test
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
- rbenv
|
- rbenv
|
||||||
- nginx
|
- nginx
|
||||||
- postgresql
|
- postgresql
|
||||||
- mastodon
|
- nodejs
|
||||||
|
- yarn
|
||||||
|
- mastodon
|
||||||
|
|
||||||
# Déclaration des variables globales
|
# Déclaration des variables globales
|
||||||
vars:
|
vars:
|
||||||
email: contact@bim.land
|
email: contact@bim.land
|
||||||
domain: social.bim.land
|
domain: social.bim.land
|
||||||
cthostname: social
|
cthostname: social
|
||||||
create_user: true
|
create_user: True
|
||||||
username: mastodon
|
username: mastodon
|
||||||
installCertbot: true
|
installCertbot: True
|
||||||
debian_version: buster
|
debian_version: bullseye
|
||||||
nodejs_version: 12
|
nodejs_version: 14
|
||||||
ruby_version: 2.7.2
|
ruby_version: 2.7.5
|
||||||
|
mastodon_version: 3.4.10
|
||||||
|
restore: True
|
||||||
|
|
|
@ -4,7 +4,6 @@ commonRequirePackages:
|
||||||
- man
|
- man
|
||||||
- bash-completion
|
- bash-completion
|
||||||
- locales
|
- locales
|
||||||
- python-pip
|
|
||||||
- wget
|
- wget
|
||||||
- bzip2
|
- bzip2
|
||||||
- lsof
|
- lsof
|
||||||
|
|
|
@ -28,3 +28,7 @@ requiredPackages:
|
||||||
- libjemalloc-dev
|
- libjemalloc-dev
|
||||||
- redis-tools
|
- redis-tools
|
||||||
- redis-server
|
- redis-server
|
||||||
|
- gnupg
|
||||||
|
- apt-transport-https
|
||||||
|
- lsb-release
|
||||||
|
- ca-certificates
|
||||||
|
|
|
@ -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
|
- name: Install required by mastodon
|
||||||
apt:
|
apt:
|
||||||
name: "{{ requiredPackages }}"
|
name: "{{ requiredPackages }}"
|
||||||
state: present
|
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
|
- name: Install Mastodon from git
|
||||||
become: yes
|
become: yes
|
||||||
become_user: "{{ username }}"
|
become_user: "{{ username }}"
|
||||||
|
@ -44,24 +33,27 @@
|
||||||
eval "$(rbenv init -)"
|
eval "$(rbenv init -)"
|
||||||
git clone https://github.com/tootsuite/mastodon.git live
|
git clone https://github.com/tootsuite/mastodon.git live
|
||||||
cd 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
|
gem install bundler --no-document
|
||||||
bundle config set deployment 'true'
|
bundle config set deployment 'true'
|
||||||
bundle config set without 'development test'
|
bundle config set without 'development test'
|
||||||
bundle install
|
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
|
yarn install --pure-lockfile --non-interactive
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
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
|
- name: Copy nginx configuration
|
||||||
copy:
|
copy:
|
||||||
|
|
|
@ -2,4 +2,4 @@ requiredPackages:
|
||||||
- apt-transport-https
|
- apt-transport-https
|
||||||
|
|
||||||
nodejs_version: 12
|
nodejs_version: 12
|
||||||
debian_version: buster
|
debian_version: bullseyes
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
|
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add Nodes 12 repository
|
- name: Add Nodes {{nodejs_version }} repository
|
||||||
apt_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
|
state: present
|
||||||
|
|
||||||
- name: Install NodeJs
|
- name: Install NodeJs
|
||||||
|
|
|
@ -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
|
- name: Install Postresql Server
|
||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
- postgresql
|
- postgresql
|
||||||
- postgresql-contrib
|
- postgresql-contrib
|
||||||
- python-psycopg2
|
- python3-psycopg2
|
||||||
|
|
|
@ -4,16 +4,6 @@
|
||||||
name: "{{ requiredPackages }}"
|
name: "{{ requiredPackages }}"
|
||||||
state: present
|
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
|
- name: Install rbenv
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -33,7 +23,7 @@
|
||||||
cd ~
|
cd ~
|
||||||
export PATH="$HOME/.rbenv/bin:$PATH"
|
export PATH="$HOME/.rbenv/bin:$PATH"
|
||||||
eval "$(rbenv init -)"
|
eval "$(rbenv init -)"
|
||||||
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install "{{ ruby_version }}"
|
rbenv install "{{ ruby_version }}"
|
||||||
rbenv global "{{ ruby_version }}"
|
rbenv global "{{ ruby_version }}"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
when: installCertbot == False
|
when: installCertbot == False
|
||||||
|
|
||||||
- name: Create self-signed certificate, if configured.
|
- 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
|
when: installCertbot == False
|
||||||
|
|
||||||
- name: Create self-signed certificate, if configured.
|
- 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
|
when: installCertbot == True
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
---
|
---
|
||||||
---
|
|
||||||
|
|
||||||
- name: Add Yarn apt key
|
- name: Add Yarn apt key
|
||||||
apt_key:
|
apt_key:
|
||||||
|
|
Loading…
Reference in New Issue