From 5638836f0487facbd01a3380331de4ec7ac6162c Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 30 Aug 2023 12:41:13 +0200 Subject: [PATCH] WIP --- handlers/main.yml | 2 +- molecule/default/prepare.yml | 4 ++-- tasks/main.yml | 10 +++++----- tests/tasks/pre.yml | 2 +- tests/test.yml | 4 ++-- tests/vagrant.yml | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 0dcd701..5054bd9 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,7 @@ # handlers file --- - name: restart ssh - service: + ansible.builtin.service: name: ssh state: restarted when: service_default_state | default('started') == 'started' diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index bb63e11..4e9fc84 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -4,6 +4,6 @@ become: true tasks: - name: include vars - include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" - name: include tasks - include: "{{ playbook_dir }}/../../tests/tasks/pre.yml" + ansible.builtin.import_tasks: "{{ playbook_dir }}/../../tests/tasks/pre.yml" diff --git a/tasks/main.yml b/tasks/main.yml index 724a1c9..4664079 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ # tasks file --- - name: install dependencies - apt: + ansible.builtin.apt: name: "{{ ssh_server_dependencies }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true @@ -12,7 +12,7 @@ - ssh-server-dependencies - name: install - apt: + ansible.builtin.apt: name: "{{ ssh_server_install }}" state: "{{ apt_install_state | default('latest') }}" tags: @@ -21,7 +21,7 @@ - ssh-server-install - name: check host keys - command: > + ansible.builtin.command: > ssh-keygen -A args: creates: "{{ item }}" @@ -35,7 +35,7 @@ - ssh-server-check-host-keys - name: update configuration file - template: + ansible.builtin.template: src: etc/ssh/sshd_config.j2 dest: /etc/ssh/sshd_config owner: root @@ -49,7 +49,7 @@ - ssh-server-configuration - name: start and enable service - service: + ansible.builtin.service: name: ssh state: "{{ service_default_state | default('started') }}" enabled: "{{ service_default_enabled | default(true) | bool }}" diff --git a/tests/tasks/pre.yml b/tests/tasks/pre.yml index 6cb0d48..84edd27 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -2,7 +2,7 @@ --- # To prevent: Missing privilege separation directory - name: create (needed) directory - file: + ansible.builtin.file: path: /run/sshd state: directory owner: root diff --git a/tests/test.yml b/tests/test.yml index d3837dc..69b9404 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -5,8 +5,8 @@ become: true pre_tasks: - name: include vars - include_vars: "{{ playbook_dir }}/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml" - name: include tasks - include: "{{ playbook_dir }}/tasks/pre.yml" + ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml" roles: - ../../ diff --git a/tests/vagrant.yml b/tests/vagrant.yml index dce3560..0dff732 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -5,8 +5,8 @@ become: true pre_tasks: - name: include vars - include_vars: "{{ playbook_dir }}/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml" - name: include tasks - include: "{{ playbook_dir }}/tasks/pre.yml" + ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml" roles: - ../../