Remove the `register` on those tasks. `set_fact` doesn't need this. On Tue, Jun 25, 2019 at 11:58 AM sase kumar <sasekuma...@gmail.com> wrote:
> Hi Folks, > > I'm new to ansible and I have got some confusion in when the statement > > here is my playbook - > > hosts: localhost > gather_facts: false > vars: > nodetype: "DI" > tasks: > - name: concatenate > set_fact: > argu: "DI=1,DC=0,DP=0" > when: "{{ nodetype }}" == "DI" > register: argu > set_fact: > argu: "DI=0,DC=1,DP=0" > when: "{{ nodetype }}" == "DC" > register: argu > - debug: > msg: "{{ argu }}" > > This is just defining variable "argu" based on when condition ,I want to > just build variable based on the input nodetype . but this is not working > and always it prints the second argu(DI=0,DC=1,DP=0) value > > Is this the right way or simpler way to achieve this? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-devel+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-devel/64b662ea-2889-4918-a2bc-b19fcb6e3927%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-devel/64b662ea-2889-4918-a2bc-b19fcb6e3927%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/CAD8N0v-6c7wUTLOkuAx6P%3DADPNnBCmW72gosXsF3peLbYm3nxw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.