Compare commits
3 Commits
wip
...
d42dfc8c5c
Author | SHA1 | Date | |
---|---|---|---|
d42dfc8c5c | |||
e7a8c8aa1c
|
|||
75ee5be87d
|
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,8 +1,5 @@
|
||||
# Vagrant files
|
||||
environments
|
||||
*.log
|
||||
.playbook
|
||||
.vagrant
|
||||
|
||||
# Unneeded ansible file
|
||||
*.retry
|
||||
|
||||
# Custom environments
|
||||
/environments/
|
||||
.vscode
|
||||
|
9
Makefile
Normal file
9
Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
all: vagrant
|
||||
|
||||
vagrant:
|
||||
vagrant up --no-destroy-on-error --no-color | tee ./vagrantup.log
|
||||
./forward-ssh.sh
|
||||
|
||||
clean:
|
||||
vagrant destroy -f --no-color
|
||||
rm -rf .vagrant ./*.log
|
34
README.md
34
README.md
@@ -1,22 +1,30 @@
|
||||
# Free I.T. Athen’s Infrastructure
|
||||
Ansible code used to deploy and maintain websites and services used by Free I.T. Athens.
|
||||
# Free I.T. Athen's Infrastructure
|
||||
This project is used to develop Ansible for deploying and maintaining websites
|
||||
and services operated by Free I.T. Athens (FRITA).
|
||||
|
||||
## Getting Started
|
||||
frita-infra is developed in Ansible 2.7.5 using Vagrant 2.2.2 + vagrant-libvirt as a test environment.
|
||||
- Requires GNU Make, Ansible, and Vagrant on the host
|
||||
|
||||
Check it out by simply typing: `vagrant up`
|
||||
|
||||
## Versioning
|
||||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the tags on this repository.
|
||||
## Quick Start
|
||||
1. Clone this project
|
||||
2. Run `make` to provision a Debian 11 base box
|
||||
3. Go to
|
||||
- [Traefik Dashboard](https://traefik.local.freeitathens.org:8443/dashboard/#/)
|
||||
- [WordPress](https://www.local.freeitathens.org)
|
||||
4. Click through the HTTPS security warning
|
||||
|
||||
## Authors
|
||||
* **Kris Lamoureux** - *Project Founder* - [krislamo](https://github.com/krislamo)
|
||||
* **Kris Lamoureux** - *Project Founder* - [@krislamo](https://github.com/krislamo)
|
||||
|
||||
## Copyrights and Licenses
|
||||
Copyright (C) 2019 Free I.T. Athens
|
||||
Copyright (C) 2019, 2020, 2022 Free I.T. Athens
|
||||
|
||||
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, version 3 of the License.
|
||||
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, version 3 of the License.
|
||||
|
||||
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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
42
Vagrantfile
vendored
42
Vagrantfile
vendored
@@ -1,28 +1,24 @@
|
||||
# Copyright (C) 2019 Free I.T. Athens
|
||||
#
|
||||
# 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, version 3 of the License.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Set PLAYBOOK shell var for ./dev/playbook.yml
|
||||
PLAYBOOK=ENV["PLAYBOOK"]
|
||||
if !PLAYBOOK
|
||||
if File.exist?('.playbook')
|
||||
PLAYBOOK = IO.read('.playbook').split("\n")[0]
|
||||
end
|
||||
|
||||
if !PLAYBOOK || PLAYBOOK.empty?
|
||||
PLAYBOOK = "webserver"
|
||||
end
|
||||
else
|
||||
File.write(".playbook", PLAYBOOK)
|
||||
end
|
||||
|
||||
# Debian 11
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
# Debian Stable box
|
||||
config.vm.box = "debian/stretch64"
|
||||
config.vm.box = "debian/bullseye64"
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
|
||||
# Set static IP
|
||||
config.vm.network "private_network", ip: "192.168.121.2"
|
||||
config.vm.network "private_network", type: "dhcp"
|
||||
|
||||
# Machine Name
|
||||
config.vm.define :frita do |frita| #
|
||||
@@ -35,9 +31,9 @@ Vagrant.configure("2") do |config|
|
||||
|
||||
# Provision with Ansible
|
||||
config.vm.provision "ansible" do |ansible|
|
||||
ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles"
|
||||
ansible.compatibility_mode = "2.0"
|
||||
ansible.playbook = "site.yml"
|
||||
ansible.playbook = "dev/" + PLAYBOOK + ".yml"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
[defaults]
|
||||
inventory = ./environments/development
|
||||
interpreter_python = /usr/bin/python
|
||||
interpreter_python = /usr/bin/python3
|
||||
|
||||
[ssh_connection]
|
||||
pipelining=True
|
||||
|
||||
|
46
dev/vars/webserver.yml
Normal file
46
dev/vars/webserver.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
###############
|
||||
### Secrets ###
|
||||
###############
|
||||
secret:
|
||||
WORDPRESS_DB_PASSWORD: WPpa55w0rd!
|
||||
|
||||
##############
|
||||
### Docker ###
|
||||
##############
|
||||
docker_users:
|
||||
- vagrant
|
||||
|
||||
################
|
||||
#### MariaDB ###
|
||||
################
|
||||
databases:
|
||||
- name: wordpress
|
||||
pass: "{{ secret.WORDPRESS_DB_PASSWORD }}"
|
||||
|
||||
#######################
|
||||
### Webserver Stack ###
|
||||
#######################
|
||||
webserver:
|
||||
###############
|
||||
### Traefik ###
|
||||
###############
|
||||
#TRAEFIK_VERSION: latest
|
||||
#TRAEFIK_ROOT_DOMAIN: local.freeitathens.org
|
||||
#TRAEFIK_DOMAIN: traefik.local.freeitathens.org
|
||||
#TRAEFIK_DASHBOARD: true
|
||||
#TRAEFIK_EXPOSED_DEFAULT: false
|
||||
#TRAEFIK_WEB_ENABLED: true
|
||||
TRAEFIK_DEBUG: true
|
||||
TRAEFIK_ACME_PROVIDER: dreamhost
|
||||
TRAEFIK_ACME_CASERVER: https://acme-v02.api.letsencrypt.org/directory
|
||||
TRAEFIK_ACME_EMAIL: frita@example.org
|
||||
|
||||
#################
|
||||
### WordPress ###
|
||||
#################
|
||||
#WORDPRESS_VERSION: latest
|
||||
#WORDPRESS_DOMAIN: www.local.freeitathens.org
|
||||
#WORDPRESS_DB_HOST: host.docker.internal
|
||||
#WORDPRESS_DB_NAME: wordpress
|
||||
#WORDPRESS_DB_USER: wordpress
|
||||
WORDPRESS_DB_PASSWORD: "{{ secret.WORDPRESS_DB_PASSWORD }}"
|
9
dev/webserver.yml
Normal file
9
dev/webserver.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- name: Install FRITA Web Server
|
||||
hosts: all
|
||||
become: true
|
||||
vars_files:
|
||||
- vars/webserver.yml
|
||||
roles:
|
||||
- common
|
||||
- docker
|
||||
- webserver
|
26
forward-ssh.sh
Executable file
26
forward-ssh.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Finds the SSH private key under ./.vagrant and connects to
|
||||
# the Vagrant box, port forwarding localhost ports: 8443, 80, 443
|
||||
PRIVATE_KEY="$(find .vagrant -name "private_key")"
|
||||
HOST_IP="$(vagrant ssh -c "hostname -I | cut -d' ' -f2" 2>/dev/null)"
|
||||
MATCH_PATTERN="ssh -fNT -i ${PRIVATE_KEY}.*vagrant@"
|
||||
|
||||
function ssh_connect {
|
||||
sudo ssh -fNT -i "$PRIVATE_KEY" \
|
||||
-L 8443:localhost:8443 \
|
||||
-L 80:localhost:80 \
|
||||
-L 443:localhost:443 \
|
||||
-o UserKnownHostsFile=/dev/null \
|
||||
-o StrictHostKeyChecking=no \
|
||||
vagrant@"${HOST_IP::-1}" 2>/dev/null
|
||||
}
|
||||
|
||||
set -x
|
||||
if [ "$(pgrep -afc "$MATCH_PATTERN")" -eq 0 ]; then
|
||||
ssh_connect
|
||||
else
|
||||
pgrep -f "$MATCH_PATTERN" | xargs sudo kill -9
|
||||
ssh_connect
|
||||
fi
|
||||
set +x
|
@@ -1,46 +0,0 @@
|
||||
### WordPress Configuration ###
|
||||
|
||||
# Domain
|
||||
wp_domain: www.freeitathens.org
|
||||
wp_admin_email: contact@freeitathens.org
|
||||
|
||||
# Version of WordPress to deploy
|
||||
wp_version: 5.1.1
|
||||
wp_sha1_hash: f1bff89cc360bf5ef7086594e8a9b68b4cbf2192
|
||||
|
||||
# WordPress Home Directory
|
||||
# Note: value is a directory without trailing '/'
|
||||
wp_dir: /var/www/wordpress
|
||||
|
||||
# WordPress Database Settings
|
||||
wp_db_host: localhost
|
||||
wp_db_name: wordpress
|
||||
wp_db_user: wordpress_user
|
||||
wp_db_pass: Password1
|
||||
wp_db_table_prefix: wp_
|
||||
|
||||
|
||||
### Nextcloud Configuration ###
|
||||
|
||||
# Domain
|
||||
nc_domain: cloud.freeitathens.org
|
||||
nc_admin_email: contact@freeitathens.org
|
||||
|
||||
# Version of Nextcloud to deploy
|
||||
nc_version: 15.0.2
|
||||
nc_sha256_hash: c1f4cc33e39994ddbe6777370b62c30b7ae52136a0530c0b9922770803ca0fea
|
||||
|
||||
# Nextcloud Home Directory
|
||||
# Note: value is a directory without trailing '/'
|
||||
nc_dir: /var/www/nextcloud
|
||||
|
||||
# Nextcloud Database Settings
|
||||
nc_db_host: localhost
|
||||
nc_db_name: nextcloud
|
||||
nc_db_user: nextcloud_user
|
||||
nc_db_pass: Password1
|
||||
|
||||
# Nextcloud Admin
|
||||
nc_admin: admin
|
||||
nc_admin_pass: Password1
|
||||
|
@@ -1,22 +0,0 @@
|
||||
- name: 'Install Ansible dependency: python-apt'
|
||||
shell: 'apt-get update && apt-get install python-apt -y'
|
||||
args:
|
||||
creates: /usr/lib/python2.7/dist-packages/apt
|
||||
warn: false
|
||||
|
||||
- name: 'Install Ansible dependency: aptitude'
|
||||
apt:
|
||||
name: 'aptitude'
|
||||
state: present
|
||||
force_apt_get: true
|
||||
|
||||
- name: 'Install Ansible dependency: python-docker'
|
||||
apt:
|
||||
name: python-docker
|
||||
state: present
|
||||
|
||||
- name: Create Ansible's temporary directory
|
||||
file:
|
||||
path: /root/.ansible/tmp
|
||||
state: directory
|
||||
mode: '0700'
|
30
roles/common/tasks/main.yml
Normal file
30
roles/common/tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
- name: Create Ansible's temporary remote directory
|
||||
ansible.builtin.file:
|
||||
path: "~/.ansible/tmp"
|
||||
state: directory
|
||||
mode: 0700
|
||||
|
||||
- name: Install the Uncomplicated Firewall
|
||||
ansible.builtin.apt:
|
||||
name: ufw
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Deny incoming traffic by default
|
||||
community.general.ufw:
|
||||
default: deny
|
||||
direction: incoming
|
||||
|
||||
- name: Allow outgoing traffic by default
|
||||
community.general.ufw:
|
||||
default: allow
|
||||
direction: outgoing
|
||||
|
||||
- name: Allow OpenSSH with rate limiting
|
||||
community.general.ufw:
|
||||
name: ssh
|
||||
rule: limit
|
||||
|
||||
- name: Enable firewall
|
||||
community.general.ufw:
|
||||
state: enabled
|
3
roles/docker/defaults/main.yml
Normal file
3
roles/docker/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
docker_compose_root: /var/lib/compose
|
||||
docker_compose: /usr/bin/docker-compose
|
||||
docker_compose_service: compose
|
24
roles/docker/tasks/main.yml
Normal file
24
roles/docker/tasks/main.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
- name: Install Docker
|
||||
ansible.builtin.apt:
|
||||
name: ['docker.io', 'docker-compose']
|
||||
state: present
|
||||
|
||||
- name: Create docker-compose root
|
||||
ansible.builtin.file:
|
||||
path: "{{ docker_compose_root }}"
|
||||
state: directory
|
||||
mode: 0600
|
||||
|
||||
- name: Add users to docker group
|
||||
ansible.builtin.user:
|
||||
name: "{{ item }}"
|
||||
groups: docker
|
||||
append: true
|
||||
loop: "{{ docker_users }}"
|
||||
when: docker_users is defined
|
||||
|
||||
- name: Start Docker and enable on boot
|
||||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: started
|
||||
enabled: true
|
4
roles/webserver/defaults/main.yml
Normal file
4
roles/webserver/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
webserver_root: "{{ docker_compose_root }}/webserver"
|
||||
mariadb_trust:
|
||||
- "172.16.0.0/12"
|
||||
- "192.168.0.0/16"
|
67
roles/webserver/files/docker-compose.yml
Normal file
67
roles/webserver/files/docker-compose.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
version: '3.5'
|
||||
|
||||
volumes:
|
||||
wordpress:
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
name: traefik
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: traefik:${TRAEFIK_VERSION:-latest}
|
||||
restart: always
|
||||
command:
|
||||
- --api.dashboard=${TRAEFIK_DASHBOARD:-true}
|
||||
- --api.debug=${TRAEFIK_DEBUG:-false}
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedbydefault=${TRAEFIK_EXPOSED_DEFAULT:-false}
|
||||
- --entrypoints.web.address=:80
|
||||
- --entrypoints.websecure.address=:443
|
||||
- --entrypoints.local.address=:8443
|
||||
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
||||
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
||||
- --entrypoints.web.http.redirections.entrypoint.permanent=true
|
||||
- --certificatesresolvers.letsencrypt.acme.email=${TRAEFIK_ACME_EMAIL}
|
||||
- --certificatesresolvers.letsencrypt.acme.storage=acme.json
|
||||
- --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=${TRAEFIK_ACME_PROVIDER}
|
||||
- --certificatesresolvers.letsencrypt.acme.dnschallenge.delaybeforecheck=0
|
||||
- --certificatesresolvers.letsencrypt.acme.caserver=${TRAEFIK_ACME_CASERVER:-https://acme-staging-v02.api.letsencrypt.org/directory}
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- "127.0.0.1:8443:8443"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
labels:
|
||||
traefik.http.routers.api.rule: Host(`${TRAEFIK_DOMAIN:-traefik.local.freeitathens.org}`)
|
||||
traefik.http.routers.api.entrypoints: local
|
||||
traefik.http.routers.api.service: api@internal
|
||||
traefik.http.routers.api.tls: true
|
||||
traefik.http.routers.api.tls.domains[0].main: ${TRAEFIK_ROOT_DOMAIN:-local.freeitathens.org}
|
||||
traefik.http.routers.api.tls.domains[0].sans: "*.${TRAEFIK_ROOT_DOMAIN:-local.freeitathens.org}"
|
||||
traefik.enable: ${TRAEFIK_WEB_ENABLED:-true}
|
||||
networks:
|
||||
- traefik
|
||||
|
||||
wordpress:
|
||||
image: wordpress:${WORDPRESS_VERSION:-latest}
|
||||
restart: always
|
||||
environment:
|
||||
WORDPRESS_DB_HOST: ${WORDPRESS_DB_HOST:-host.docker.internal}
|
||||
WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME-wordpress}
|
||||
WORDPRESS_DB_USER: ${WORDPRESS_DB_USER:-wordpress}
|
||||
WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD}
|
||||
labels:
|
||||
traefik.http.routers.wordpress.rule: Host(`${WORDPRESS_DOMAIN:-www.local.freeitathens.org}`)
|
||||
traefik.http.routers.wordpress.entrypoints: websecure
|
||||
traefik.http.routers.wordpress.tls: true
|
||||
traefik.http.services.wordpress.loadbalancer.server.port: 80
|
||||
traefik.docker.network: traefik
|
||||
traefik.enable: ${WORDPRESS_WEB_ENABLED:-true}
|
||||
volumes:
|
||||
- wordpress:/var/www/html
|
||||
networks:
|
||||
- traefik
|
||||
extra_hosts:
|
||||
- host.docker.internal:host-gateway
|
@@ -1,18 +1,11 @@
|
||||
# Copyright (C) 2019 Free I.T. Athens
|
||||
#
|
||||
# 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, version 3 of the License.
|
||||
#
|
||||
# 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: Reload Apache2
|
||||
service: name=apache2 state=reloaded
|
||||
- name: Compose up on webserver stack
|
||||
ansible.builtin.command: "docker-compose up -d"
|
||||
args:
|
||||
chdir: "{{ webserver_root }}"
|
||||
listen: composeup_webserver
|
||||
|
||||
- name: Restart MariaDB
|
||||
ansible.builtin.service:
|
||||
name: mariadb
|
||||
state: restarted
|
||||
listen: restart_mariadb
|
||||
|
@@ -1,40 +1,72 @@
|
||||
# Copyright (C) 2019 Free I.T. Athens
|
||||
#
|
||||
# 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, version 3 of the License.
|
||||
#
|
||||
# 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: Install Apache2 Web Server
|
||||
apt:
|
||||
name: apache2
|
||||
state: present
|
||||
|
||||
- name: Start Apache2 Web Server
|
||||
service:
|
||||
name: apache2
|
||||
state: started
|
||||
|
||||
- name: Install PHP
|
||||
apt:
|
||||
name: php
|
||||
state: present
|
||||
|
||||
- name: Install PHP MySQL Extension
|
||||
apt:
|
||||
name: php-mysql
|
||||
state: present
|
||||
notify: Reload Apache2
|
||||
|
||||
- name: Install MariaDB Server
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: mariadb-server
|
||||
state: present
|
||||
|
||||
- name: Change the bind-address to allow Docker
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||
regex: "^bind-address"
|
||||
line: "bind-address = 0.0.0.0"
|
||||
notify: restart_mariadb
|
||||
|
||||
- name: Install MySQL Support for Python 3
|
||||
ansible.builtin.apt:
|
||||
name: python3-pymysql
|
||||
state: present
|
||||
|
||||
- name: Create MariaDB databases
|
||||
community.mysql.mysql_db:
|
||||
name: "{{ item.name }}"
|
||||
state: present
|
||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||
loop: "{{ databases }}"
|
||||
no_log: "{{ item.pass is defined }}"
|
||||
|
||||
- name: Create MariaDB users
|
||||
community.mysql.mysql_user:
|
||||
name: "{{ item.name }}"
|
||||
password: "{{ item.pass }}"
|
||||
host: '%'
|
||||
state: present
|
||||
priv: "{{ item.name }}.*:ALL"
|
||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||
loop: "{{ databases }}"
|
||||
no_log: "{{ item.pass is defined }}"
|
||||
|
||||
- name: Create webserver docker-compose directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ webserver_root }}"
|
||||
state: directory
|
||||
mode: 0600
|
||||
|
||||
- name: Install webserver docker-compose.yml
|
||||
ansible.builtin.copy:
|
||||
src: docker-compose.yml
|
||||
dest: "{{ webserver_root }}/docker-compose.yml"
|
||||
mode: 0600
|
||||
notify: composeup_webserver
|
||||
|
||||
- name: Install docker-compose .env
|
||||
ansible.builtin.template:
|
||||
src: compose-env.j2
|
||||
dest: "{{ webserver_root }}/.env"
|
||||
mode: 0600
|
||||
notify: composeup_webserver
|
||||
|
||||
- name: Allow MariaDB database connections
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: 3306
|
||||
proto: tcp
|
||||
src: "{{ item }}"
|
||||
loop: "{{ mariadb_trust }}"
|
||||
|
||||
- name: Add HTTP and HTTPS firewall rule
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: "{{ item }}"
|
||||
proto: tcp
|
||||
loop:
|
||||
- "80"
|
||||
- "443"
|
||||
|
4
roles/webserver/templates/compose-env.j2
Normal file
4
roles/webserver/templates/compose-env.j2
Normal file
@@ -0,0 +1,4 @@
|
||||
# {{ ansible_managed }}
|
||||
{% for key, value in webserver.items() %}
|
||||
{{ key }}={{ value }}
|
||||
{% endfor %}
|
@@ -1,24 +1,7 @@
|
||||
# Copyright (C) 2019 Free I.T. Athens
|
||||
#
|
||||
# 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, version 3 of the License.
|
||||
#
|
||||
# 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: Install FRITA Web Server
|
||||
hosts: all
|
||||
become: yes
|
||||
become: true
|
||||
roles:
|
||||
- ansible
|
||||
- common
|
||||
- docker
|
||||
- webserver
|
||||
- wordpress
|
||||
- nextcloud
|
||||
- timetrex
|
||||
|
Reference in New Issue
Block a user