ansible_playbooks/nginx_ubuntu_install.yml

31 lines
721 B
YAML
Raw Permalink Normal View History

2023-08-03 11:26:38 -04:00
- 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