Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Upload of Certification Authority doesn't work using Ansible 2.5.1. #639

Closed
iorfix opened this issue Dec 2, 2019 · 1 comment · Fixed by #647
Closed

Upload of Certification Authority doesn't work using Ansible 2.5.1. #639

iorfix opened this issue Dec 2, 2019 · 1 comment · Fixed by #647
Assignees
Labels

Comments

@iorfix
Copy link

iorfix commented Dec 2, 2019

Hi,
I'm testing new SSL ansible support.
Upload of Certification Authority doesn't work using Ansible 2.5.1 (or newer).
Relevant code is in elasticsearch-ss.yml file:

  - name: Upload SSL Certificate Authority
  copy:
    src: "{{ es_ssl_certificate_authority }}"
    dest: "{{ es_ssl_certificate_path }}/{{ es_ssl_certificate_authority | basename }}"
    owner: "{{ es_user }}"
    group: "{{ es_group }}"
    mode: 0640
  #Restart if this changes
  notify: restart elasticsearch
  when: es_ssl_certificate_authority | bool

bool filter return false in Ansible 2.5.x, since es_ssl_certificate_authority is a generic string.

 def to_bool(a):
    ''' return a bool for the arg '''
    if a is None or isinstance(a, bool):
        return a
    if isinstance(a, string_types):
        a = a.lower()
    if a in ('yes', 'on', '1', 'true', 1):
        return True
    return False

Possible solution:
Change last line to
when: (es_ssl_certificate_authority is defined) and (es_ssl_certificate_authority|length > 0)

Regards,
Dario

@jmlrt
Copy link
Member

jmlrt commented Dec 18, 2019

Hi @iorfix,
Thanks for reporting this issue, I created #647 to fix it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants