Compatibility with Ansible 2.2.0.0. Fix with default empty arrays

This commit is contained in:
Manuel Valle 2017-05-03 16:25:45 +02:00
parent b939c24b3d
commit 5ed5f80030
6 changed files with 7 additions and 8 deletions

View file

@ -33,7 +33,7 @@
- name: "Pre-upgrade | remove etcd-proxy if it exists" - name: "Pre-upgrade | remove etcd-proxy if it exists"
command: "{{ docker_bin_dir }}/docker rm -f {{item}}" command: "{{ docker_bin_dir }}/docker rm -f {{item}}"
with_items: "{{etcd_proxy_container.stdout_lines}}" with_items: "{{etcd_proxy_container.stdout_lines | default([]) }}"
- name: "Pre-upgrade | see if etcdctl is installed" - name: "Pre-upgrade | see if etcdctl is installed"
stat: stat:

View file

@ -4,7 +4,7 @@
vars: vars:
sync_file: "{{ item }}" sync_file: "{{ item }}"
sync_file_dir: "{{ vault_secrets_dir }}" sync_file_dir: "{{ vault_secrets_dir }}"
sync_file_hosts: "{{ groups.vault }}" sync_file_hosts: "{{ groups.vault | default([]) }}"
with_items: with_items:
- root_token - root_token
- unseal_keys - unseal_keys

View file

@ -4,7 +4,7 @@
vars: vars:
sync_file: "ca.pem" sync_file: "ca.pem"
sync_file_dir: "{{ vault_cert_dir }}" sync_file_dir: "{{ vault_cert_dir }}"
sync_file_hosts: "{{ groups.vault }}" sync_file_hosts: "{{ groups.vault | default([]) }}"
sync_file_is_cert: true sync_file_is_cert: true
- name: bootstrap/sync_vault_certs | Set facts for vault sync_file results - name: bootstrap/sync_vault_certs | Set facts for vault sync_file results
@ -19,7 +19,7 @@
vars: vars:
sync_file: "api.pem" sync_file: "api.pem"
sync_file_dir: "{{ vault_cert_dir }}" sync_file_dir: "{{ vault_cert_dir }}"
sync_file_hosts: "{{ groups.vault }}" sync_file_hosts: "{{ groups.vault | default([]) }}"
sync_file_is_cert: true sync_file_is_cert: true
- name: bootstrap/sync_vault_certs | Set fact if Vault's API cert is needed - name: bootstrap/sync_vault_certs | Set fact if Vault's API cert is needed
@ -29,4 +29,3 @@
- name: bootstrap/sync_vault_certs | Unset sync_file_results after api.pem sync - name: bootstrap/sync_vault_certs | Unset sync_file_results after api.pem sync
set_fact: set_fact:
sync_file_results: [] sync_file_results: []

View file

@ -28,4 +28,4 @@
- name: check_vault | Set fact about the Vault cluster's initialization state - name: check_vault | Set fact about the Vault cluster's initialization state
set_fact: set_fact:
vault_cluster_is_initialized: "{{ vault_is_initialized or hostvars[item]['vault_is_initialized'] }}" vault_cluster_is_initialized: "{{ vault_is_initialized or hostvars[item]['vault_is_initialized'] }}"
with_items: "{{ groups.vault }}" with_items: "{{ groups.vault | default([]) }}"

View file

@ -13,5 +13,5 @@
- name: find_leader | Set fact for current http leader - name: find_leader | Set fact for current http leader
set_fact: set_fact:
vault_leader_url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://{{ item }}:{{ vault_port }}" vault_leader_url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://{{ item }}:{{ vault_port }}"
with_items: "{{ groups.vault }}" with_items: "{{ groups.vault | default([]) }}"
when: "hostvars[item]['vault_leader_check'].get('status') == 200" when: "hostvars[item]['vault_leader_check'].get('status') == 200"

View file

@ -4,7 +4,7 @@
vars: vars:
sync_file: "auth-ca.pem" sync_file: "auth-ca.pem"
sync_file_dir: "{{ vault_cert_dir }}" sync_file_dir: "{{ vault_cert_dir }}"
sync_file_hosts: "{{ groups.vault }}" sync_file_hosts: "{{ groups.vault | default([]) }}"
sync_file_is_cert: true sync_file_is_cert: true
- name: shared/sync_auth_certs | Set facts for vault sync_file results - name: shared/sync_auth_certs | Set facts for vault sync_file results