From 4876a64e6c2b6aa85ce93f2fc1f7dcec92b15311 Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Tue, 25 Jan 2022 10:44:36 +0100 Subject: [PATCH] Simplify tasks --- handlers/main.yml | 2 +- tasks/Arch.yml | 9 --------- tasks/Debian.yml | 9 --------- tasks/Raspbian.yml | 9 --------- tasks/main.yml | 6 ++++++ 5 files changed, 7 insertions(+), 28 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 6aece4f..fe201d3 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,4 +1,4 @@ - name: restart sshd ansible.builtin.service: - name: "{{ ssh_service }}" + name: sshd state: restarted diff --git a/tasks/Arch.yml b/tasks/Arch.yml index 2b831de..0b999d4 100644 --- a/tasks/Arch.yml +++ b/tasks/Arch.yml @@ -2,12 +2,3 @@ ansible.builtin.package: name: openssh state: present - -- set_fact: - ssh_service: sshd - -- name: Enable service. - ansible.builtin.service: - name: "{{ ssh_service }}" - enabled: true - state: started diff --git a/tasks/Debian.yml b/tasks/Debian.yml index 45779c0..1cecdb9 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -2,12 +2,3 @@ ansible.builtin.package: name: ssh state: present - -- set_fact: - ssh_service: sshd - -- name: Enable service. - ansible.builtin.service: - name: "{{ ssh_service }}" - enabled: true - state: started diff --git a/tasks/Raspbian.yml b/tasks/Raspbian.yml index 45779c0..1cecdb9 100644 --- a/tasks/Raspbian.yml +++ b/tasks/Raspbian.yml @@ -2,12 +2,3 @@ ansible.builtin.package: name: ssh state: present - -- set_fact: - ssh_service: sshd - -- name: Enable service. - ansible.builtin.service: - name: "{{ ssh_service }}" - enabled: true - state: started diff --git a/tasks/main.yml b/tasks/main.yml index d2bbc1d..0e856bc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,11 @@ - ansible.builtin.include_tasks: "{{ ansible_lsb['id'] }}.yml" +- name: Enable service. + ansible.builtin.service: + name: sshd + enabled: true + state: started + - name: Ensure sshd_config is setup. ansible.builtin.lineinfile: path: /etc/ssh/sshd_config