commit f3ea45852329c4839e4826f8ae3c3f7d82dffe3e Author: Paul Trowbridge Date: Thu Aug 3 11:26:38 2023 -0400 init diff --git a/nginx_ubuntu_install.yml b/nginx_ubuntu_install.yml new file mode 100644 index 0000000..55e6f7d --- /dev/null +++ b/nginx_ubuntu_install.yml @@ -0,0 +1,30 @@ +- name: Install Nginx on Ubuntu + hosts: servers + remote_user: ptrowbridge + become: true + tasks: + - name: Add Nginx signing key + become: yes + apt_key: + url: http://nginx.org/keys/nginx_signing.key + state: present + + - name: Add Nginx APT repository (stable version) + apt_repository: + repo: "deb http://nginx.org/packages/ubuntu {{ ansible_distribution_release }} nginx" + state: present + filename: nginx + + - name: Update apt cache + apt: + update_cache: yes + + - name: Install Nginx + apt: + name: nginx + state: present + + - name: Start Nginx service using service module + service: + name: nginx + state: started diff --git a/ufw_ubuntu_configure.yml b/ufw_ubuntu_configure.yml new file mode 100644 index 0000000..b832d34 --- /dev/null +++ b/ufw_ubuntu_configure.yml @@ -0,0 +1,32 @@ +--- +- name: Configure UFW to allow specific ports and use LIMIT for SSH + hosts: servers + become: true # This enables privilege escalation, necessary to modify firewall rules + + tasks: + - name: Install UFW if not already installed + apt: + name: ufw + state: present + + - name: Allow incoming traffic on ports 5432, 8083, and 8888 + ufw: + rule: allow + port: "{{ item }}" + with_items: + - 5432 + - 8083 + - 8888 + - 80 + - 443 + + - name: Set up the LIMIT rule for SSH on port 22 + ufw: + rule: limit + port: 22 + proto: tcp + + - name: Enable UFW firewall + ufw: + state: enabled +