Fix fact set using ternary filter

When the set_fact module is used with the ternary filter the evaluated
condition must be surrounded in parentheses, otherwise the fact will
always be set to False.

While other uses of ternary within this role don't seem to be effected,
update them also for consistency and readability.

Change-Id: I4809ded8b6fe738f8fa700434739ee0b1f6d3af1
(cherry picked from commit 2f68deee89)
This commit is contained in:
Jimmy McCrory 2017-02-28 10:31:19 -08:00 committed by Jesse Pretorius (odyssey4me)
parent 560f4ebf05
commit afc8242a98
2 changed files with 3 additions and 3 deletions

View File

@ -72,7 +72,7 @@
apt_repository:
repo: "{{ galera_percona_xtrabackup_repo.repo }}"
filename: "{{ galera_percona_xtrabackup_repo.filename | default(omit) }}"
state: "{{ use_percona_upstream | bool | ternary('present','absent') }}"
state: "{{ (use_percona_upstream | bool) | ternary('present','absent') }}"
register: add_repos
until: add_repos|success
retries: 5
@ -102,7 +102,7 @@
name: "{{ item }}"
state: "{{ galera_server_package_state }}"
update_cache: yes
cache_valid_time: "{{ add_repos | changed | ternary('0', cache_timeout) }}"
cache_valid_time: "{{ (add_repos | changed) | ternary('0', cache_timeout) }}"
with_items:
- "{{ galera_packages_list | selectattr('enabled') | rejectattr('local_pkg') | sum(attribute='packages', start=[]) }}"

View File

@ -15,7 +15,7 @@
- name: Set fact for extra arguments in MySQL commands
set_fact:
mysql_extra_args: "{{ ansible_os_family == 'Debian' | ternary('--defaults-file=/etc/mysql/debian.cnf', '') }}"
mysql_extra_args: "{{ (ansible_os_family == 'Debian') | ternary('--defaults-file=/etc/mysql/debian.cnf', '') }}"
tags:
- galera-cluster-state-check
- galera-bootstrap