feat: Ajout des profiles

This commit is contained in:
xavier committed 2024-02-10 01:13:40 +00:00
1 parent 9be5866a4d
commit 0a62df7352
12 files changed
+354

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
name: gitea
description: Install gitea
config:
cloud-init.vendor-data: |
#cloud-config
timezone: Europe/Paris
locale: fr_FR.UTF-8
# Packages
package_update: true
package_upgrade: true
packages:
- unzip
# Users
users:
- default
- name: gitea
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
# Configure second network interface
write_files:
- path: "/etc/netplan/eth1.yaml"
permissions: "0755"
content: |
network:
version: 2
ethernets:
eth1:
dhcp4: true
runcmd:
# Apply network config
- [ netplan, generate ]
- [ netplan, apply ]
# Install gitea
- [ snap, install, gitea ]
@@ -0,0 +1,33 @@
name: nextcloud
description: Install Nextcloud
config:
cloud-init.vendor-data: |
#cloud-config
# Regional settings
timezone: Europe/Paris
locale: fr_FR.UTF-8
# Packages
package_update: true
package_upgrade: true
packages: []
# Users
users:
- default
- name: nextcloud
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
runcmd:
# Install Nextcloud
- [ snap, install, nextcloud ]
devices:
nextcloud-data:
type: disk
pool: zfs
source: nextcloud-data
path: /var/snap/nextcloud
@@ -0,0 +1,17 @@
name: postgresql
description: Install postgresql
config:
cloud-init.vendor-data: |
#cloud-config
package_update: true
package_upgrade: true
timezone: Europe/Paris
locale: fr_FR.UTF-8
users:
- default
- name: postgres
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
runcmd:
- [ snap, install, postgresql96 ]
@@ -0,0 +1,17 @@
name: postgresql
description: Install postgresql
config:
cloud-init.vendor-data: |
#cloud-config
package_update: true
package_upgrade: true
packages:
- postgresql
timezone: Europe/Paris
locale: fr_FR.UTF-8
devices:
postgresql-data:
type: disk
pool: zfs
source: postgresql-data
path: /var/lib/postgresql
@@ -0,0 +1,42 @@
name: traefik
description: Install traefik
config:
cloud-init.user-data: |
#cloud-config
write_files:
- path: "/etc/traefik/traefik.yaml"
owner: traefik:traefik
permissions: "0644"
content: |
## Static configuration
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
providers:
file:
directory: "./dynamic"
log:
level: DEBUG
accessLog:
filePath: "/var/log/traefik/access.log.json"
format: "json"
api:
# Dashboard
#
# Optional
# Default: true
#
dashboard: true
insecure: true
+140
View File
@@ -0,0 +1,140 @@
name: traefik
description: Install traefik
config:
cloud-init.vendor-data: |
#cloud-config
timezone: Europe/Paris
locale: fr_FR.UTF-8
# Packages
package_update: true
package_upgrade: true
packages:
- tar
- unzip
- wget
# Users
users:
- default
- name: traefik
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
# Configure second network interface
write_files:
- path: "/etc/netplan/eth1.yaml"
permissions: "0644"
content: |
network:
version: 2
ethernets:
eth1:
dhcp4: true
- path: "/etc/systemd/system/traefik.service"
owner: root:root
permissions: "0644"
content: |
[Unit]
Description=traefik proxy
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
Restart=on-abnormal
; User and group the process will run as.
User=traefik
Group=traefik
; Always set "-root" to something safe in case it gets forgotten in the traefikfile.
ExecStart=/usr/local/bin/traefik --configfile=/etc/traefik/traefik.yaml
; Limit the number of file descriptors; see `man systemd.exec` for more limit settings.
LimitNOFILE=1048576
; Use private /tmp and /var/tmp, which are discarded after traefik stops.
PrivateTmp=true
; Use a minimal /dev (May bring additional security if switched to 'true', but it may not work on Raspberry Pi's or other devices, so it has been disabled in this dist.)
PrivateDevices=true
; Hide /home, /root, and /run/user. Nobody will steal your SSH-keys.
ProtectHome=true
; Make /usr, /boot, /etc and possibly some more folders read-only.
ProtectSystem=full
; … except /etc/ssl/traefik, because we want Letsencrypt-certificates there.
; This merely retains r/w access rights, it does not add any new. Must still be writable on the host!
ReadWriteDirectories=/etc/traefik/acme
; The following additional security directives only work with systemd v229 or later.
; They further restrict privileges that can be gained by traefik. Uncomment if you like.
; Note that you may have to add capabilities required by any plugins in use.
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
- path: "/etc/traefik/traefik.yaml"
owner: traefik:traefik
permissions: "0644"
content: |
## Static configuration
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
providers:
file:
directory: "./dynamic"
log:
level: DEBUG
accessLog:
filePath: "/var/log/traefik/access.log.json"
format: "json"
api:
# Dashboard
#
# Optional
# Default: true
#
dashboard: true
insecure: true
runcmd:
# Apply network config
- [ netplan, generate ]
- [ netplan, apply ]
# Install traefik binary
- [ sleep, 5 ]
- [ wget, "https://github.com/traefik/traefik/releases/download/v2.11.0-rc2/traefik_v2.11.0-rc2_linux_amd64.tar.gz", -O, /tmp/traefik.tar.gz ]
- [ tar, vxzf, /tmp/traefik.tar.gz, -C, /tmp ]
- [ cp, /tmp/traefik, /usr/local/bin ]
- [ chown, root:root, /usr/local/bin/traefik ]
- [ chmod, 755, /usr/local/bin/traefik ]
- [ setcap, 'cap_net_bind_service=+ep', /usr/local/bin/traefik ]
# Prepare traefik config
- [ mkdir, -p, /etc/traefik ]
- [ mkdir, -p, /etc/traefik/acme ]
- [ mkdir, -p, /etc/traefik/dynamic ]
- [ mkdir, -p, /var/log/traefik ]
- [ chown, -R, root:root, /etc/traefik ]
- [ chown, -R, traefik:traefik, /etc/traefik/acme ]
- [ chown, -R, traefik:traefik, /etc/traefik/dynamic ]
- [ chown, -R, traefik:traefik, /var/log/traefik ]
# Enable and start the service
- [ systemctl, daemon-reload ]
- [ systemctl, enable, traefik.service ]
- [ systemctl, start, traefik.service ]
+7
View File
@@ -0,0 +1,7 @@
name: back
description: Profile that provide a network interface attached to the back bridge
devices:
eth0:
nictype: bridged
parent: back
type: nic
+7
View File
@@ -0,0 +1,7 @@
name: front
description: Profile that provide a network interface attached to the front bridge
devices:
eth0:
nictype: bridged
parent: front
type: nic
@@ -0,0 +1,12 @@
name: frontback
description: Profile that provide a network interface attached to the front bridge
and a network interface attached to the back bridge
devices:
eth0:
nictype: bridged
parent: front
type: nic
eth1:
nictype: bridged
parent: back
type: nic
+7
View File
@@ -0,0 +1,7 @@
name: home
description: Profile that provide a network interface attached to the home bridge
devices:
eth0:
nictype: bridged
parent: home
type: nic
+7
View File
@@ -0,0 +1,7 @@
name: public
description: Profile that provide a network interface attached to the public bridge
devices:
eth0:
nictype: bridged
parent: public
type: nic