| 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/content_credential.yml |
| 13 | vars: |
| 14 | content_credential_state: present |
| 15 | content_credential_type: "gpg_key" |
| 16 | content_credential_content: "{{ lookup('file', 'data/gpg_key.asc') }}" |
| 17 | - include_tasks: tasks/content_credential.yml |
| 18 | vars: |
| 19 | content_credential_name: "Test SSL Cert" |
| 20 | content_credential_type: "cert" |
| 21 | content_credential_state: present |
| 22 | content_credential_content: "{{ lookup('file', 'data/gpg_key.asc') }}" |
| 23 | - include_tasks: tasks/sync_plan.yml |
| 24 | vars: |
| 25 | sync_plan_state: present |
| 26 | - include_tasks: tasks/product.yml |
| 27 | vars: |
| 28 | product_state: absent |
| 29 | - hosts: tests |
| 30 | collections: |
| 31 | - theforeman.foreman |
| 32 | gather_facts: false |
| 33 | vars_files: |
| 34 | - vars/server.yml |
| 35 | tasks: |
| 36 | - name: 'Test product' |
| 37 | block: |
| 38 | - include_tasks: tasks/product.yml |
| 39 | vars: |
| 40 | product_state: present |
| 41 | expected_change: true |
| 42 | - include_tasks: tasks/product.yml |
| 43 | vars: |
| 44 | product_state: present |
| 45 | expected_change: false |
| 46 | - include_tasks: tasks/product.yml |
| 47 | vars: |
| 48 | product_description: 'A product with an updated description' |
| 49 | product_state: present |
| 50 | expected_change: true |
| 51 | - include_tasks: tasks/product.yml |
| 52 | vars: |
| 53 | product_state: absent |
| 54 | expected_change: true |
| 55 | - include_tasks: tasks/product.yml |
| 56 | vars: |
| 57 | product_state: absent |
| 58 | expected_change: false |
| 59 | |
| 60 | - name: 'Test product with content GPG key' |
| 61 | block: |
| 62 | - include_tasks: tasks/product.yml |
| 63 | vars: |
| 64 | product_name: "Test Product 2" |
| 65 | product_gpg_key: "Test GPG key" |
| 66 | product_state: present |
| 67 | product_ssl_ca_cert: "Test SSL Cert" |
| 68 | product_ssl_client_cert: "Test SSL Cert" |
| 69 | product_ssl_client_key: "Test SSL Cert" |
| 70 | expected_change: true |
| 71 | - include_tasks: tasks/product.yml |
| 72 | vars: |
| 73 | product_name: "Test Product 2" |
| 74 | product_gpg_key: "Test GPG key" |
| 75 | product_ssl_ca_cert: "Test SSL Cert" |
| 76 | product_ssl_client_cert: "Test SSL Cert" |
| 77 | product_ssl_client_key: "Test SSL Cert" |
| 78 | product_state: present |
| 79 | expected_change: false |
| 80 | - include_tasks: tasks/product.yml |
| 81 | vars: |
| 82 | product_name: "Test Product 2" |
| 83 | product_state: absent |
| 84 | expected_change: true |
| 85 | - include_tasks: tasks/product.yml |
| 86 | vars: |
| 87 | product_name: "Test Product 2" |
| 88 | product_state: absent |
| 89 | expected_change: false |
| 90 | |
| 91 | - name: 'Test product with sync plan' |
| 92 | block: |
| 93 | - include_tasks: tasks/product.yml |
| 94 | vars: |
| 95 | product_name: "Test Product 3" |
| 96 | product_sync_plan: "Test Sync Plan" |
| 97 | product_state: present |
| 98 | expected_change: true |
| 99 | - include_tasks: tasks/product.yml |
| 100 | vars: |
| 101 | product_name: "Test Product 3" |
| 102 | product_sync_plan: "Test Sync Plan" |
| 103 | product_state: present |
| 104 | expected_change: false |
| 105 | - include_tasks: tasks/product.yml |
| 106 | vars: |
| 107 | product_name: "Test Product 3" |
| 108 | product_state: absent |
| 109 | expected_change: true |
| 110 | - include_tasks: tasks/product.yml |
| 111 | vars: |
| 112 | product_name: "Test Product 3" |
| 113 | product_state: absent |
| 114 | expected_change: false |
| 115 | - hosts: localhost |
| 116 | collections: |
| 117 | - theforeman.foreman |
| 118 | gather_facts: false |
| 119 | vars_files: |
| 120 | - vars/server.yml |
| 121 | tasks: |
| 122 | - include_tasks: tasks/sync_plan.yml |
| 123 | vars: |
| 124 | sync_plan_state: absent |
| 125 | - include_tasks: tasks/content_credential.yml |
| 126 | vars: |
| 127 | content_credential_name: "Test SSL Cert" |
| 128 | content_credential_state: absent |
| 129 | - include_tasks: tasks/content_credential.yml |
| 130 | vars: |
| 131 | content_credential_state: absent |
| 132 | - include_tasks: tasks/organization.yml |
| 133 | vars: |
| 134 | organization_state: absent |
| 135 | ... |