init
This commit is contained in:
		
						commit
						f3ea458523
					
				
							
								
								
									
										30
									
								
								nginx_ubuntu_install.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								nginx_ubuntu_install.yml
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||
							
								
								
									
										32
									
								
								ufw_ubuntu_configure.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								ufw_ubuntu_configure.yml
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user