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:
parent
97ac9465b4
commit
de0b7de0ba
3 changed files with 21 additions and 10 deletions
|
@ -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
|
# set the ssh server port
|
||||||
sshd__port: 22
|
sshd__port: 22
|
||||||
# ssh password authorisatuin (not recomended)
|
# ssh password authorisatuin (not recomended)
|
||||||
|
|
|
@ -22,16 +22,24 @@
|
||||||
sshd__allowed_users: '{{ sshd__allowed_users + users.keys() | default({}) | sort }}'
|
sshd__allowed_users: '{{ sshd__allowed_users + users.keys() | default({}) | sort }}'
|
||||||
sshd__allowed_groups: '{{ sshd__allowed_groups + 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:
|
debug:
|
||||||
msg: "{{ ansible_facts.packages[sshd__package][0].version }}"
|
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:
|
set_fact:
|
||||||
sshd__version_is_above_eight: true
|
sshd__version_is_above_eight: true
|
||||||
when: ansible_facts.packages[sshd__package][0].version is version('8.0', '>=')
|
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
|
- include_tasks: keys.yml
|
||||||
|
|
||||||
|
|
|
@ -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'
|
playbook_version_path: 'role-sshd_chaos-bodensee_github.com.version'
|
||||||
|
|
Loading…
Reference in a new issue