Ansible: extract archive to user's dir

2019-03-05 23:20发布

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 ?

1条回答
\"骚年 ilove
2楼-- · 2019-03-05 23:41

Quote the whole expression:

dest: "{{ ansible_user_dir }}/wildfly"
查看更多
登录 后发表回答