Thanks! Now works fine. среда, 30 апреля 2014 г., 19:10:55 UTC+6 пользователь Matt Martz написал: > > What you want is actually: > > service_user: > name: "service" > pass: "blablabla" > flags: "ADMIN" > > The '-' at the beginning of the line is defining a list/array element, as > opposed to a dict/hash > > In your current configuration, you would need to use 'service_user[0].name' > > -- > Matt Martz > [email protected] <javascript:> > > On April 30, 2014 at 7:05:50 AM, Alexey Lesovsky > ([email protected]<javascript:>) > wrote: > > Hi all! > > Have some trouble in the access to the part of variable. > I have following configuration: > > service_user: > - { name: "service", pass: "blablabla", flags: "ADMIN" } > > and later: > - name: "Stage 3: start service" > command: "start-service.sh -u {{ service_user.name }}" > > when playbook playing, at this place I got error "One or more undefined > variables: 'list object' has no attribute 'name'" > > Also service_user variable is used in the jinja template and work properly. > How to do it right, and don't break variable usage in template? > -- > 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 [email protected] <javascript:>. > To post to this group, send email to [email protected]<javascript:> > . > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/2a0cd411-63f5-4407-9ccf-e069da68d856%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/2a0cd411-63f5-4407-9ccf-e069da68d856%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/aabb8626-b704-4163-92c5-b8db2c0c8da4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
