# How to use Multiple choice

**URL:** <https://forum.ansible.com/t/how-to-use-multiple-choice/38466>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 26, 2023, 2:54pm UTC](https://forum.ansible.com/t/how-to-use-multiple-choice/38466 "2023-09-26T14:54:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthias\_Denkler](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Matthias\_Denkler](https://forum.ansible.com/u/Matthias_Denkler)\
**Post date:** [September 26, 2023, 2:54pm UTC](https://forum.ansible.com/t/how-to-use-multiple-choice/38466/1 "2023-09-26T14:54:40Z")

</div>

Hi there,  
i am pretty at the beginning of my use of ansible.  
But I have a woring script to use ansible to put fresh installed ubuntu machines into our AD to use groups to manage user access.  
Now this script has to grow for more groups to come.  
So I thought multiple choice is a cool thing.  
So I placed this in my playbook.

"

- name: “institute”  
prompt: “Wähle das Institut. \n1- Institute1\n2- Institute2\n”  
private: no  
"

and I use this in the role as follows  
"

- name: make admins sudo  
ansible.builtin.lineinfile:  
dest: /etc/sudoers  
line: ‘% Name\_of\_the\_AD-Group ALL=(ALL:ALL) ALL’  
state: present  
insertafter: ‘%sudo ALL=(ALL:ALL) ALL’  
when: ( institute == “1” )  
"  
The Error is as follows:  
fatal: [xxx.xxx.xxx.xxx]: FAILED! =\> {  
“changed”: false,  
“invocation”: {  
“module\_args”: {  
“\_raw\_params”: “realm permit --groups ‘Name\_of\_the\_AD-Group’”,  
“\_uses\_shell”: true,  
“argv”: null,  
“chdir”: null,  
“creates”: null,  
“executable”: null,  
“removes”: null,  
“stdin”: null,  
“stdin\_add\_newline”: true,  
“strip\_empty\_ends”: true,  
“warn”: false,  
“when”: “( institute == "1" )”  
}  
}  
}

MSG:

Unsupported parameters for (ansible.legacy.command) module: when. Supported parameters include: strip\_empty\_ends, warn, \_uses\_shell, stdin, removes, stdin\_add\_newline, chdir, argv, creates, executable, \_raw\_params.

Anybody a Tip for me?

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [September 26, 2023, 3:03pm UTC](https://forum.ansible.com/t/how-to-use-multiple-choice/38466/2 "2023-09-26T15:03:13Z")

</div>

Outdent your “when:” line. It (“when”) is a task parameter, not a “command” parameter.
