On 9/16/19 3:23 PM, Keith Mills wrote:
> Hello All,
> 
> I have an Ansible task and I want to register multiple variables inside it, 
> how do I achieve this? It doesn't seem that
> a list or a comma separated string would work.
> 
> This is what I have:
> 
> |
> -name:SetSELinuxto permissive mode |RHEL
>   selinux:
>     policy:targeted
>     state:permissive
>   register:set_selinux,task_result
>   when:ansible_distribution|lower =='redhat'
> |
> 
> I want to do something like this:
> 
> |
> -name:mytask
>   module_name:
>     <some more params>
>   register:[var1,var2]
> |
> 
> If I add |register: var1 \n register: var2| then I get the following Error:
> 
> |
> Thefield 'register'issupposed to be a stringtype,however the incoming data 
> structure isa
> <class'ansible.parsing.yaml.objects.AnsibleSequence'>
> 
> |
> 
> 
> How do I resolve this issue?

It is really unclear to me why you want to do this, so please explain.
You will receive better answers when you explain your objectives.

At any rate, you can easily copy the registered variable in a separate set_fact 
task.

Regards
       Racke


> 
> -- 
> 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+unsubscr...@googlegroups.com 
> <mailto:ansible-project+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ee5ace8c-dbda-4238-8474-9f6b1c6992ca%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ee5ace8c-dbda-4238-8474-9f6b1c6992ca%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0fb2c0f0-4187-2fe9-8aa2-fe57b8f55e97%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to