Esteban Freire
2015-07-06 13:42:16 UTC
Hi all,
I have the two following actions:
- name: Getting the IDs for the VMs running under the user
sudo: True
sudo_user: oneadmin
shell: onevm list | grep {{ item.value.login_name }} | awk 'BEGIN {FS="
"}{print $1}'
with_dict: disable_users_account
register: VMIDs_per_user
ignore_errors: yes
tags:
- delete_VMs
- name: Delete the VMs running under the user
sudo: True
sudo_user: oneadmin
command: onevm delete {{ item.stdout }}
with_items: VMIDs_per_user.results
tags:
- delete_VMs
This is an output example from the the first action:
674
675
The problem is that the second action is not working due to the command
expects to received just one argument per time, I mean, I need to execute:
onevm delete 674
onevm delete 675
And right now it is not working because it is executing: onevm delete 674
675 , which it does not work because the command does not admit to pass
more than one argument.
Therefore, my question is, do you know how to get item by item from the
item.stdout so you can execute a command for each item on the item.stdout.
Thanks in advance,
Esteban
I have the two following actions:
- name: Getting the IDs for the VMs running under the user
sudo: True
sudo_user: oneadmin
shell: onevm list | grep {{ item.value.login_name }} | awk 'BEGIN {FS="
"}{print $1}'
with_dict: disable_users_account
register: VMIDs_per_user
ignore_errors: yes
tags:
- delete_VMs
- name: Delete the VMs running under the user
sudo: True
sudo_user: oneadmin
command: onevm delete {{ item.stdout }}
with_items: VMIDs_per_user.results
tags:
- delete_VMs
This is an output example from the the first action:
674
675
The problem is that the second action is not working due to the command
expects to received just one argument per time, I mean, I need to execute:
onevm delete 674
onevm delete 675
And right now it is not working because it is executing: onevm delete 674
675 , which it does not work because the command does not admit to pass
more than one argument.
Therefore, my question is, do you know how to get item by item from the
item.stdout so you can execute a command for each item on the item.stdout.
Thanks in advance,
Esteban
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5cacd39c-52a9-49ed-8be5-9185887947fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5cacd39c-52a9-49ed-8be5-9185887947fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.