libreddit-loadbalance-demo/ansible/playbook.yml

51 lines
1.1 KiB
YAML

# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Configure webservers
hosts: [bullseye_libreddit,bullseye_loadbalance]
remote_user: root
tasks:
- name: Ensure all VMs are reachable
ansible.builtin.ping:
- name: Update package cache
ansible.builtin.apt:
update_cache: true
upgrade: safe
- name: Install git, zip, nginx, wget, curl & other utils
ansible.builtin.apt:
update_cache: true
pkg:
- git
- wget
- curl
- gpg
- ca-certificates
- zip
- python3-pip
- virtualenv
- ufw
- python3-setuptools
- name: Set logging
community.general.ufw:
logging: "on"
- name: Allow port 22 and enable UFW
community.general.ufw:
state: enabled
rule: allow
proto: tcp
port: "22"
- name: Enable and start ufw service
ansible.builtin.service:
name: ufw
enabled: true
state: started