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] tags: [change-ssh-port]
- import_tasks: facts.yml - import_tasks: virtualization.yml
tags: [gather-facts] tags: [gather-virtualization-facts]
- import_tasks: dell-apt-repo.yml - import_tasks: dell-apt-repo.yml
tags: [setup-dell-apt-repo] tags: [setup-dell-apt-repo]
when: ansible_virtualization_role != "guest" when: ansible_virtualization_role != "guest"

View file

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

View file

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