| 1 |
--- |
| 2 |
- name: Converge file for default/negative scenarios |
| 3 |
hosts: all |
| 4 |
gather_facts: false |
| 5 |
tasks: |
| 6 |
- name: Perform update with wrong hostname |
| 7 |
ansible.builtin.import_role: |
| 8 |
name: dellemc.openmanage.idrac_attributes |
| 9 |
vars: |
| 10 |
hostname: "randomHostname" |
| 11 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 12 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 13 |
validate_certs: false |
| 14 |
idrac_attributes: |
| 15 |
SSH.1.Timeout: 1800 |
| 16 |
ignore_unreachable: true |
| 17 |
register: idrac_attributes_error_msg |
| 18 |
|
| 19 |
- name: Asserting after performing operation with wrong hostname |
| 20 |
ansible.builtin.assert: |
| 21 |
that: '"<urlopen error [Errno -2] Name or service not known>" in |
| 22 |
idrac_attributes_out.msg' |
| 23 |
|
| 24 |
- name: Perform update with wrong username |
| 25 |
ansible.builtin.import_role: |
| 26 |
name: dellemc.openmanage.idrac_attributes |
| 27 |
vars: |
| 28 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 29 |
username: "WrongUsername123" |
| 30 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 31 |
validate_certs: false |
| 32 |
idrac_attributes: |
| 33 |
SSH.1.Timeout: 1800 |
| 34 |
ignore_errors: true |
| 35 |
register: idrac_attributes_error_msg |
| 36 |
|
| 37 |
- name: Asserting after performing operation with wrong username |
| 38 |
ansible.builtin.assert: |
| 39 |
that: |
| 40 |
- '"HTTP Error 401" in idrac_attributes_out.msg' |
| 41 |
|
| 42 |
- name: Perform update with wrong password |
| 43 |
ansible.builtin.import_role: |
| 44 |
name: dellemc.openmanage.idrac_attributes |
| 45 |
vars: |
| 46 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 47 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 48 |
password: "WrongPassword@123" |
| 49 |
validate_certs: false |
| 50 |
idrac_attributes: |
| 51 |
SSH.1.Timeout: 1800 |
| 52 |
ignore_errors: true |
| 53 |
register: idrac_attributes_error_msg |
| 54 |
|
| 55 |
- name: Asserting after performing operation with wrong password |
| 56 |
ansible.builtin.assert: |
| 57 |
that: |
| 58 |
- '"HTTP Error 401" in idrac_attributes_out.msg' |
| 59 |
|
| 60 |
- name: Perform update with invalid https_port |
| 61 |
ansible.builtin.import_role: |
| 62 |
name: dellemc.openmanage.idrac_attributes |
| 63 |
vars: |
| 64 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 65 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 66 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 67 |
validate_certs: false |
| 68 |
https_port: 9999999 |
| 69 |
idrac_attributes: |
| 70 |
SSH.1.Timeout: 1800 |
| 71 |
ignore_unreachable: true |
| 72 |
register: idrac_attributes_error_msg |
| 73 |
|
| 74 |
- name: Asserting after performing operation with invalid https_port |
| 75 |
ansible.builtin.assert: |
| 76 |
that: '"<urlopen error [Errno 111] Connection refused>" in |
| 77 |
idrac_attributes_out.msg' |
| 78 |
|
| 79 |
- name: Perform update with invalid validate_certs |
| 80 |
ansible.builtin.import_role: |
| 81 |
name: dellemc.openmanage.idrac_attributes |
| 82 |
vars: |
| 83 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 84 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 85 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 86 |
https_port: 443 |
| 87 |
validate_certs: "someStringValue" |
| 88 |
idrac_attributes: |
| 89 |
SSH.1.Timeout: 1800 |
| 90 |
ignore_errors: true |
| 91 |
ignore_unreachable: true |
| 92 |
register: idrac_attributes_error_msg |
| 93 |
|
| 94 |
- name: Asserting after performing operation with invalid validate_certs |
| 95 |
ansible.builtin.assert: |
| 96 |
that: |
| 97 |
- '"Valid booleans include" in idrac_attributes_out.msg' |
| 98 |
|
| 99 |
- name: Perform update with wrong ca_path |
| 100 |
ansible.builtin.import_role: |
| 101 |
name: dellemc.openmanage.idrac_attributes |
| 102 |
vars: |
| 103 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 104 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 105 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 106 |
https_port: 443 |
| 107 |
ca_path: "" |
| 108 |
validate_certs: true |
| 109 |
idrac_attributes: |
| 110 |
SSH.1.Timeout: 1800 |
| 111 |
ignore_unreachable: true |
| 112 |
register: idrac_attributes_error_msg |
| 113 |
|
| 114 |
- name: Asserting after performing operation with wrong ca_path |
| 115 |
ansible.builtin.assert: |
| 116 |
that: '"<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate |
| 117 |
verify failed: self-signed certificate (_ssl.c:1000)>" in |
| 118 |
idrac_attributes_out.msg' |
| 119 |
|
| 120 |
- name: Perform update with wrong manager_id |
| 121 |
ansible.builtin.import_role: |
| 122 |
name: dellemc.openmanage.idrac_attributes |
| 123 |
vars: |
| 124 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 125 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 126 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 127 |
https_port: 443 |
| 128 |
validate_certs: false |
| 129 |
idrac_attributes: |
| 130 |
SSH.1.Timeout: 1800 |
| 131 |
manager_id: idrac.random.5 |
| 132 |
ignore_errors: true |
| 133 |
register: idrac_attributes_error_msg |
| 134 |
|
| 135 |
- name: Asserting after performing operation with wrong manager_id |
| 136 |
ansible.builtin.assert: |
| 137 |
that: |
| 138 |
- '"HTTP Error 404: Not Found" in idrac_attributes_out.msg' |
| 139 |
|
| 140 |
- name: Perform update with read only attributes |
| 141 |
ansible.builtin.import_role: |
| 142 |
name: dellemc.openmanage.idrac_attributes |
| 143 |
vars: |
| 144 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 145 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 146 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 147 |
https_port: 443 |
| 148 |
validate_certs: false |
| 149 |
idrac_attributes: |
| 150 |
SSH.1.MaxSessions: 5 |
| 151 |
manager_id: "{{ null | default(omit) }}" |
| 152 |
ignore_errors: true |
| 153 |
register: idrac_attributes_error_msg |
| 154 |
|
| 155 |
- name: Asserting after performing operation with read only attributes |
| 156 |
ansible.builtin.assert: |
| 157 |
that: |
| 158 |
- idrac_attributes_out.msg == "Attributes have invalid values." |
| 159 |
|
| 160 |
- name: Perform idrac_attributes update with invalid attributes |
| 161 |
ansible.builtin.import_role: |
| 162 |
name: dellemc.openmanage.idrac_attributes |
| 163 |
vars: |
| 164 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 165 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 166 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 167 |
https_port: 443 |
| 168 |
validate_certs: false |
| 169 |
idrac_attributes: |
| 170 |
invalidAttr: enabled |
| 171 |
manager_id: "{{ null | default(omit) }}" |
| 172 |
ignore_errors: true |
| 173 |
register: idrac_attributes_error_msg |
| 174 |
|
| 175 |
- name: Asserting after performing operation with invalid attributes |
| 176 |
ansible.builtin.assert: |
| 177 |
that: |
| 178 |
- idrac_attributes_out.msg == "Attributes have invalid values." |
| 179 |
|
| 180 |
- name: Perform idrac_attributes update with |
| 181 |
valid attributes and invalid values |
| 182 |
ansible.builtin.import_role: |
| 183 |
name: dellemc.openmanage.idrac_attributes |
| 184 |
vars: |
| 185 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 186 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 187 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 188 |
https_port: 443 |
| 189 |
validate_certs: false |
| 190 |
idrac_attributes: |
| 191 |
SSH.1.Timeout: false |
| 192 |
manager_id: "{{ null | default(omit) }}" |
| 193 |
ignore_errors: true |
| 194 |
register: idrac_attributes_error_msg |
| 195 |
|
| 196 |
- name: Asserting after performing operation with |
| 197 |
valid attributes and invalid values |
| 198 |
ansible.builtin.assert: |
| 199 |
that: |
| 200 |
- idrac_attributes_out.msg == "Attributes have invalid values." |
| 201 |
|
| 202 |
- name: Perform system_attributes update with invalid attributes |
| 203 |
ansible.builtin.import_role: |
| 204 |
name: dellemc.openmanage.idrac_attributes |
| 205 |
vars: |
| 206 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 207 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 208 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 209 |
https_port: 443 |
| 210 |
validate_certs: false |
| 211 |
system_attributes: |
| 212 |
invalidAttr: enabled |
| 213 |
idrac_attributes: "{{ null | default(omit) }}" |
| 214 |
manager_id: "{{ null | default(omit) }}" |
| 215 |
ignore_errors: true |
| 216 |
register: idrac_attributes_error_msg |
| 217 |
|
| 218 |
- name: Asserting after performing operation for system_attributes |
| 219 |
with invalid attributes |
| 220 |
ansible.builtin.assert: |
| 221 |
that: |
| 222 |
- idrac_attributes_out.msg == "Attributes have invalid values." |
| 223 |
|
| 224 |
- name: Perform system_attributes update with |
| 225 |
valid attributes and invalid values |
| 226 |
ansible.builtin.import_role: |
| 227 |
name: dellemc.openmanage.idrac_attributes |
| 228 |
vars: |
| 229 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 230 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 231 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 232 |
https_port: 443 |
| 233 |
validate_certs: false |
| 234 |
system_attributes: |
| 235 |
Job.1.JobTimeout: stringValue |
| 236 |
manager_id: "{{ null | default(omit) }}" |
| 237 |
idrac_attributes: "{{ null | default(omit) }}" |
| 238 |
ignore_errors: true |
| 239 |
register: idrac_attributes_error_msg |
| 240 |
|
| 241 |
- name: Asserting after performing operation for system_attributes |
| 242 |
with valid attributes and invalid values |
| 243 |
ansible.builtin.assert: |
| 244 |
that: |
| 245 |
- idrac_attributes_out.msg == "Attributes have invalid values." |
| 246 |
|
| 247 |
- name: Perform lifecycle_controller_attributes update |
| 248 |
with invalid attributes |
| 249 |
ansible.builtin.import_role: |
| 250 |
name: dellemc.openmanage.idrac_attributes |
| 251 |
vars: |
| 252 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 253 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 254 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 255 |
https_port: 443 |
| 256 |
validate_certs: false |
| 257 |
lifecycle_controller_attributes: |
| 258 |
invalidAttr: false |
| 259 |
idrac_attributes: "{{ null | default(omit) }}" |
| 260 |
system_attributes: "{{ null | default(omit) }}" |
| 261 |
manager_id: "{{ null | default(omit) }}" |
| 262 |
ignore_errors: true |
| 263 |
register: idrac_attributes_error_msg |
| 264 |
|
| 265 |
- name: Asserting after performing operation for |
| 266 |
lifecycle_controller_attributes with invalid attributes |
| 267 |
ansible.builtin.assert: |
| 268 |
that: |
| 269 |
- idrac_attributes_out.msg == "Attributes have invalid values." |
| 270 |
|
| 271 |
- name: Perform lifecycle_controller_attributes update with |
| 272 |
valid attributes and invalid values |
| 273 |
ansible.builtin.import_role: |
| 274 |
name: dellemc.openmanage.idrac_attributes |
| 275 |
vars: |
| 276 |
hostname: "{{ lookup('env', 'IDRAC_IP') }}" |
| 277 |
username: "{{ lookup('env', 'IDRAC_USER') }}" |
| 278 |
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" |
| 279 |
https_port: 443 |
| 280 |
validate_certs: false |
| 281 |
lifecycle_controller_attributes: |
| 282 |
LCAttributes.1.AutoUpdate: 12345 |
| 283 |
manager_id: "{{ null | default(omit) }}" |
| 284 |
idrac_attributes: "{{ null | default(omit) }}" |
| 285 |
system_attributes: "{{ null | default(omit) }}" |
| 286 |
ignore_errors: true |
| 287 |
register: idrac_attributes_error_msg |
| 288 |
|
| 289 |
- name: Asserting after performing operation for |
| 290 |
lifecycle_controller_attributes with |
| 291 |
valid attributes and invalid values |
| 292 |
ansible.builtin.assert: |
| 293 |
that: |
| 294 |
- idrac_attributes_out.msg == "Attributes have invalid values." |