Debian Codegraph @

ansible_collections/theforeman/foreman/tests/test_playbooks/resource_info.yml

raw symbols SCIP
1 ---
2 - hosts: localhost
3 collections:
4 - theforeman.foreman
5 gather_facts: false
6 vars_files:
7 - vars/server.yml
8 - vars/resource_info.yml
9 tasks:
10 - include_tasks: tasks/organization.yml
11 vars:
12 organization_name: "{{ item.organization }}"
13 organization_state: present
14 loop: "{{ test_resources }}"
15 - include_tasks: tasks/domain.yml
16 vars:
17 domain_name: "{{ item.domain }}"
18 domain_locations: "{{ omit }}"
19 domain_organizations:
20 - "{{ item.organization }}"
21 domain_state: present
22 loop: "{{ test_resources }}"
23
24 - hosts: tests
25 collections:
26 - theforeman.foreman
27 gather_facts: false
28 vars_files:
29 - vars/server.yml
30 tasks:
31 - name: Search for a setting
32 include_tasks: tasks/resource_info.yml
33 vars:
34 resource: settings
35 search: name = http_proxy
36 return_length: 1
37 - name: List all entities of a resource without any filtering
38 include_tasks: tasks/resource_info.yml
39 vars:
40 resource: instance_hosts
41 return_min: 1
42 - name: Search for an organization and return full details
43 include_tasks: tasks/resource_info.yml
44 vars:
45 resource: organizations
46 search: name="Test Organization"
47 full_details: true
48 return_length: 1
49 - name: List all entities of an organization
50 include_tasks: tasks/resource_info.yml
51 vars:
52 resource: domains
53 organization: "Facts Organization"
54 return_length: 1
55 - name: find organization id
56 resource_info:
57 username: "{{ foreman_username }}"
58 password: "{{ foreman_password }}"
59 server_url: "{{ foreman_server_url }}"
60 validate_certs: "{{ foreman_validate_certs }}"
61 resource: organizations
62 search: name="Facts Organization"
63 register: org_search
64 - name: List all entities of an organization by injecting params manually
65 include_tasks: tasks/resource_info.yml
66 vars:
67 resource: domains
68 params:
69 organization_id: "{{ org_search.resources[0]['id'] }}"
70 return_length: 1
71 - name: Run with invalid resource
72 resource_info:
73 username: "{{ foreman_username }}"
74 password: "{{ foreman_password }}"
75 server_url: "{{ foreman_server_url }}"
76 validate_certs: "{{ foreman_validate_certs }}"
77 resource: foo
78 register: result
79 ignore_errors: true
80 - assert:
81 that:
82 - "'hostgroups' in result.msg"
83 - "'home' not in result.msg"
84 fail_msg: "{{ result.msg }} should have contained all available resources"
85
86 - hosts: localhost
87 collections:
88 - theforeman.foreman
89 gather_facts: false
90 vars_files:
91 - vars/server.yml
92 - vars/resource_info.yml
93 tasks:
94 - include_tasks: tasks/domain.yml
95 vars:
96 domain_name: "{{ item.domain }}"
97 domain_locations: "{{ omit }}"
98 domain_organizations:
99 - "{{ item.organization }}"
100 domain_state: absent
101 loop: "{{ test_resources }}"
102 - include_tasks: tasks/organization.yml
103 vars:
104 organization_name: "{{ item.organization }}"
105 organization_state: absent
106 loop: "{{ test_resources }}"
107 ...