problems with variables: git module creating wrong directory, /root/\[/root/olio\]/

21 views
Skip to first unread message

Daniel Charbonneau

unread,
Apr 20, 2014, 1:13:10 PM4/20/14
to ansible...@googlegroups.com
The second task below fails with npm not being able to find a package.json within /root/ That is, it doesn't know that it should cd into /root/olio, and so of course it isn't going to find a package.json file.

The git module for some reason creates this directory structure:
/root/\[/root/olio\]/

...which seems to imply the variable isn't interpreted correctly.

I'm also using the root user to login right now because I haven't yet grasped creating users.


---
# roles/olio/vars/main.yml

olio_directory:
  - /root/olio


---
# roles/olio/tasks/main.yml

- name: clone olio
  git: repo=https://github.com/novodinia/olio.git dest={{ olio_directory }}

- name: use npm to install dependencies
  npm: path={{ olio_directory }}



Tomasz Kontusz

unread,
Apr 20, 2014, 3:00:22 PM4/20/14
to ansible...@googlegroups.com


Daniel Charbonneau <novo.char...@gmail.com> napisał:
>The second task below fails with npm not being able to find a
>package.json
>within /root/ That is, it doesn't know that it should cd into
>/root/olio,
>and so of course it isn't going to find a package.json file.
>
>The git module for some reason creates this directory structure:
>/root/\[/root/olio\]/
>
>...which seems to imply the variable isn't interpreted correctly.
>
>I'm also using the root user to login right now because I haven't yet
>grasped creating users.
>
>
>---
># roles/olio/vars/main.yml
>
>olio_directory:
> - /root/olio
This creates olio_directory as list with one element. You want just:
olio_directory: /root/olio

>---
># roles/olio/tasks/main.yml
>
>- name: clone olio
>git: repo=https://github.com/novodinia/olio.git dest={{ olio_directory
>}}
>
>- name: use npm to install dependencies
> npm: path={{ olio_directory }}

--
Wysłane za pomocą K-9 Mail.

Daniel Charbonneau

unread,
Apr 20, 2014, 4:27:08 PM4/20/14
to ansible...@googlegroups.com
Thank you Tomasz, that fixed it!
Reply all
Reply to author
Forward
0 new messages