Debian Codegraph @

ansible_collections/cisco/aci/tests/integration/targets/aci_cloud_provider/tasks/main.yml

raw symbols SCIP
1 # Test code for the ACI modules
2 # Copyright: (c) 2020, Lionel Hercot (@lhercot) <[email protected]>
3
4 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 - name: Test that we have an ACI APIC host, ACI username and ACI password
7 ansible.builtin.fail:
8 msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
9 when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
10
11 # CLEAN ENVIRONMENT
12 - name: Set vars
13 ansible.builtin.set_fact:
14 aci_info: &aci_info
15 host: "{{ aci_hostname }}"
16 username: "{{ aci_username }}"
17 password: "{{ aci_password }}"
18 validate_certs: '{{ aci_validate_certs | default(false) }}'
19 use_ssl: '{{ aci_use_ssl | default(true) }}'
20 use_proxy: '{{ aci_use_proxy | default(true) }}'
21 output_level: '{{ aci_output_level | default("info") }}'
22
23 - name: Query system information
24 cisco.aci.aci_system:
25 <<: *aci_info
26 id: 1
27 state: query
28 register: version
29
30 # QUERY OBJECTS
31 - name: Query cloud provider object
32 cisco.aci.aci_cloud_provider:
33 <<: *aci_info
34 state: query
35 register: query_cloud
36 when: version.current.0.topSystem.attributes.version is version('4.1', '>=')
37
38 - name: Set vars
39 ansible.builtin.set_fact:
40 query_cloud:
41 current: []
42 when: version.current.0.topSystem.attributes.version is version('4.1', '<')
43
44 - name: Verify query_cloud for all sites
45 ansible.builtin.assert:
46 that:
47 - query_cloud is not changed
48
49 - name: Verify query_cloud for Cloud Sites
50 ansible.builtin.assert:
51 that:
52 - query_cloud is not changed
53 - query_cloud.current.0.cloudProvP.attributes.environment == "public-cloud"
54 - '"vendor" in query_cloud.current.0.cloudProvP.attributes'
55 when:
56 - query_cloud.current | length > 0 # This condition will execute only cloud sites