Ansible:将存档解压缩到用户的目录 [英] Ansible: extract archive to user's dir

查看:48
本文介绍了Ansible:将存档解压缩到用户的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个 ansible playbook,它在要在用户主目录中创建的文件夹下提取存档(可通过 http 获得).到目前为止,我想出了:

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

我也试过不加引号,但问题还是一样.通过对用户的主目录进行硬编码,它可以工作 - 除了没有创建文件夹wildfly".有什么帮助吗?

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 ?

推荐答案

引用整个表达式:

dest: "{{ ansible_user_dir }}/wildfly"

这篇关于Ansible:将存档解压缩到用户的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆