Simplify config and rename some files

This commit is contained in:
Sam A. 2022-11-14 00:13:24 +01:00
parent 01d9d3c04b
commit 3b7c096f8e
Signed by: samsapti
GPG Key ID: CBBBE7371E81C4EA
4 changed files with 9 additions and 12 deletions

View File

@ -1,3 +0,0 @@
---
- name: Gather facts
gather_facts:

View File

@ -1,8 +1,8 @@
---
- import_tasks: ssh.yml
- import_tasks: ssh-port.yml
tags: [change-ssh-port]
- import_tasks: facts.yml
tags: [gather-facts]
- import_tasks: virtualization.yml
tags: [gather-virtualization-facts]
- import_tasks: dell-apt-repo.yml
tags: [setup-dell-apt-repo]
when: ansible_virtualization_role != "guest"

View File

@ -16,9 +16,7 @@
set_fact:
ansible_port: 22
when: ssh_configured is defined and
(ssh_configured.state is undefined or
(ssh_configured.state is defined and
ssh_configured.state != "started")) and
ssh_configured.state is undefined and
ansible_port != 2222
- name: Change SSH port on host
@ -29,9 +27,7 @@
register: ssh_changed
notify: "Restart sshd"
when: ssh_configured is defined and
(ssh_configured.state is undefined or
(ssh_configured.state is defined and
ssh_configured.state != "started"))
ssh_configured.state is undefined
- name: Ensure sshd is reloaded if needed
meta: flush_handlers

View File

@ -0,0 +1,4 @@
---
- name: Find out if running in a VM
setup:
gather_subset: virtualization_role