This commit introduces the foundational Ansible playbooks, roles, and configurations for automated provisioning of both production and test environments. Key capabilities include: - **Base System Setup:** Common packages, timezone, chrony, and hostname. - **Security Hardening:** SELinux disable, SSH configuration, `dnf-automatic`, `fail2ban`, `firewalld` setup, and `journald` log limits. - **Docker & Swarm:** Docker installation and configuration, Docker Swarm initialization/joining for managers and workers, overlay network creation, and node labeling. - **Storage:** Hetzner StorageBox integration using `davfs2`. - **Directory Structure:** Creation of application and database-specific directories. This establishes a comprehensive, automated pipeline for infrastructure deployment and initial configuration.
41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
---
|
|
- name: Install davfs2
|
|
ansible.builtin.dnf:
|
|
name: davfs2
|
|
state: present
|
|
|
|
- name: Configure davfs2 secrets
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/davfs2/secrets
|
|
line: "{{ storagebox_url }} {{ storagebox_user }} {{ storagebox_password }}"
|
|
create: yes
|
|
mode: "0600"
|
|
owner: root
|
|
group: root
|
|
|
|
- name: Create mount point
|
|
ansible.builtin.file:
|
|
path: "{{ storagebox_mount_point }}"
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Add fstab entry for StorageBox
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/fstab
|
|
line: "{{ storagebox_url }} {{ storagebox_mount_point }} davfs _netdev,auto,user,rw,uid=root,gid=root 0 0"
|
|
state: present
|
|
|
|
- name: Mount StorageBox
|
|
ansible.builtin.mount:
|
|
path: "{{ storagebox_mount_point }}"
|
|
src: "{{ storagebox_url }}"
|
|
fstype: davfs
|
|
opts: "_netdev,auto,user,rw,uid=root,gid=root"
|
|
state: mounted
|
|
|
|
- name: Write mount marker
|
|
ansible.builtin.copy:
|
|
content: "mounted by ansible"
|
|
dest: "{{ storagebox_mount_point }}/.mounted_marker"
|
|
mode: '0644'
|