Debian Codegraph @

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

raw symbols SCIP
1 ---
2 ## To record cassettes using this playbook (record_discovery_rule)
3 ## you need to have the discovery plugin active
4 ## $ foreman-installer --enable-foreman-plugin-discovery
5 ##
6 ## You also need the proxy to be setup with the DNS feature:
7 ## $ foreman-installer --foreman-proxy-dns true
8 ##
9
10 - hosts: localhost
11 collections:
12 - theforeman.foreman
13 gather_facts: false
14 vars_files:
15 - vars/server.yml
16 - vars/hostgroup.yml
17 tasks:
18 - include_tasks: tasks/location.yml
19 vars:
20 location_name: "{{ item }}"
21 location_state: present
22 with_items: "{{ hostgroup.locations }}"
23 - include_tasks: tasks/organization.yml
24 vars:
25 organization_name: "{{ item }}"
26 organization_state: present
27 with_items: "{{ hostgroup.organizations }}"
28 - include_tasks: tasks/hostgroup.yml
29 vars:
30 hostgroup_name: "Discovery hostgroup"
31 hostgroup_description: "Discovery hostgroup"
32 hostgroup_locations: "{{ hostgroup.locations }}"
33 hostgroup_organizations: "{{ hostgroup.organizations }}"
34 hostgroup_state: present
35 - include_tasks: tasks/discovery_rule.yml
36 vars:
37 discovery_rule_name: 'New-discovery-rule'
38 discovery_rule_state: 'absent'
39
40 - hosts: tests
41 collections:
42 - theforeman.foreman
43 gather_facts: false
44 vars_files:
45 - vars/server.yml
46 - vars/hostgroup.yml
47 tasks:
48 - include_tasks: tasks/discovery_rule.yml
49 vars:
50 discovery_rule_name: 'New-discovery-rule'
51 discovery_rule_search: 'mac = aa:aa:aa:aa:aa:aa'
52 discovery_rule_hostgroup: 'Discovery hostgroup'
53 discovery_rule_hostname: 'discovered-host'
54 discovery_rule_max_count: '1'
55 discovery_rule_organizations: "{{ hostgroup.organizations }}"
56 discovery_rule_locations: "{{ hostgroup.locations }}"
57 discovery_rule_state: 'present'
58 expected_change: true
59
60 - include_tasks: tasks/discovery_rule.yml
61 vars:
62 discovery_rule_name: 'New-discovery-rule'
63 discovery_rule_search: 'mac = aa:aa:aa:aa:aa:aa'
64 discovery_rule_hostgroup: 'Discovery hostgroup'
65 discovery_rule_hostname: 'discovered-host'
66 discovery_rule_max_count: '1'
67 discovery_rule_organizations: "{{ hostgroup.organizations }}"
68 discovery_rule_locations: "{{ hostgroup.locations }}"
69 discovery_rule_state: 'present'
70 expected_change: false
71
72 - include_tasks: tasks/discovery_rule.yml
73 vars:
74 discovery_rule_name: 'New-discovery-rule'
75 discovery_rule_state: 'absent'
76 expected_change: true
77
78 - include_tasks: tasks/discovery_rule.yml
79 vars:
80 discovery_rule_name: 'New-discovery-rule'
81 discovery_rule_state: 'absent'
82 expected_change: false
83
84 - hosts: localhost
85 collections:
86 - theforeman.foreman
87 gather_facts: false
88 vars_files:
89 - vars/server.yml
90 - vars/hostgroup.yml
91 tasks:
92 - include_tasks: tasks/hostgroup.yml
93 vars:
94 hostgroup_name: "Discovery hostgroup"
95 hostgroup_description: "Discovery hostgroup"
96 hostgroup_locations: "{{ hostgroup.locations }}"
97 hostgroup_organizations: "{{ hostgroup.organizations }}"
98 hostgroup_state: absent
99 - include_tasks: tasks/location.yml
100 vars:
101 location_name: "{{ item }}"
102 location_state: absent
103 with_items: "{{ hostgroup.locations | reverse | list }}"
104 - include_tasks: tasks/organization.yml
105 vars:
106 organization_name: "{{ item }}"
107 organization_state: absent
108 with_items: "{{ hostgroup.organizations }}"