Multiple variables in a survey in Ansible Tower

493 Views Asked by At

I am developing a playbook which adds host_group to groups in IdM.

I'm having trouble if an operator needs to add more than one user to the list I've created in Ansible Tower.

My development is as follows:

---
- name: Add hostgroup to group
  ipahostgroup:
    ipaadmin_password: 'password'
    name: "{{ host_group }}"
    hostgroup:
      - "{{ item }}"
    with_items: "{{ hostgroup_name.split(', ') }}"
    action: member

In the Ansible Tower survey, the operator must specify the host_groups by commas.

Any suggestion??

Thank you.

1

There are 1 best solutions below

0
raquel666 On

The solution:

---
- name: Add hostgroup to group
  ipahostgroup:
    ipaadmin_password: 'password'
    name: "{{ host_group }}"
    hostgroup:
      - "{{ item }}"
    action: member
  with_items: "{{ hostgroup_name.split(', ') }}"

Just wrong order... :-) Thank you!