Compare commits

..

No commits in common. "3a53634dfa21a3b60bf283ec75f07e980afceac3" and "1b68766cd6cb4ff0e2bc1732e1379ba00ac2c392" have entirely different histories.

45 changed files with 99 additions and 147 deletions

1
.gitignore vendored
View File

@ -3,5 +3,4 @@
.vagrant/
*.log
.idea/
.vscode/
venv/

5
datacoop_hosts Normal file
View File

@ -0,0 +1,5 @@
[production]
hevonen.servers.data.coop ansible_port=19022
[monitoring]
uptime.data.coop

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
users:
- name: graffen

View File

@ -1,13 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
vagrant: "{{ from_vagrant is defined and from_vagrant }}"
letsencrypt_enabled: "{{ not vagrant }}"
base_domain: "{{ 'datacoop.devel' if vagrant else 'data.coop' }}"
letsencrypt_email: admin@data.coop
services_include:
- nginx_proxy
- uptime_kuma
- watchtower

View File

@ -1,16 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
vagrant: "{{ from_vagrant is defined and from_vagrant }}"
letsencrypt_enabled: "{{ not vagrant }}"
base_domain: "{{ 'datacoop.devel' if vagrant else 'data.coop' }}"
letsencrypt_email: admin@data.coop
services_exclude:
- uptime_kuma
smtp_host: "postfix"
smtp_port: "587"
ldap_dn: "dc=data,dc=coop"

View File

@ -1,16 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
vagrant: "{{ from_vagrant is defined and from_vagrant }}"
letsencrypt_enabled: "{{ not vagrant }}"
base_domain: "{{ 'staging.datacoop.devel' if vagrant else 'staging.data.coop' }}"
letsencrypt_email: admin@data.coop
services_exclude:
- uptime_kuma
smtp_host: "postfix"
smtp_port: "587"
ldap_dn: "dc=staging,dc=data,dc=coop"

View File

@ -1,5 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
ansible_host: 85.209.118.134
fqdn: cavall.servers.data.coop

View File

@ -1,6 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
ansible_host: 85.209.118.134
ansible_port: 19022
fqdn: folald.vm.cavall.servers.data.coop

View File

@ -1,5 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
ansible_host: 159.223.17.241
fqdn: hestur.servers.data.coop

View File

@ -1,6 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
ansible_host: 85.209.118.142
ansible_port: 19022
fqdn: poltre.vm.cavall.servers.data.coop

View File

@ -1,6 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
ansible_host: 85.209.118.143
ansible_port: 19022
fqdn: varsa.vm.cavall.servers.data.coop

View File

@ -1,19 +0,0 @@
[proxmox]
cavall
[monitoring]
hestur
[production]
poltre
[staging]
varsa
[control]
folald
[virtual:children]
production
staging
control

View File

@ -1,13 +1,27 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- hosts: all
- hosts: production
gather_facts: true
become: true
roles:
- name: os_base
vars:
ldap_dn: "dc=data,dc=coop"
vagrant: "{{ from_vagrant is defined and from_vagrant }}"
letsencrypt_enabled: "{{ not vagrant }}"
base_domain: "{{ 'datacoop.devel' if vagrant else 'data.coop' }}"
letsencrypt_email: "admin@{{ base_domain }}"
smtp_host: "postfix"
smtp_port: "587"
services_exclude:
- uptime_kuma
tasks:
- import_role:
name: ubuntu_base
tags:
- base_only
- name: docker
tags:
- docker
- import_role:
name: docker

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
volume_root_folder: "/docker-volumes"
volume_website_folder: "{{ volume_root_folder }}/websites"

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: restart nginx
command: docker compose restart proxy

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create volume folder for service {{ service.name }}
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Add Docker PGP key
apt_key:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Generate htpasswd file
shell: docker compose exec registry htpasswd -Bbn docker {{ docker_password }} > auth/htpasswd

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Configure cron job to remove old Mastodon media daily
cron:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Upload vhost config for root domain
copy:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolder
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolder for Mastodon data
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Set up network for Postfix
docker_network:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolders
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolder
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create SSH directory
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create subfolder for MariaDB data
file:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Set up external services network
docker_network:

View File

@ -1,15 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- ansible.builtin.import_tasks: ssh-port.yml
tags: [change-ssh-port]
when: ansible_port != 22
- ansible.builtin.import_tasks: base.yml
tags: [install-base-packages]
- ansible.builtin.import_tasks: users.yml
tags: [setup-users]
- ansible.builtin.import_tasks: firewall.yml
tags: [setup-firewall]

View File

@ -1,13 +1,17 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Install necessary packages via apt
ansible.builtin.apt:
apt:
name: "{{ packages }}"
vars:
packages:
- aptitude
- python3-pip
- apparmor
- haveged
- mosh
- ufw
- vim
- name: Install Dell OpenManage
apt:
name: srvadmin-all
when: not vagrant and not skip_dell_apt_repo

View File

@ -0,0 +1,20 @@
# vim: ft=yaml.ansible
---
- name: Import dell apt signing key
apt_key:
id: "1285491434D8786F"
keyserver: "keyserver.ubuntu.com"
- name: Configure dell apt repo
apt_repository:
repo: "deb https://linux.dell.com/repo/community/openmanage/10101/focal focal main"
state: present
- name: Restrict dell apt repo"
copy:
dest: "/etc/apt/preferences.d/dell"
content: |
Explanation: Deny all packages from this repo that exist elsewhere
Package: *
Pin: origin "linux.dell.com"
Pin-Priority: 400

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Setup firewall with UFW
community.general.ufw:
@ -22,4 +21,3 @@
- port: 587 # Email
- port: 993 # Email
- port: 19022 # SSH
when: inventory_hostname in groups['virtual']

View File

@ -0,0 +1,21 @@
# vim: ft=yaml.ansible
---
- import_tasks: ssh-port.yml
tags: [change-ssh-port]
when: not do_not_change_ssh_port
- import_tasks: dell-apt-repo.yml
tags: [setup-dell-apt-repo]
when: not skip_dell_apt_repo and not vagrant
- import_tasks: upgrade.yml
tags: [do-full-system-upgrade]
- import_tasks: base.yml
tags: [install-base-packages]
- import_tasks: users.yml
tags: [setup-users]
- import_tasks: firewall.yml
tags: [setup-firewall]

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Change SSH port on host
lineinfile:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: update and upgrade system via apt
apt:

View File

@ -1,5 +1,4 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: "Add users"
user:

24
uptime.data.coop.yml Normal file
View File

@ -0,0 +1,24 @@
# vim: ft=yaml.ansible
---
- hosts: monitoring
gather_facts: true
become: true
vars:
vagrant: false
base_domain: "{{ 'datacoop.devel' if vagrant else 'data.coop' }}"
letsencrypt_enabled: true
letsencrypt_email: "admin@{{ base_domain }}"
services_include:
- nginx_proxy
- uptime_kuma
- watchtower
do_not_change_ssh_port: true
skip_dell_apt_repo: true
tasks:
- import_role:
name: ubuntu_base
tags:
- base_only
- import_role:
name: docker