hm, if it wasn't too good to be true I'd simply say variable {{ webroot }} 
exists, variable {{ root }} doesn't


>     On 10/14/2021 2:13 PM Stefan Malte <s.schumacher.consulting...@gmail.com> 
> wrote:
> 
> 
>     Hi,
> 
>     I have a rather trivial problem, nonetheless I am unable to solve it on 
> my own.
>     In the host_var vm116.***.** (Domain Names replaces by *) the variable 
>     "root: /var/www/test" is set.
>     This creates the right webroot in the vhost_configuration. Now I also 
> want to create the directory itself
> 
>     - name: Create webroot
>       ansible.builtin.file:
>         path: "{{ root }}"
>         state: directory
>         mode: '0755'
>         owner: www-data
>         group: www-data
> 
>     Error message:
>     fatal: [vm116.info]: FAILED! => {"msg": "The task includes an option with 
> an undefined variable. The error was: 'root' is undefined\n\nThe error 
> appears to be in 
> '/home/stefan/Git/ansible/roles/ansible-role-nginx/tasks/custom_tasks.yml': 
> line 62, column 3, but may\nbe elsewhere in the file depending on the exact 
> syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Create 
> webroot\n  ^ here\n"}
> 
>     I dont understand how this can be after all the variable has just been 
> used to create the webroot in the vhosts - I double-checked on this.
> 
>     Interestingly if I replace the variable root with the variable "webroot" 
> or any other name:
> 
>     vm116.info hostvar webroot: temp
> 
>     - name: Create webroot
>       ansible.builtin.file:
>         path: "/var/www{{ webroot }}"
>         state: directory
>         mode: '0755'
>         owner: www-data
>         group: www-data
> 
>     everything works like a charm. How can I fix this?  Why cant I reuse the 
> variable?
> 
>     Yours 
>     Stefan Malte
> 
> 
> 
>     --
>     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/18a4a76b-a8ab-4cf4-9635-84e79ac4087an%40googlegroups.com
>  
> https://groups.google.com/d/msgid/ansible-project/18a4a76b-a8ab-4cf4-9635-84e79ac4087an%40googlegroups.com?utm_medium=email&utm_source=footer
>  .
> 

-- 
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/1480200180.99712.1634214008345%40office.mailbox.org.

Reply via email to