qvest-task/ansible/setup-system.yml
aviyadeveloper 22504b886b feat: Automated Gitea deployment with SSL
- Deployed PostgreSQL 18.4 + Gitea 1.22.6 via Docker Compose
- Configured Nginx reverse proxy with Let's Encrypt SSL
- Created Ansible playbooks for full automation (site.yml)
- Database credentials in AWS Secrets Manager
- Production deployment at https://gitea.poll-streams.com
2026-06-08 19:51:24 +02:00

85 lines
2.1 KiB
YAML

---
- name: Setup system dependencies
hosts: gitea
become: true
tasks:
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
- name: Install required packages
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
- python3-pip
- jq
- unzip
state: present
- name: Add Docker GPG key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker repository
ansible.builtin.apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
- name: Install Docker
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: present
update_cache: true
- name: Ensure Docker service is running
ansible.builtin.service:
name: docker
state: started
enabled: true
- name: Add ubuntu user to docker group
ansible.builtin.user:
name: ubuntu
groups: docker
append: true
- name: Reset SSH connection to apply group changes
ansible.builtin.meta: reset_connection
- name: Download AWS CLI v2
ansible.builtin.get_url:
url: https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
dest: /tmp/awscliv2.zip
mode: "0644"
- name: Extract AWS CLI v2
ansible.builtin.unarchive:
src: /tmp/awscliv2.zip
dest: /tmp
remote_src: true
creates: /tmp/aws
- name: Install AWS CLI v2
ansible.builtin.command:
cmd: /tmp/aws/install --update
creates: /usr/local/bin/aws
- name: Clean up AWS CLI installation files
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- /tmp/awscliv2.zip
- /tmp/aws