From 1c88bac344fc50aab7316f40b9c667f92117c4d5 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Thu, 13 Aug 2020 16:28:24 +0100 Subject: [PATCH] Add missing hosts to test files Ansible requires hosts to be present in playbooks and in order to be able pass ansible syntax check we need to add it to our tests. Needed-By: #950 --- test/command-check-failure.yml | 3 ++- test/command-check-success.yml | 6 ++++-- test/command-instead-of-shell-failure.yml | 3 ++- test/command-instead-of-shell-success.yml | 3 ++- test/jinja2-when-success.yml | 6 ++---- test/package-check-failure.yml | 3 ++- test/package-check-success.yml | 3 ++- test/role-with-handler/main.yml | 3 ++- test/test/always-run-success.yml | 1 + 9 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 test/test/always-run-success.yml diff --git a/test/command-check-failure.yml b/test/command-check-failure.yml index 3f2bcc98d4..d58c09d786 100644 --- a/test/command-check-failure.yml +++ b/test/command-check-failure.yml @@ -1,4 +1,5 @@ -- tasks: +- hosts: localhost + tasks: - name: command without checks command: echo blah args: diff --git a/test/command-check-success.yml b/test/command-check-success.yml index 837a97f497..24266fffc7 100644 --- a/test/command-check-success.yml +++ b/test/command-check-success.yml @@ -1,4 +1,5 @@ -- tasks: +- hosts: localhost + tasks: - name: command with creates check command: echo blah args: @@ -53,7 +54,8 @@ args: creates: Z -- handlers: +- hosts: localhost + handlers: - name: restart something command: do something - include: included-handlers.yml diff --git a/test/command-instead-of-shell-failure.yml b/test/command-instead-of-shell-failure.yml index 592c35b6af..7b8d829533 100644 --- a/test/command-instead-of-shell-failure.yml +++ b/test/command-instead-of-shell-failure.yml @@ -1,5 +1,6 @@ --- -- tasks: +- hosts: localhost + tasks: - name: shell no pipe shell: echo hello diff --git a/test/command-instead-of-shell-success.yml b/test/command-instead-of-shell-success.yml index ccdd3361a6..410ff97b96 100644 --- a/test/command-instead-of-shell-success.yml +++ b/test/command-instead-of-shell-success.yml @@ -1,4 +1,5 @@ -- tasks: +- hosts: localhost + tasks: - name: shell with pipe shell: echo hello | true diff --git a/test/jinja2-when-success.yml b/test/jinja2-when-success.yml index caac9281e4..20d3db91fc 100644 --- a/test/jinja2-when-success.yml +++ b/test/jinja2-when-success.yml @@ -3,8 +3,6 @@ - name: test when debug: msg=text when: true - -- hosts: all - roles: - - role: role + - name: test when 2 + debug: msg=text2 when: 1 = 1 diff --git a/test/package-check-failure.yml b/test/package-check-failure.yml index 70b5bd580a..8c25f3cc67 100644 --- a/test/package-check-failure.yml +++ b/test/package-check-failure.yml @@ -1,4 +1,5 @@ -- tasks: +- hosts: localhost + tasks: - name: install ansible yum: name=ansible state=latest diff --git a/test/package-check-success.yml b/test/package-check-success.yml index ccc64aef86..d649dc77c0 100644 --- a/test/package-check-success.yml +++ b/test/package-check-success.yml @@ -1,4 +1,5 @@ -- tasks: +- hosts: localhost + tasks: - name: install ansible yum: name=ansible-2.1.0.0 state=present diff --git a/test/role-with-handler/main.yml b/test/role-with-handler/main.yml index eaeaaccf2e..9b37597d24 100644 --- a/test/role-with-handler/main.yml +++ b/test/role-with-handler/main.yml @@ -1,3 +1,4 @@ -- name: foo +- hosts: localhost + name: foo roles: - { role: a-role } diff --git a/test/test/always-run-success.yml b/test/test/always-run-success.yml new file mode 100644 index 0000000000..468a17cbbd --- /dev/null +++ b/test/test/always-run-success.yml @@ -0,0 +1 @@ +- hosts: localhost