Compare commits
3 Commits
728a57347d
...
1d5918bc6d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d5918bc6d | ||
|
|
1afc3338b1 | ||
|
|
a1e6c03827 |
@@ -4,10 +4,10 @@
|
||||
msg: "{{ lookup('ansible.builtin.template', 'distroerror.j2').strip() }}"
|
||||
when: >
|
||||
_compatcheck_distro | length != 1 or (
|
||||
ansible_distribution_major_version != 'n/a' and
|
||||
_compatcheck_distro[0].version_min | default(0) > ansible_distribution_major_version | int
|
||||
ansible_facts.distribution_major_version != 'n/a' and
|
||||
_compatcheck_distro[0].version_min | default(0) > ansible_facts.distribution_major_version | int
|
||||
) or
|
||||
_compatcheck_distro[0].version_max is defined and _compatcheck_distro[0].version_max < ansible_distribution_major_version | int or
|
||||
ansible_pkg_mgr not in _compatcheck_distro[0].package_managers | default([_compatcheck_default_package_manager])
|
||||
_compatcheck_distro[0].version_max is defined and _compatcheck_distro[0].version_max < ansible_facts.distribution_major_version | int or
|
||||
ansible_facts.pkg_mgr not in _compatcheck_distro[0].package_managers | default([_compatcheck_default_package_manager])
|
||||
loop_control:
|
||||
loop_var: checkfailed
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
{{ distros.append(distro_name ~ distro_package_managers_str) }}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
This role only supports {{ distros | join(', ') }} (You are running {{ ansible_distribution }} {{ ansible_distribution_major_version }} ({{ ansible_pkg_mgr }})
|
||||
This role only supports {{ distros | join(', ') }} (You are running {{ ansible_facts.distribution }} {{ ansible_facts.distribution_major_version }} ({{ ansible_facts.pkg_mgr }})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
_compatcheck_distro: "{{ compatcheck_supported_distributions | selectattr('name', 'equalto', ansible_distribution | lower) }}"
|
||||
_compatcheck_distro: "{{ compatcheck_supported_distributions | selectattr('name', 'equalto', ansible_facts.distribution | lower) }}"
|
||||
_compatcheck_default_package_managers:
|
||||
debian: apt
|
||||
ubuntu: apt
|
||||
fedora: dnf
|
||||
archlinux: pacman
|
||||
macosx: homebrew
|
||||
_compatcheck_default_package_manager: "{{ _compatcheck_default_package_managers[ansible_distribution | lower] }}"
|
||||
_compatcheck_default_package_manager: "{{ _compatcheck_default_package_managers[ansible_facts.distribution | lower] }}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: Restart sshd
|
||||
- name: Restart ssh service
|
||||
ansible.builtin.systemd_service:
|
||||
name: sshd.service
|
||||
name: "{{ _ssh_service_name }}"
|
||||
state: restarted
|
||||
|
||||
@@ -6,8 +6,13 @@
|
||||
line: "{{ item.key }} {{ item.value }}"
|
||||
state: present
|
||||
validate: '/usr/sbin/sshd -t -f %s'
|
||||
notify: Restart sshd
|
||||
notify: Restart ssh service
|
||||
with_dict:
|
||||
PermitRootLogin: "prohibit-password"
|
||||
PasswordAuthentication: "{{ 'yes' if ssh_password_auth else 'no' }}"
|
||||
X11Forwarding: "no"
|
||||
|
||||
- name: Ensure ssh service is enabled
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ _ssh_service_name }}"
|
||||
enabled: true
|
||||
|
||||
2
roles/ssh/vars/main.yaml
Normal file
2
roles/ssh/vars/main.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
_ssh_service_name: "{{ 'ssh.service' if ansible_facts.os_family == 'Debian' else 'sshd.service' }}"
|
||||
@@ -247,6 +247,26 @@ argument_specs:
|
||||
type: dict
|
||||
required: false
|
||||
default: {}
|
||||
match_query:
|
||||
description: Query to match
|
||||
type: list
|
||||
elements: dict
|
||||
required: false
|
||||
default: []
|
||||
options:
|
||||
key:
|
||||
description: Query key to match
|
||||
type: str
|
||||
required: true
|
||||
value:
|
||||
description: Query value to match. Matches any if unset.
|
||||
type: str
|
||||
required: false
|
||||
reverse:
|
||||
description: If true, matches request without matching key/value
|
||||
type: bool
|
||||
required: false
|
||||
default: false
|
||||
|
||||
type:
|
||||
type: str
|
||||
@@ -655,6 +675,26 @@ argument_specs:
|
||||
type: dict
|
||||
required: false
|
||||
default: {}
|
||||
match_query:
|
||||
description: Query to match
|
||||
type: list
|
||||
elements: dict
|
||||
required: false
|
||||
default: []
|
||||
options:
|
||||
key:
|
||||
description: Query key to match
|
||||
type: str
|
||||
required: true
|
||||
value:
|
||||
description: Query value to match. Matches any if unset.
|
||||
type: str
|
||||
required: false
|
||||
reverse:
|
||||
description: If true, matches request without matching key/value
|
||||
type: bool
|
||||
required: false
|
||||
default: false
|
||||
|
||||
type:
|
||||
type: str
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
{% for matcher in location.matchers %}
|
||||
{% if matcher.name != '' %}
|
||||
@{{ matcher.name }} {
|
||||
{% for query in matcher.match_query | default([]) %}
|
||||
{{ 'not ' if query.reverse else '' }}query {{ query.key }}={{ query.value | default('*') }}
|
||||
{% endfor %}
|
||||
{% if matcher.match_methods | default([]) | length > 0 %}
|
||||
method {{ matcher.match_methods | join(' ') }}
|
||||
{% endif %}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
_vhost_matcher_defaults:
|
||||
match_headers: {}
|
||||
match_methods: []
|
||||
match_query: []
|
||||
_vhost_matchers: >-
|
||||
{{
|
||||
vhost_matchers
|
||||
|
||||
Reference in New Issue
Block a user