|
|
|
|
|
|
|
|
# |
|
|
# |
|
|
# Manages installation of nginx from pkg. |
|
|
# Manages installation of nginx from pkg. |
|
|
|
|
|
|
|
|
{% from 'nginx/map.jinja' import nginx, sls_block with context %} |
|
|
|
|
|
|
|
|
{#- Get the `tplroot` from `tpldir` #} |
|
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %} |
|
|
|
|
|
{%- from tplroot ~ "/map.jinja" import nginx, sls_block with context %} |
|
|
|
|
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} |
|
|
|
|
|
|
|
|
{%- if nginx.install_from_repo %} |
|
|
{%- if nginx.install_from_repo %} |
|
|
{% set from_official = true %} |
|
|
{% set from_official = true %} |
|
|
{% set from_ppa = false %} |
|
|
{% set from_ppa = false %} |
|
|
|
|
|
|
|
|
- name: {{ nginx.lookup.package }} |
|
|
- name: {{ nginx.lookup.package }} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
{% if salt['grains.get']('os_family') == 'Debian' %} |
|
|
|
|
|
|
|
|
{% if grains.os_family == 'Debian' %} |
|
|
|
|
|
{%- if from_official %} |
|
|
|
|
|
nginx_official_repo_keyring: |
|
|
|
|
|
file.managed: |
|
|
|
|
|
- name: {{ nginx.lookup.package_repo_keyring }} |
|
|
|
|
|
- source: {{ files_switch(['nginx-archive-keyring.gpg'], |
|
|
|
|
|
lookup='nginx_official_repo_keyring' |
|
|
|
|
|
) |
|
|
|
|
|
}} |
|
|
|
|
|
- require_in: |
|
|
|
|
|
- pkgrepo: nginx_official_repo |
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
nginx_official_repo: |
|
|
nginx_official_repo: |
|
|
pkgrepo: |
|
|
pkgrepo: |
|
|
{%- if from_official %} |
|
|
{%- if from_official %} |
|
|
|
|
|
|
|
|
- absent |
|
|
- absent |
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
- humanname: nginx apt repo |
|
|
- humanname: nginx apt repo |
|
|
- name: deb http://nginx.org/packages/{{ grains['os'].lower() }}/ {{ grains['oscodename'] }} nginx |
|
|
|
|
|
- file: /etc/apt/sources.list.d/nginx-official-{{ grains['oscodename'] }}.list |
|
|
|
|
|
- keyid: ABF5BD827BD9BF62 |
|
|
|
|
|
- keyserver: keyserver.ubuntu.com |
|
|
|
|
|
|
|
|
- name: >- |
|
|
|
|
|
deb [signed-by={{ nginx.lookup.package_repo_keyring }}] |
|
|
|
|
|
http://nginx.org/packages/{{ grains.os | lower }}/ {{ grains.oscodename }} nginx |
|
|
|
|
|
- file: /etc/apt/sources.list.d/nginx-official-{{ grains.oscodename }}.list |
|
|
- require_in: |
|
|
- require_in: |
|
|
- pkg: nginx_install |
|
|
- pkg: nginx_install |
|
|
- watch_in: |
|
|
- watch_in: |
|
|
|
|
|
|
|
|
{%- else %} |
|
|
{%- else %} |
|
|
- absent |
|
|
- absent |
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
{% if salt['grains.get']('os') == 'Ubuntu' %} |
|
|
|
|
|
|
|
|
{% if grains.os == 'Ubuntu' %} |
|
|
- ppa: nginx/{{ nginx.ppa_version }} |
|
|
- ppa: nginx/{{ nginx.ppa_version }} |
|
|
{% else %} |
|
|
{% else %} |
|
|
- name: deb http://ppa.launchpad.net/nginx/{{ nginx.ppa_version }}/ubuntu {{ grains['oscodename'] }} main |
|
|
|
|
|
|
|
|
- name: deb http://ppa.launchpad.net/nginx/{{ nginx.ppa_version }}/ubuntu {{ grains.oscodename }} main |
|
|
- keyid: C300EE8C |
|
|
- keyid: C300EE8C |
|
|
- keyserver: keyserver.ubuntu.com |
|
|
- keyserver: keyserver.ubuntu.com |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
- pkg: nginx_install |
|
|
- pkg: nginx_install |
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
|
|
|
{%- if from_phusionpassenger %} |
|
|
|
|
|
nginx_phusionpassenger_repo_keyring: |
|
|
|
|
|
file.managed: |
|
|
|
|
|
- name: /usr/share/keyrings/phusionpassenger-archive-keyring.gpg |
|
|
|
|
|
- source: {{ files_switch(['phusionpassenger-archive-keyring.gpg'], |
|
|
|
|
|
lookup='nginx_phusionpassenger_repo_keyring' |
|
|
|
|
|
) |
|
|
|
|
|
}} |
|
|
|
|
|
- require_in: |
|
|
|
|
|
- pkgrepo: nginx_phusionpassenger_repo |
|
|
|
|
|
|
|
|
|
|
|
# Remove the old repo file |
|
|
|
|
|
nginx_phusionpassenger_repo_remove: |
|
|
|
|
|
pkgrepo.absent: |
|
|
|
|
|
- name: deb http://nginx.org/packages/{{ grains.os |lower }}/ {{ grains.oscodename }} nginx |
|
|
|
|
|
- keyid: 561F9B9CAC40B2F7 |
|
|
|
|
|
- require_in: |
|
|
|
|
|
- pkgrepo: nginx_phusionpassenger_repo |
|
|
|
|
|
file.absent: |
|
|
|
|
|
- name: /etc/apt/sources.list.d/nginx-phusionpassenger-{{ grains.oscodename }}.list |
|
|
|
|
|
- require_in: |
|
|
|
|
|
- pkgrepo: nginx_phusionpassenger_repo |
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
nginx_phusionpassenger_repo: |
|
|
nginx_phusionpassenger_repo: |
|
|
pkgrepo: |
|
|
pkgrepo: |
|
|
{%- if from_phusionpassenger %} |
|
|
{%- if from_phusionpassenger %} |
|
|
|
|
|
|
|
|
- absent |
|
|
- absent |
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
- humanname: nginx phusionpassenger repo |
|
|
- humanname: nginx phusionpassenger repo |
|
|
- name: deb https://oss-binaries.phusionpassenger.com/apt/passenger {{ grains['oscodename'] }} main |
|
|
|
|
|
- file: /etc/apt/sources.list.d/nginx-phusionpassenger-{{ grains['oscodename'] }}.list |
|
|
|
|
|
- keyid: 561F9B9CAC40B2F7 |
|
|
|
|
|
- keyserver: keyserver.ubuntu.com |
|
|
|
|
|
|
|
|
- name: >- |
|
|
|
|
|
deb [signed-by={{ nginx.lookup.passenger_package_repo_keyring }}] |
|
|
|
|
|
https://oss-binaries.phusionpassenger.com/apt/passenger {{ grains.oscodename }} main |
|
|
|
|
|
- file: /etc/apt/sources.list.d/phusionpassenger-official-{{ grains.oscodename }}.list |
|
|
- require_in: |
|
|
- require_in: |
|
|
- pkg: nginx_install |
|
|
- pkg: nginx_install |
|
|
- watch_in: |
|
|
- watch_in: |
|
|
- pkg: nginx_install |
|
|
- pkg: nginx_install |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
{% if salt['grains.get']('os_family') == 'Suse' or salt['grains.get']('os') == 'SUSE' %} |
|
|
|
|
|
|
|
|
{% if grains.os_family == 'Suse' or grains.os == 'SUSE' %} |
|
|
nginx_zypp_repo: |
|
|
nginx_zypp_repo: |
|
|
pkgrepo: |
|
|
pkgrepo: |
|
|
{%- if from_official %} |
|
|
{%- if from_official %} |
|
|
|
|
|
|
|
|
- pkg: nginx_install |
|
|
- pkg: nginx_install |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
{% if salt['grains.get']('os_family') == 'RedHat' %} |
|
|
|
|
|
{% if salt['grains.get']('osfinger', '') in ['Amazon Linux-2'] %} |
|
|
|
|
|
|
|
|
{% if grains.os_family == 'RedHat' %} |
|
|
|
|
|
{% if grains.get('osfinger', '') == 'Amazon Linux-2' %} |
|
|
nginx_epel_repo: |
|
|
nginx_epel_repo: |
|
|
pkgrepo.managed: |
|
|
pkgrepo.managed: |
|
|
- name: epel |
|
|
- name: epel |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
- name: nginx |
|
|
- name: nginx |
|
|
- humanname: nginx repo |
|
|
- humanname: nginx repo |
|
|
{%- if salt['grains.get']('os') == 'CentOS' %} |
|
|
|
|
|
|
|
|
{%- if grains.os == 'CentOS' %} |
|
|
- baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/' |
|
|
- baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/' |
|
|
{%- else %} |
|
|
{%- else %} |
|
|
- baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/' |
|
|
- baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/' |