ansible/test/integration/targets/tower_group/tasks/main.yml
Matt Clay 149336319a
Clean up local_action and delegate_to in tests. (#55835)
* Remove unnecessary delegate_to in tests.

* Remove incorrect delegate_to in tests.

* Remove unnecessary use of local_action in tests.

* Remove incorrect use of local_action in tests.

* Remove unnecessary use of local_action in tests.

* Remove incorrect use of local_action in tests.

* Remove unnecessary use of local_action in tests.

* Use delegate_to instead of local_action in tests.

* Use setup_remote_tmp_dir instead of TMPDIR.
2019-04-26 17:33:59 -07:00

46 lines
975 B
YAML

- name: create a tempdir for hostvars
shell: mktemp -d
register: tempdir
- name: write a file w/ hostvars
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.'"