Francesco Marchioni
Francesco Marchioni

Reputation: 4328

Ansible: extract archive to user's dir

I'm trying to build an ansible playbook which extracts an archive (available through http) under a folder to be created in the user's home directory. So far I've come up with:

- name: Extract archive
  unarchive:
          creates: wildfly
          src: "http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip"
          dest: "{{ ansible_user_dir }}"/wildfly
          remote_src: yes

However by running it, I get a syntax error: here is the offending line:

dest: "{{ ansible_user_dir }}"/wildfly
                              ^ here

I've tried also without quotes, but the issue stays the same. By hardcoding the user's home dir it works- except that no folder "wildfly" is created. Any help ?

Upvotes: 0

Views: 1823

Answers (1)

techraf
techraf

Reputation: 68529

Quote the whole expression:

dest: "{{ ansible_user_dir }}/wildfly"

Upvotes: 2

Related Questions