| 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 | - include_tasks: tasks/scap_content.yml |
| 16 | vars: |
| 17 | scap_content_title: "{{ item }}" |
| 18 | scap_content_state: "absent" |
| 19 | loop: |
| 20 | - scap_content_title |
| 21 | - updated_scap_content_title |
| 22 | |
| 23 | - hosts: tests |
| 24 | collections: |
| 25 | - theforeman.foreman |
| 26 | gather_facts: false |
| 27 | vars_files: |
| 28 | - vars/server.yml |
| 29 | tasks: |
| 30 | - name: import scap content |
| 31 | include_tasks: tasks/scap_content.yml |
| 32 | vars: |
| 33 | scap_content_title: "scap_content_title" |
| 34 | scap_content_scap_file: "data/ssg-firefox-ds.xml" |
| 35 | scap_content_original_filename: "scap_file_name.xml" |
| 36 | scap_content_locations: |
| 37 | - Test Location |
| 38 | scap_content_organizations: |
| 39 | - Test Organization |
| 40 | scap_content_state: "present" |
| 41 | expected_change: true |
| 42 | - name: import scap content again, no change |
| 43 | include_tasks: tasks/scap_content.yml |
| 44 | vars: |
| 45 | scap_content_title: "scap_content_title" |
| 46 | scap_content_scap_file: "data/ssg-firefox-ds.xml" |
| 47 | scap_content_original_filename: "scap_file_name.xml" |
| 48 | scap_content_locations: |
| 49 | - Test Location |
| 50 | scap_content_organizations: |
| 51 | - Test Organization |
| 52 | scap_content_state: "present" |
| 53 | expected_change: false |
| 54 | - name: rename scap content |
| 55 | include_tasks: tasks/scap_content.yml |
| 56 | vars: |
| 57 | scap_content_title: "scap_content_title" |
| 58 | scap_content_updated_title: "updated_scap_content_title" |
| 59 | scap_content_original_filename: "updated_scap_file_name.xml" |
| 60 | scap_content_locations: |
| 61 | - Test Location |
| 62 | scap_content_organizations: |
| 63 | - Test Organization |
| 64 | scap_content_state: "present" |
| 65 | expected_change: true |
| 66 | - name: ensure the renamed scap content has all the data, no change |
| 67 | include_tasks: tasks/scap_content.yml |
| 68 | vars: |
| 69 | scap_content_title: "updated_scap_content_title" |
| 70 | scap_content_original_filename: "updated_scap_file_name.xml" |
| 71 | scap_content_locations: |
| 72 | - Test Location |
| 73 | scap_content_organizations: |
| 74 | - Test Organization |
| 75 | scap_content_state: "present" |
| 76 | expected_change: false |
| 77 | - name: delete scap content |
| 78 | include_tasks: tasks/scap_content.yml |
| 79 | vars: |
| 80 | scap_content_title: "updated_scap_content_title" |
| 81 | scap_content_state: "absent" |
| 82 | expected_change: true |
| 83 | - name: delete scap content again, no change |
| 84 | include_tasks: tasks/scap_content.yml |
| 85 | vars: |
| 86 | scap_content_title: "updated_scap_content_title" |
| 87 | scap_content_state: "absent" |
| 88 | expected_change: false |
| 89 | |
| 90 | - hosts: localhost |
| 91 | collections: |
| 92 | - theforeman.foreman |
| 93 | gather_facts: false |
| 94 | vars_files: |
| 95 | - vars/server.yml |
| 96 | tasks: |
| 97 | - include_tasks: tasks/scap_content.yml |
| 98 | vars: |
| 99 | scap_content_title: "{{ item }}" |
| 100 | scap_content_state: "absent" |
| 101 | loop: |
| 102 | - scap_content_title |
| 103 | - updated_scap_content_title |
| 104 | - include_tasks: tasks/location.yml |
| 105 | vars: |
| 106 | location_state: "absent" |
| 107 | - include_tasks: tasks/organization.yml |
| 108 | vars: |
| 109 | organization_state: "absent" |