| 1 | --- |
| 2 | - hosts: localhost |
| 3 | collections: |
| 4 | - theforeman.foreman |
| 5 | gather_facts: false |
| 6 | vars_files: |
| 7 | - vars/server.yml |
| 8 | tasks: |
| 9 | - include_tasks: tasks/organization.yml |
| 10 | vars: |
| 11 | organization_state: present |
| 12 | - include_tasks: tasks/location.yml |
| 13 | vars: |
| 14 | location_state: present |
| 15 | - hosts: tests |
| 16 | collections: |
| 17 | - theforeman.foreman |
| 18 | gather_facts: false |
| 19 | vars_files: |
| 20 | - vars/server.yml |
| 21 | - vars/compute_profile.yml |
| 22 | tasks: |
| 23 | - name: 'Libvirt compute resource' |
| 24 | block: |
| 25 | - name: Create libvirt compute resource |
| 26 | include_tasks: tasks/compute_resource.yml |
| 27 | vars: |
| 28 | compute_resource_name: "libvirt-cr01" |
| 29 | compute_resource_description: 'Libvirt compute resource' |
| 30 | compute_resource_organizations: |
| 31 | - Test Organization |
| 32 | compute_resource_locations: |
| 33 | - Test Location |
| 34 | compute_resource_provider: 'libvirt' |
| 35 | compute_resource_provider_params: "{{ libvirt.compute_resource.params }}" |
| 36 | compute_resource_state: present |
| 37 | expected_change: true |
| 38 | - name: Update libvirt compute resource |
| 39 | include_tasks: tasks/compute_resource.yml |
| 40 | vars: |
| 41 | compute_resource_name: "libvirt-cr01" |
| 42 | compute_resource_description: 'Libvirt compute resource' |
| 43 | compute_resource_organizations: |
| 44 | - Test Organization |
| 45 | compute_resource_locations: |
| 46 | - Test Location |
| 47 | compute_resource_provider: 'libvirt' |
| 48 | compute_resource_provider_params: "{{ libvirt.compute_resource.params }}" |
| 49 | compute_resource_state: present |
| 50 | expected_change: false |
| 51 | - name: Update libvirt compute resource |
| 52 | include_tasks: tasks/compute_resource.yml |
| 53 | vars: |
| 54 | compute_resource_name: "libvirt-cr01" |
| 55 | compute_resource_updated_name: "libvirt-cr" |
| 56 | compute_resource_description: 'A compute_resource with an updated description' |
| 57 | compute_resource_organizations: |
| 58 | - Test Organization |
| 59 | compute_resource_locations: |
| 60 | - Test Location |
| 61 | compute_resource_provider: 'libvirt' |
| 62 | compute_resource_provider_params: "{{ libvirt.compute_resource.params }}" |
| 63 | compute_resource_state: present |
| 64 | expected_change: true |
| 65 | - name: Update libvirt compute resource |
| 66 | include_tasks: tasks/compute_resource.yml |
| 67 | vars: |
| 68 | compute_resource_name: "libvirt-cr" |
| 69 | compute_resource_description: 'A compute_resource with an updated description' |
| 70 | compute_resource_organizations: |
| 71 | - Test Organization |
| 72 | compute_resource_locations: |
| 73 | - Test Location |
| 74 | compute_resource_provider: 'libvirt' |
| 75 | compute_resource_provider_params: "{{ libvirt.compute_resource.params }}" |
| 76 | compute_resource_state: present |
| 77 | expected_change: false |
| 78 | - name: Update libvirt compute resource |
| 79 | include_tasks: tasks/compute_resource.yml |
| 80 | vars: |
| 81 | compute_resource_name: "libvirt-cr" |
| 82 | compute_resource_description: 'A compute_resource with an updated description and params' |
| 83 | compute_resource_organizations: |
| 84 | - Test Organization |
| 85 | compute_resource_locations: |
| 86 | - Test Location |
| 87 | compute_resource_provider: 'libvirt' |
| 88 | compute_resource_provider_params: "{{ libvirt.compute_resource.params | ansible.builtin.combine({'display_type': 'spice'}) }}" |
| 89 | compute_resource_state: present |
| 90 | expected_change: true |
| 91 | - name: Update libvirt compute resource |
| 92 | include_tasks: tasks/compute_resource.yml |
| 93 | vars: |
| 94 | compute_resource_name: "libvirt-cr" |
| 95 | compute_resource_description: 'A compute_resource with an updated description and params' |
| 96 | compute_resource_organizations: |
| 97 | - Test Organization |
| 98 | compute_resource_locations: |
| 99 | - Test Location |
| 100 | compute_resource_provider: 'libvirt' |
| 101 | compute_resource_provider_params: "{{ libvirt.compute_resource.params | ansible.builtin.combine({'display_type': 'spice'}) }}" |
| 102 | compute_resource_state: present |
| 103 | expected_change: false |
| 104 | - name: Delete libvirt compute resource |
| 105 | include_tasks: tasks/compute_resource.yml |
| 106 | vars: |
| 107 | compute_resource_name: "libvirt-cr" |
| 108 | compute_resource_state: absent |
| 109 | expected_change: true |
| 110 | - name: Delete libvirt compute resource |
| 111 | include_tasks: tasks/compute_resource.yml |
| 112 | vars: |
| 113 | compute_resource_name: "libvirt-cr" |
| 114 | compute_resource_state: absent |
| 115 | expected_change: false |
| 116 | - hosts: localhost |
| 117 | collections: |
| 118 | - theforeman.foreman |
| 119 | gather_facts: false |
| 120 | vars_files: |
| 121 | - vars/server.yml |
| 122 | tasks: |
| 123 | - include_tasks: tasks/organization.yml |
| 124 | vars: |
| 125 | organization_state: absent |
| 126 | - include_tasks: tasks/location.yml |
| 127 | vars: |
| 128 | location_state: absent |
| 129 | ... |