1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_sshd.git synced 2024-08-16 11:59:49 +02:00

update sshd version eight detection

This commit is contained in:
L3D 2020-09-21 14:51:37 +02:00 committed by L3D
parent 97ac9465b4
commit de0b7de0ba
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
3 changed files with 21 additions and 10 deletions

View file

@ -1,4 +1,7 @@
---
# enable option if know that your ssh-server version is over 8.0
# sshd__version_is_above_eight: true
# set the ssh server port
sshd__port: 22
# ssh password authorisatuin (not recomended)

View file

@ -22,16 +22,24 @@
sshd__allowed_users: '{{ sshd__allowed_users + users.keys() | default({}) | sort }}'
sshd__allowed_groups: '{{ sshd__allowed_groups + users.keys() | default({}) | sort }}'
- name: "get package version of {{ sshd__package }}"
- name: "try to get {{ sshd__package }} version"
when: sshd__version_is_above_eight is not defined
block:
- name: Gather the package facts
package_facts:
manager: auto
- name: "get package version of {{ sshd__package }}"
debug:
msg: "{{ ansible_facts.packages[sshd__package][0].version }}"
when: sshd__package in ansible_facts.packages
failed_when: false
- name: set fact sshd__version_is_above_eight
- name: set fact sshd__version_is_above_eight
set_fact:
sshd__version_is_above_eight: true
when: ansible_facts.packages[sshd__package][0].version is version('8.0', '>=')
rescue:
- debug:
msg: "Failed to detect ssh version. Set sshd__version_is_above_eight to true if you want to experience new config features from sshd version 8"
- include_tasks: keys.yml

View file

@ -1,3 +1,3 @@
---
playbook_version_number: 4097 # should be over ninethousand
playbook_version_number: 4098 # should be over ninethousand
playbook_version_path: 'role-sshd_chaos-bodensee_github.com.version'