summaryrefslogtreecommitdiffstats
path: root/roles/nginx/tasks/install-debian.yml
blob: 74b8318384f1ad15ec9fa713da73cb305bff72a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
- name: "Download nginx GPG key"
  become: true
  ansible.builtin.get_url:
    url: "https://nginx.org/keys/nginx_signing.key"
    dest: "/etc/apt/trusted.gpg.d/nginx.asc"
    mode: "0644"
    owner: "root"
    group: "root"

- name: "Add nginx APT repository"
  become: true
  ansible.builtin.apt_repository:
    repo: >-
      deb [signed-by=/etc/apt/trusted.gpg.d/nginx.asc]
      https://nginx.org/packages/{{ ansible_facts['distribution'] | lower }}
      {{ ansible_facts['distribution_release'] }} nginx
    state: "present"
    filename: "nginx"

- name: "Install nginx"
  become: true
  ansible.builtin.package:
    name: "nginx"
    state: "present"
    update_cache: true