fix Ansible 2.19 conditional compatibility in github_ssh role

Fixes 'Conditional result was 'true' of type 'str'' errors.
See: https://ansible.readthedocs.io/projects/ansible-core/devel/porting_guides/porting_guide_core_2.19.html#broken-conditionals
This commit is contained in:
ionutboangiu
2025-08-08 20:51:21 +03:00
committed by Dan Christian Bogos
parent f5be437711
commit 0e06476d74

View File

@@ -59,15 +59,15 @@
body:
title: "{{ github_ssh_key_name }}"
key: "{{ github_ssh_public_key.content | b64decode | trim }}"
read_only: "{{ github_ssh_deploy_key_read_only }}"
read_only: "{{ github_ssh_deploy_key_read_only | bool }}"
status_code: [201, 422] # 201 = created, 422 = key already exists
register: github_deploy_key_result
failed_when: false
when:
- github_ssh_use_deploy_keys
- github_ssh_token != ""
- github_ssh_repo_owner != ""
- github_ssh_repo_name != ""
- github_ssh_use_deploy_keys | bool
- github_ssh_token | length > 0
- github_ssh_repo_owner | length > 0
- github_ssh_repo_name | length > 0
- name: Add SSH key to GitHub user account
ansible.builtin.uri:
@@ -84,8 +84,8 @@
register: github_user_key_result
failed_when: false
when:
- not (github_ssh_use_deploy_keys)
- github_ssh_token != ""
- not (github_ssh_use_deploy_keys | bool)
- github_ssh_token | length > 0
- name: Create SSH config for GitHub
ansible.builtin.blockinfile: