Use Ansible ternary operator instead of J2 conditionals

This commit is contained in:
Alessandro Fael Garcia 2018-05-14 11:31:46 -07:00
parent c1a4eb6a99
commit 8e3ca5e5a0

View File

@ -15,12 +15,12 @@ install_from: nginx_repository
# Defaults are the official NGINX repositories. # Defaults are the official NGINX repositories.
nginx_repository: nginx_repository:
debian: debian:
- 'deb https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx' - deb https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
- 'deb-src https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx' - deb-src https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
redhat: redhat:
- https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/ - https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
suse: suse:
- https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}sles/12 - https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}sles/12
# Specify which branch of NGINX Open Source you want to install. # Specify which branch of NGINX Open Source you want to install.
# Options are 'mainline' or 'stable'. # Options are 'mainline' or 'stable'.