Debian Codegraph @

ansible_collections/community/vmware/tests/integration/targets/vmware_custom_attribute/tasks/main.yml

raw
1 # Test code for the vmware_custom_attribute module.
2 # Copyright: (c) 2022, Mario Lenz <@riolenz.de>
3 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
5 - import_role:
6 name: prepare_vmware_tests
7
8 - name: add VM custom attribute definition
9 community.vmware.vmware_custom_attribute:
10 validate_certs: false
11 hostname: "{{ vcenter_hostname }}"
12 username: "{{ vcenter_username }}"
13 password: "{{ vcenter_password }}"
14 object_type: VirtualMachine
15 custom_attribute: sample_5
16 state: present
17 register: add_attrib_def
18
19 - debug: var=add_attrib_def
20
21 - assert:
22 that:
23 - add_attrib_def is changed
24
25 - name: add VM custom attribute definition again
26 community.vmware.vmware_custom_attribute:
27 validate_certs: false
28 hostname: "{{ vcenter_hostname }}"
29 username: "{{ vcenter_username }}"
30 password: "{{ vcenter_password }}"
31 object_type: VirtualMachine
32 custom_attribute: sample_5
33 state: present
34 register: add_attrib_def
35
36 - debug: var=add_attrib_def
37
38 - assert:
39 that:
40 - not (add_attrib_def is changed)
41
42 - name: remove VM custom attribute definition
43 community.vmware.vmware_custom_attribute:
44 validate_certs: false
45 hostname: "{{ vcenter_hostname }}"
46 username: "{{ vcenter_username }}"
47 password: "{{ vcenter_password }}"
48 object_type: VirtualMachine
49 custom_attribute: sample_5
50 state: absent
51 register: remove_attrib_def
52
53 - debug: var=remove_attrib_def
54
55 - assert:
56 that:
57 - remove_attrib_def is changed
58
59 - name: remove VM custom attribute definition again
60 community.vmware.vmware_custom_attribute:
61 validate_certs: false
62 hostname: "{{ vcenter_hostname }}"
63 username: "{{ vcenter_username }}"
64 password: "{{ vcenter_password }}"
65 object_type: VirtualMachine
66 custom_attribute: sample_5
67 state: absent
68 register: remove_attrib_def
69
70 - debug: var=remove_attrib_def
71
72 - assert:
73 that:
74 - not (remove_attrib_def is changed)
75
76 - name: add Global custom attribute definition
77 community.vmware.vmware_custom_attribute:
78 validate_certs: false
79 hostname: "{{ vcenter_hostname }}"
80 username: "{{ vcenter_username }}"
81 password: "{{ vcenter_password }}"
82 object_type: Global
83 custom_attribute: sample_5
84 state: present
85 register: add_attrib_def
86
87 - debug: var=add_attrib_def
88
89 - assert:
90 that:
91 - add_attrib_def is changed
92
93 - name: add Global custom attribute definition again
94 community.vmware.vmware_custom_attribute:
95 validate_certs: false
96 hostname: "{{ vcenter_hostname }}"
97 username: "{{ vcenter_username }}"
98 password: "{{ vcenter_password }}"
99 object_type: Global
100 custom_attribute: sample_5
101 state: present
102 register: add_attrib_def
103
104 - debug: var=add_attrib_def
105
106 - assert:
107 that:
108 - not (add_attrib_def is changed)
109
110 - name: remove Global custom attribute definition
111 community.vmware.vmware_custom_attribute:
112 validate_certs: false
113 hostname: "{{ vcenter_hostname }}"
114 username: "{{ vcenter_username }}"
115 password: "{{ vcenter_password }}"
116 object_type: Global
117 custom_attribute: sample_5
118 state: absent
119 register: remove_attrib_def
120
121 - debug: var=remove_attrib_def
122
123 - assert:
124 that:
125 - remove_attrib_def is changed
126
127 - name: remove Global custom attribute definition again
128 community.vmware.vmware_custom_attribute:
129 validate_certs: false
130 hostname: "{{ vcenter_hostname }}"
131 username: "{{ vcenter_username }}"
132 password: "{{ vcenter_password }}"
133 object_type: Global
134 custom_attribute: sample_5
135 state: absent
136 register: remove_attrib_def
137
138 - debug: var=remove_attrib_def
139
140 - assert:
141 that:
142 - not (remove_attrib_def is changed)