2019-05-10 23:07:18 +02:00
|
|
|
# nginx.pkg
|
2014-05-16 00:06:48 +02:00
|
|
|
#
|
2016-05-10 13:00:18 +02:00
|
|
|
# Manages installation of nginx from pkg.
|
2014-05-19 19:22:51 +02:00
|
|
|
|
2022-02-02 22:55:23 +01:00
|
|
|
{#- 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 %}
|
|
|
|
|
2017-06-24 15:43:25 +02:00
|
|
|
{%- if nginx.install_from_repo %}
|
|
|
|
{% set from_official = true %}
|
|
|
|
{% set from_ppa = false %}
|
|
|
|
{% set from_phusionpassenger = false %}
|
|
|
|
{% elif nginx.install_from_ppa %}
|
|
|
|
{% set from_official = false %}
|
|
|
|
{% set from_ppa = true %}
|
|
|
|
{% set from_phusionpassenger = false %}
|
|
|
|
{% elif nginx.install_from_phusionpassenger %}
|
|
|
|
{% set from_official = false %}
|
|
|
|
{% set from_ppa = false %}
|
|
|
|
{% set from_phusionpassenger = true %}
|
2017-06-26 18:10:44 +02:00
|
|
|
{% else %}
|
|
|
|
{% set from_official = false %}
|
|
|
|
{% set from_ppa = false %}
|
|
|
|
{% set from_phusionpassenger = false %}
|
2017-06-24 15:43:25 +02:00
|
|
|
{%- endif %}
|
2014-05-16 00:06:48 +02:00
|
|
|
|
2022-03-01 17:42:37 +01:00
|
|
|
{%- set resource_repo_managed = 'file' if grains.os_family == 'Debian' else 'pkgrepo' %}
|
|
|
|
|
2014-05-16 00:06:48 +02:00
|
|
|
nginx_install:
|
|
|
|
pkg.installed:
|
|
|
|
{{ sls_block(nginx.package.opts) }}
|
2018-10-19 14:20:22 +02:00
|
|
|
{% if nginx.lookup.package is iterable and nginx.lookup.package is not string %}
|
|
|
|
- pkgs:
|
|
|
|
{% for pkg in nginx.lookup.package %}
|
|
|
|
- {{ pkg }}
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
2014-05-16 00:06:48 +02:00
|
|
|
- name: {{ nginx.lookup.package }}
|
2018-10-19 14:20:22 +02:00
|
|
|
{% endif %}
|
2016-05-09 17:31:29 +02:00
|
|
|
|
2022-02-02 23:32:48 +01:00
|
|
|
{% if grains.os_family == 'Debian' %}
|
2022-02-02 22:55:23 +01:00
|
|
|
{%- if from_official %}
|
|
|
|
nginx_official_repo_keyring:
|
|
|
|
file.managed:
|
2022-02-02 23:32:48 +01:00
|
|
|
- name: {{ nginx.lookup.package_repo_keyring }}
|
2022-02-02 22:55:23 +01:00
|
|
|
- source: {{ files_switch(['nginx-archive-keyring.gpg'],
|
|
|
|
lookup='nginx_official_repo_keyring'
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
- require_in:
|
2022-03-01 17:42:37 +01:00
|
|
|
- {{ resource_repo_managed }}: nginx_official_repo
|
2022-02-02 22:55:23 +01:00
|
|
|
{%- endif %}
|
|
|
|
|
2017-06-24 15:43:25 +02:00
|
|
|
nginx_official_repo:
|
2022-03-01 17:42:37 +01:00
|
|
|
file:
|
2017-06-24 15:43:25 +02:00
|
|
|
{%- if from_official %}
|
2016-04-04 15:09:31 +02:00
|
|
|
- managed
|
2017-06-24 15:43:25 +02:00
|
|
|
{%- else %}
|
|
|
|
- absent
|
|
|
|
{%- endif %}
|
2022-03-01 17:42:37 +01:00
|
|
|
- name: /etc/apt/sources.list.d/nginx-official-{{ grains.oscodename }}.list
|
|
|
|
- contents: >
|
2022-02-02 23:32:48 +01:00
|
|
|
deb [signed-by={{ nginx.lookup.package_repo_keyring }}]
|
|
|
|
http://nginx.org/packages/{{ grains.os | lower }}/ {{ grains.oscodename }} nginx
|
2022-03-01 17:42:37 +01:00
|
|
|
|
2016-04-04 15:09:31 +02:00
|
|
|
- require_in:
|
2017-04-21 23:29:14 +02:00
|
|
|
- pkg: nginx_install
|
2016-04-04 15:09:31 +02:00
|
|
|
- watch_in:
|
2017-04-21 23:29:14 +02:00
|
|
|
- pkg: nginx_install
|
2017-06-24 15:43:25 +02:00
|
|
|
|
2019-01-25 16:02:57 +01:00
|
|
|
{%- if grains.os not in ('Debian',) %}
|
|
|
|
## applies to Ubuntu and derivatives only #}
|
2014-08-12 04:01:38 +02:00
|
|
|
nginx_ppa_repo:
|
|
|
|
pkgrepo:
|
2017-06-24 15:43:25 +02:00
|
|
|
{%- if from_ppa %}
|
2014-08-12 04:01:38 +02:00
|
|
|
- managed
|
|
|
|
{%- else %}
|
|
|
|
- absent
|
|
|
|
{%- endif %}
|
2022-02-02 23:32:48 +01:00
|
|
|
{% if grains.os == 'Ubuntu' %}
|
2015-02-23 22:16:41 +01:00
|
|
|
- ppa: nginx/{{ nginx.ppa_version }}
|
2016-04-20 13:36:46 +02:00
|
|
|
{% else %}
|
2022-02-02 23:32:48 +01:00
|
|
|
- name: deb http://ppa.launchpad.net/nginx/{{ nginx.ppa_version }}/ubuntu {{ grains.oscodename }} main
|
2016-04-20 13:36:46 +02:00
|
|
|
- keyid: C300EE8C
|
|
|
|
- keyserver: keyserver.ubuntu.com
|
|
|
|
{% endif %}
|
2014-08-12 04:01:38 +02:00
|
|
|
- require_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
- watch_in:
|
|
|
|
- pkg: nginx_install
|
2019-01-25 16:02:57 +01:00
|
|
|
{%- endif %}
|
2017-06-24 15:43:25 +02:00
|
|
|
|
2022-02-02 22:55:23 +01:00
|
|
|
{%- 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:
|
2022-03-01 17:42:37 +01:00
|
|
|
- {{ resource_repo_managed }}: nginx_phusionpassenger_repo
|
2022-02-02 22:55:23 +01:00
|
|
|
|
|
|
|
# Remove the old repo file
|
|
|
|
nginx_phusionpassenger_repo_remove:
|
|
|
|
pkgrepo.absent:
|
2022-02-02 23:32:48 +01:00
|
|
|
- name: deb http://nginx.org/packages/{{ grains.os |lower }}/ {{ grains.oscodename }} nginx
|
2022-02-02 22:55:23 +01:00
|
|
|
- keyid: 561F9B9CAC40B2F7
|
|
|
|
- require_in:
|
2022-03-01 17:42:37 +01:00
|
|
|
- {{ resource_repo_managed }}: nginx_phusionpassenger_repo
|
2022-02-02 22:55:23 +01:00
|
|
|
file.absent:
|
2022-02-02 23:32:48 +01:00
|
|
|
- name: /etc/apt/sources.list.d/nginx-phusionpassenger-{{ grains.oscodename }}.list
|
2022-02-02 22:55:23 +01:00
|
|
|
- require_in:
|
2022-03-01 17:42:37 +01:00
|
|
|
- {{ resource_repo_managed }}: nginx_phusionpassenger_repo
|
2022-02-02 22:55:23 +01:00
|
|
|
{%- endif %}
|
|
|
|
|
2017-06-24 15:43:25 +02:00
|
|
|
nginx_phusionpassenger_repo:
|
2022-03-01 17:42:37 +01:00
|
|
|
file:
|
2017-06-24 15:43:25 +02:00
|
|
|
{%- if from_phusionpassenger %}
|
|
|
|
- managed
|
|
|
|
{%- else %}
|
|
|
|
- absent
|
|
|
|
{%- endif %}
|
2022-03-01 17:42:37 +01:00
|
|
|
- name: /etc/apt/sources.list.d/phusionpassenger-official-{{ grains.oscodename }}.list
|
|
|
|
- contents: >
|
2022-02-02 23:32:48 +01:00
|
|
|
deb [signed-by={{ nginx.lookup.passenger_package_repo_keyring }}]
|
|
|
|
https://oss-binaries.phusionpassenger.com/apt/passenger {{ grains.oscodename }} main
|
2022-03-01 17:42:37 +01:00
|
|
|
|
2017-06-24 15:43:25 +02:00
|
|
|
- require_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
- watch_in:
|
|
|
|
- pkg: nginx_install
|
2014-08-12 04:01:38 +02:00
|
|
|
{% endif %}
|
2015-03-08 21:23:26 +01:00
|
|
|
|
2022-02-02 23:32:48 +01:00
|
|
|
{% if grains.os_family == 'Suse' or grains.os == 'SUSE' %}
|
2015-03-08 21:23:26 +01:00
|
|
|
nginx_zypp_repo:
|
|
|
|
pkgrepo:
|
2017-06-24 15:43:25 +02:00
|
|
|
{%- if from_official %}
|
2015-03-08 21:23:26 +01:00
|
|
|
- managed
|
|
|
|
{%- else %}
|
|
|
|
- absent
|
|
|
|
{%- endif %}
|
|
|
|
- name: server_http
|
|
|
|
- humanname: server_http
|
|
|
|
- baseurl: 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/'
|
|
|
|
- enabled: True
|
|
|
|
- autorefresh: True
|
2016-02-24 11:11:42 +01:00
|
|
|
- gpgcheck: {{ nginx.lookup.gpg_check }}
|
|
|
|
- gpgkey: {{ nginx.lookup.gpg_key }}
|
2015-03-08 21:23:26 +01:00
|
|
|
- require_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
- watch_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
{% endif %}
|
2015-04-21 12:16:19 +02:00
|
|
|
|
2022-02-02 23:32:48 +01:00
|
|
|
{% if grains.os_family == 'RedHat' %}
|
2022-02-03 15:45:11 +01:00
|
|
|
{% if grains.get('osfinger', '') == 'Amazon Linux-2' %}
|
2021-02-14 09:01:26 +01:00
|
|
|
nginx_epel_repo:
|
|
|
|
pkgrepo.managed:
|
|
|
|
- name: epel
|
|
|
|
- humanname: Extra Packages for Enterprise Linux 7 - $basearch
|
|
|
|
- mirrorlist: https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
|
|
|
|
- enabled: 1
|
|
|
|
- gpgcheck: 1
|
|
|
|
- gpgkey: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
|
|
|
|
- failovermethod: priority
|
|
|
|
- require_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
- watch_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
{% endif %}
|
|
|
|
|
2015-04-21 12:16:19 +02:00
|
|
|
nginx_yum_repo:
|
2017-06-24 15:43:25 +02:00
|
|
|
pkgrepo:
|
|
|
|
{%- if from_official %}
|
|
|
|
- managed
|
|
|
|
{%- else %}
|
|
|
|
- absent
|
|
|
|
{%- endif %}
|
2015-04-21 12:16:19 +02:00
|
|
|
- name: nginx
|
|
|
|
- humanname: nginx repo
|
2022-02-03 15:45:11 +01:00
|
|
|
{%- if grains.os == 'CentOS' %}
|
2015-05-17 17:23:01 +02:00
|
|
|
- baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/'
|
2015-04-21 12:16:19 +02:00
|
|
|
{%- else %}
|
2015-05-14 02:00:12 +02:00
|
|
|
- baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/'
|
2015-04-21 12:16:19 +02:00
|
|
|
{%- endif %}
|
2016-02-24 11:11:42 +01:00
|
|
|
- gpgcheck: {{ nginx.lookup.gpg_check }}
|
|
|
|
- gpgkey: {{ nginx.lookup.gpg_key }}
|
2015-04-21 12:16:19 +02:00
|
|
|
- enabled: True
|
|
|
|
- require_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
- watch_in:
|
|
|
|
- pkg: nginx_install
|
2017-06-24 15:43:25 +02:00
|
|
|
|
|
|
|
nginx_phusionpassenger_yum_repo:
|
|
|
|
pkgrepo:
|
|
|
|
{%- if from_phusionpassenger %}
|
|
|
|
- managed
|
|
|
|
{%- else %}
|
|
|
|
- absent
|
|
|
|
{%- endif %}
|
|
|
|
- name: passenger
|
|
|
|
- humanname: nginx phusionpassenger repo
|
|
|
|
- baseurl: 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch'
|
|
|
|
- repo_gpgcheck: 1
|
2019-10-09 15:43:08 +02:00
|
|
|
- gpgcheck: 0
|
2020-09-23 21:05:07 +02:00
|
|
|
- gpgkey: 'https://oss-binaries.phusionpassenger.com/yum/definitions/RPM-GPG-KEY.asc'
|
2017-06-24 15:43:25 +02:00
|
|
|
- enabled: True
|
|
|
|
- sslverify: 1
|
|
|
|
- sslcacert: /etc/pki/tls/certs/ca-bundle.crt
|
|
|
|
- require_in:
|
|
|
|
- pkg: nginx_install
|
|
|
|
- watch_in:
|
|
|
|
- pkg: nginx_install
|
2015-04-21 12:16:19 +02:00
|
|
|
{% endif %}
|