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.
48 lines
1.0 KiB
YAML
48 lines
1.0 KiB
YAML
---
|
|
- name: Add Docker repository
|
|
ansible.builtin.get_url:
|
|
url: https://download.docker.com/linux/rhel/docker-ce.repo
|
|
dest: /etc/yum.repos.d/docker-ce.repo
|
|
mode: '0644'
|
|
|
|
- name: Install Docker packages
|
|
ansible.builtin.dnf:
|
|
name:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|
|
- docker-buildx-plugin
|
|
- docker-compose-plugin
|
|
state: present
|
|
|
|
- name: Ensure /etc/docker directory exists
|
|
ansible.builtin.file:
|
|
path: /etc/docker
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Configure Docker daemon (Log Rotation)
|
|
ansible.builtin.template:
|
|
src: daemon.json.j2
|
|
dest: /etc/docker/daemon.json
|
|
mode: '0644'
|
|
notify: Restart Docker
|
|
|
|
- name: Ensure Docker is started and enabled
|
|
ansible.builtin.service:
|
|
name: docker
|
|
state: started
|
|
enabled: yes
|
|
|
|
- name: Allow Docker traffic in firewalld
|
|
ansible.posix.firewalld:
|
|
port: "{{ item }}"
|
|
permanent: yes
|
|
immediate: yes
|
|
state: enabled
|
|
loop:
|
|
- 2377/tcp
|
|
- 7946/tcp
|
|
- 7946/udp
|
|
- 4789/udp
|