Trying to get the ansible expect module going for a list style response rather than a text response. I've read the ansible documentation for this module and its not so clear how to achieve this, I've also looked around google for examples similar to what I'm trying to achieve without any success.
Perhaps I'm trying to use the wrong module for the wrong thing?
I'm basically trying to run 'npx @vue/cli create frontend' using ansible, but be able to select 'merge' and 'Default ([Vue 2] babel, eslint)' when they show up as options.
Any suggestions on getting this going would be much appreciated. Here is an example of the list style response expected in the terminal. example of list response
And here is a code snippet of what I've got so far:
- name: create node package in front-end directory
expect:
command:
cmd: 'npx @vue/cli create frontend'
args:
chdir: '{{ app_root }}'
virtualenv: '{{ virtualenv_dir }}'
responses:
already exists. Pick an action: Merge
Please pick a preset: Default ([Vue 2] babel, eslint)
become_user: '{{ username }}'
Thanks to the user mdaniel for providing a workaround to my issue. Working code snippet is as follows:
- name: Vue | create node package in frontend directory
become_user: '{{ username }}'
command: 'npx @vue/cli create {{ frontend_name }} --merge --default'
args:
chdir: '{{ app_root }}'