| 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/location.yml |
| 10 | vars: |
| 11 | location_state: "present" |
| 12 | - include_tasks: tasks/organization.yml |
| 13 | vars: |
| 14 | organization_state: "present" |
| 15 | - include_tasks: tasks/role.yml |
| 16 | vars: |
| 17 | role_name: "{{ item }}" |
| 18 | role_state: absent |
| 19 | with_items: |
| 20 | - test |
| 21 | - role_with_filters |
| 22 | |
| 23 | - hosts: tests |
| 24 | collections: |
| 25 | - theforeman.foreman |
| 26 | gather_facts: false |
| 27 | vars_files: |
| 28 | - vars/server.yml |
| 29 | tasks: |
| 30 | - include_tasks: tasks/role.yml |
| 31 | vars: |
| 32 | role_name: "role_with_filters" |
| 33 | role_state: present |
| 34 | expected_change: true |
| 35 | role_filters: |
| 36 | - permissions: |
| 37 | - view_hosts |
| 38 | search: "owner_type = Usergroup and owner_id = 4" |
| 39 | |
| 40 | - include_tasks: tasks/role.yml |
| 41 | vars: |
| 42 | role_state: present |
| 43 | expected_change: true |
| 44 | |
| 45 | - include_tasks: tasks/role.yml |
| 46 | vars: |
| 47 | role_state: present |
| 48 | expected_change: false |
| 49 | |
| 50 | - include_tasks: tasks/role.yml |
| 51 | vars: |
| 52 | role_state: present |
| 53 | expected_change: true |
| 54 | role_filters: |
| 55 | - permissions: |
| 56 | - view_hosts |
| 57 | search: "owner_type = Usergroup and owner_id = 4" |
| 58 | |
| 59 | - include_tasks: tasks/role.yml |
| 60 | vars: |
| 61 | role_state: present |
| 62 | expected_change: false |
| 63 | role_filters: |
| 64 | - permissions: |
| 65 | - view_hosts |
| 66 | search: "owner_type = Usergroup and owner_id = 4" |
| 67 | |
| 68 | - include_tasks: tasks/role.yml |
| 69 | vars: |
| 70 | role_state: present |
| 71 | expected_change: true |
| 72 | role_filters: |
| 73 | - permissions: |
| 74 | - view_hosts |
| 75 | - edit_hosts |
| 76 | search: "owner_type = Usergroup and owner_id = 4" |
| 77 | |
| 78 | - include_tasks: tasks/role.yml |
| 79 | vars: |
| 80 | role_state: present |
| 81 | expected_change: false |
| 82 | role_filters: |
| 83 | - permissions: |
| 84 | - view_hosts |
| 85 | - edit_hosts |
| 86 | search: "owner_type = Usergroup and owner_id = 4" |
| 87 | |
| 88 | - include_tasks: tasks/role.yml |
| 89 | vars: |
| 90 | role_state: present |
| 91 | expected_change: true |
| 92 | role_filters: |
| 93 | - permissions: |
| 94 | - view_hosts |
| 95 | - edit_hosts |
| 96 | |
| 97 | - include_tasks: tasks/role.yml |
| 98 | vars: |
| 99 | role_state: present |
| 100 | expected_change: false |
| 101 | role_filters: |
| 102 | - permissions: |
| 103 | - view_hosts |
| 104 | - edit_hosts |
| 105 | |
| 106 | - include_tasks: tasks/role.yml |
| 107 | vars: |
| 108 | role_state: present |
| 109 | role_description: new description |
| 110 | expected_change: true |
| 111 | |
| 112 | - include_tasks: tasks/role.yml |
| 113 | vars: |
| 114 | role_state: absent |
| 115 | expected_change: true |
| 116 | |
| 117 | - include_tasks: tasks/role.yml |
| 118 | vars: |
| 119 | role_state: absent |
| 120 | expected_change: false |
| 121 | |
| 122 | - hosts: localhost |
| 123 | collections: |
| 124 | - theforeman.foreman |
| 125 | gather_facts: false |
| 126 | vars_files: |
| 127 | - vars/server.yml |
| 128 | tasks: |
| 129 | - include_tasks: tasks/location.yml |
| 130 | vars: |
| 131 | location_state: "absent" |
| 132 | - include_tasks: tasks/organization.yml |
| 133 | vars: |
| 134 | organization_state: "absent" |
| 135 | ... |