ansible/test/integration/targets/tower_group/tasks/main.yml
jainnikhil30 cd27982959 Fixing exception import for tower modules (#50447)
* fixing the exception import from tower modules

* Adding tests for checking tower modules are failing with correct msg

* fixed failing tests

* fixed failing test in tower_team
2019-01-09 15:31:21 +01:00

47 lines
1,013 B
YAML

- name: create a tempdir for hostvars
local_action: shell mktemp -d
register: tempdir
- name: write a file w/ hostvars
local_action:
module: lineinfile
dest: "{{ tempdir.stdout }}/vars"
line: '{"foo": "bar"}'
create: true
- name: Create a Group
tower_group:
name: Some Group
inventory: Demo Inventory
state: present
source: ec2
variables: "@{{ tempdir.stdout }}/vars"
register: result
- assert:
that:
- "result is changed"
- name: Delete a Group
tower_group:
name: Some Group
inventory: Demo Inventory
state: absent
register: result
- assert:
that:
- "result is changed"
- name: Check module fails with correct msg
tower_group:
name: test-group
description: Group Description
inventory: test-non-existing-inventory
state: present
register: result
ignore_errors: true
- assert:
that:
- "result.msg =='Failed to update the group, inventory not found: The requested object could not be found.'"