From 44424474b8c7fa112ff41ee9f8ea54cf1d34d91f Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Mon, 6 Jul 2020 08:39:25 +0200 Subject: [PATCH] fix package install in tests Signed-off-by: Sebastian Gumprich --- tests/default.yml | 44 +++++++++++++++++++----------------- tests/default_custom.yml | 48 ++++++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/tests/default.yml b/tests/default.yml index 634c5d7..85acf89 100644 --- a/tests/default.yml +++ b/tests/default.yml @@ -7,43 +7,47 @@ ansible_python_interpreter: /usr/bin/python3 when: ansible_facts.distribution == 'Fedora' - - package: - name: "{{ packages }}" - state: present - vars: - packages: + - yum: + name: - openssh-clients - openssh-server - libselinux-python + state: present + update_cache: true + ignore_errors: true + + - dnf: + name: + - openssh-clients + - openssh-server + state: present + update_cache: true ignore_errors: true - - apt: - name: "{{ packages }}" - state: present + - apt: + name: + - openssh-client + - openssh-server + state: present update_cache: true - vars: - packages: - - "openssh-client" - - "openssh-server" ignore_errors: true - - file: - path: "/var/run/sshd" + - file: + path: "/var/run/sshd" state: directory - - - pacman: name="{{packages}}" state=present update_cache=true - vars: - packages: + - pacman: + name: - "openssh" - "awk" + state: present + update_cache: true ignore_errors: true - name: create ssh host keys command: "ssh-keygen -A" - when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or + when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or ansible_facts.distribution == "Fedora" or ansible_facts.distribution == "Amazon" - roles: - ansible-ssh-hardening diff --git a/tests/default_custom.yml b/tests/default_custom.yml index 749aeef..82611f3 100644 --- a/tests/default_custom.yml +++ b/tests/default_custom.yml @@ -7,40 +7,46 @@ ansible_python_interpreter: /usr/bin/python3 when: ansible_facts.distribution == 'Fedora' - - package: - name: "{{ packages }}" - state: present - vars: - packages: + - yum: + name: - openssh-clients - openssh-server - libselinux-python + state: present + update_cache: true + ignore_errors: true + + - dnf: + name: + - openssh-clients + - openssh-server + state: present + update_cache: true ignore_errors: true - - - apt: - name: "{{ packages }}" - state: present + + - apt: + name: + - openssh-client + - openssh-server + state: present update_cache: true - vars: - packages: - - "openssh-client" - - "openssh-server" ignore_errors: true - - - file: - path: "/var/run/sshd" + + - file: + path: "/var/run/sshd" state: directory - - - pacman: name="{{packages}}" state=present update_cache=true - vars: - packages: + + - pacman: + name: - "openssh" - "awk" + state: present + update_cache: true ignore_errors: true - name: create ssh host keys command: "ssh-keygen -A" - when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or + when: not ((ansible_facts.os_family in ['Oracle Linux', 'RedHat']) and ansible_facts.distribution_major_version < '7') or ansible_facts.distribution == "Fedora" or ansible_facts.distribution == "Amazon"