Install Nginx (with default page running)

This commit is contained in:
Thomas Kleinendorst 2024-04-12 09:33:14 +02:00
parent 3ba044d1a2
commit a08eb939b6
3 changed files with 29 additions and 1 deletions

View file

@ -0,0 +1,26 @@
---
- name: Add an apt key by id from a keyserver
become: true
ansible.builtin.apt_key:
url: https://nginx.org/packages/keys/nginx_signing.key
state: present
- name: Add Nginx repository into sources list
become: true
ansible.builtin.apt_repository:
repo: deb https://nginx.org/packages/debian/ {{ ansible_facts['lsb']['codename'] }} nginx
state: present
- name: Add Nginx source repository into sources list
become: true
ansible.builtin.apt_repository:
repo: deb-src https://nginx.org/packages/debian/ {{ ansible_facts['lsb']['codename'] }} nginx
state: present
- name: Install Nginx
become: true
ansible.builtin.apt:
name: nginx # Creates the "nginx" user as well
state: present
- name: Start Nginx
become: true
ansible.builtin.systemd:
name: nginx.service
state: started