I have a simple Ansible role which creates a Foreman activation key, however it only "subscriptions" with the last value and not both?
# cat roles/hammer/tasks/subscription.yml --- - name: Add Subscription key ID to Activation Key katello_activation_key: username: "{{ hammer.username|default('NotSet') }}" password: "{{ hammer.password|default('NotSet') }}" server_url: "https://{{ system_host_name }}" name: "{{ item.0.name }}" organization: "{{ hammer.organisation.name }}" lifecycle_environment: "{{ item.0.lifecycle }}" content_view: '{{ item.0.cview }}' subscriptions: - name: "{{ item.1 }}" # - name: "{{ item.1.name2 }}" auto_attach: False release_version: Initial tags: hammer ... My vars file contains:
act_key: - name: CentOS 7 content Development Key desc: CentOS 7 content Development Key release: Initial cview: CentOS 7 content lifecycle: Development # subscription: ['CentOS-7','CentOS-7-EPEL'] subscription: - CentOS-7 - CentOS-7-EPEL - name: CentOS 7 content Production Key desc: CentOS 7 content Production Key cview: CentOS 7 content release: Initial lifecycle: Production # subscription: ['CentOS-7','CentOS-7-EPEL'] subscription: - CentOS-7 - CentOS-7-EPEL - name: CentOS 8 content Development Key desc: CentOS 8 content Development Key cview: CentOS 8 content release: Initial lifecycle: Development # subscription: ['CentOS-8','CentOS-8-EPEL'] subscription: - CentOS-8 - CentOS-8-EPEL - name: CentOS 8 content Production Key desc: CentOS 8 content Production Key cview: CentOS 8 content release: Initial lifecycle: Production # subscription: ['CentOS-8','CentOS-8-EPEL'] subscription: - CentOS-8 - CentOS-8-EPEL I am trying to to add " subscription: ['CentOS-7','CentOS-7-EPEL']" in a single pass as if I use the "with_subelements" loop only the last item "CentOS-7-EPEL" or "CentOS-8-EPEL" is added (and not both).
Can anyone suggest a way to change my variables file or play to make the katello_activation_key add both variables in a single pass?