forked from linux-system-roles/ssh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.yml
More file actions
47 lines (42 loc) · 1.47 KB
/
setup.yml
File metadata and controls
47 lines (42 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- name: Ensure facts used by test
setup:
gather_subset: min
when: "'os_family' not in ansible_facts"
- name: Determine if system is ostree and set flag
when: not __ssh_is_ostree is defined
block:
- name: Check if system is ostree
stat:
path: /run/ostree-booted
register: __ostree_booted_stat
- name: Set flag to indicate system is ostree
set_fact:
__ssh_is_ostree: "{{ __ostree_booted_stat.stat.exists }}"
- name: Make sure openssh is installed before creating backup
vars:
__ssh_test_packages: >-
{{
"openssh-clients" if ansible_facts['os_family'] in ['RedHat', 'Suse']
else "openssh-client"
}}
package:
name: "{{ __ssh_test_packages }}"
state: present
use: "{{ (__ssh_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
- name: Define common variables
ansible.builtin.set_fact:
main_ssh_config: /etc/ssh/ssh_config
main_ssh_config_name: ssh_config
main_ssh_config_path: /etc/ssh/
- name: Define specific variables
ansible.builtin.set_fact:
main_ssh_config: /etc/ssh/ssh_config.d/00-ansible.conf
main_ssh_config_name: 00-ansible.conf
main_ssh_config_path: /etc/ssh/ssh_config.d/
when:
- (ansible_facts['os_family'] in ['RedHat', 'Suse']
and ansible_facts['distribution_major_version'] | int >= 8) or
(ansible_facts['distribution'] == 'Ubuntu'
and ansible_facts['distribution_major_version'] | int >= 20)