- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在编写一个 ansible playbook 来自动安装一个软件。当我从网站下载压缩包时,我有:
software-package-release.tar.gz
software-package-v2.15/
nrpe-lkdsflkdjf
文件放在那里,其中包含一个目录
nrpe-2.15
)
- name: Extract
unarchive
src:/tmp/nrpe-lkdsflkdjf
dest: /tmp/
copy: no
register: tar_reg
- name: debug tar_reg
debug: var=tar_reg
ok: [IP-here] => {
"tar_reg": {
"changed": true,
"check_results": {
"cmd": "/bin/gtar -C \"/tmp/\" --diff -f \"/tmp/nrpe-lkdsjflkdsjf\"",
"err": "/bin/gtar: nrpe-2.15: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/SECURITY: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/README.Solaris: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/init-script.debian.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/nrpe.spec.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/LEGAL: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/subst.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/sample-config: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/sample-config/nrpe.xinetd.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/sample-config/nrpe.cfg.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/pkg: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/pkg/preinstall: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/pkg/nrpe.xml: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/pkg/i.config: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/pkg/postinstall: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/pkg/r.config: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/pkg/nrpe: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/package/solaris/Makefile.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/nrpe.spec: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/README: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/src: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/src/acl.c: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/src/check_nrpe.c: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/src/snprintf.c: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/src/Makefile.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/src/utils.c: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/src/nrpe.c: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/config.guess: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/install-sh: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/contrib: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/contrib/nrpe_check_control.c: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/contrib/README.nrpe_check_control: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/init-script.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/docs: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/docs/NRPE.pdf: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/docs/NRPE.odt: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/init-script.suse.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/configure: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/config.sub: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/Changelog: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/Makefile.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/README.SSL: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/configure.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/update-version: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/include: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/include/dh.h: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/include/common.h: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/include/utils.h: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/include/acl.h: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/include/config.h.in: Warning: Cannot stat: No such file or directory\n/bin/gtar: nrpe-2.15/include/nrpe.h: Warning: Cannot stat: No such file or directory\n",
"out": "",
"rc": 1,
"unarchived": false
},
"dest": "/tmp/",
"extract_results": {
"cmd": "/bin/gtar -xf \"/tmp/nrpe-lkdsjflkdsjf\"",
"err": "",
"out": "",
"rc": 0
},
"gid": 0,
"group": "root",
"handler": "TarArchive",
"mode": "01777",
"owner": "root",
"size": 3072,
"src": "/tmp/nrpe-lkdsjflkdsjf",
"state": "directory",
"uid": 0
}
}
最佳答案
unarchive module确实有列出文件的选项 - list_files
.可以注册输出,通常数组中的第一个值是目录名。
以下对我有用:
- name: Extract files
unarchive:
src: /tmp/my_archive.tar.gz
dest: /mydir
remote_src: yes
list_files: yes
register: archive_contents
archive_contents.files[0]
将有您的顶级目录。
关于ansible - 如何判断 ansible unarchive 模块创建了哪个目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37576449/
我在使用 NSKeyedArchiver 时遇到了一个问题,这让我困惑了很长一段时间,而且似乎无法查明错误。 我有一个可变数组,由“设备”类的对象组成。在我的 appDelegate 中,我保留了一个
我正在尝试在远程计算机中下载并解压缩一个 tar 存档,如果不存在,则必须创建远程目标。但它没有发生。 ERROR: destination directory doesn't exist 我的代码:
我正在编写一个 ansible playbook 来自动安装一个软件。当我从网站下载压缩包时,我有: software-package-release.tar.gz 解压后,我只剩下目录 softwa
我使用 Ansible 在 EC2 上运行 AmazonLinux2。但是,当执行 Unarchive 命令时,会显示以下错误。 "Failed to find handler for \"/tmp/
我使用 Ansible 在 EC2 上运行 AmazonLinux2。但是,当执行 Unarchive 命令时,会显示以下错误。 "Failed to find handler for \"/tmp/
我正在尝试在 macOS 应用程序中将自定义类保存并检索到 UserDefaults。我的 newData 得到 nil class countClass: NSObject, NSCoding {
我有两个 ansible 任务,它们下载存档(例如最新的 wordpress 版本)并提取该存档。 - name: Download WordPress tags: - wordpress
我想从 tar 文件中提取一个目录。 在用于安装目录解包的 Linux 操作系统中 - 我只是这样做: tar -xvf ingres.tar install 对于ansible,我试过: unarc
我正在尝试执行一个 ansible 剧本,该剧本的任务是使用 unarchive 模块。因为我在 OSX 上执行此操作,所以我需要它使用 gnu-tar,而不是通常随 OSX 一起提供的 bsd ta
我一直在按照“构建你的第二个 iOS 应用程序”教程一步一步进行操作,在教程 promise 所有错误都会消失之后我遇到了这个错误,但错误直到其他错误都已更正,我尝试编译它。 错误: The docu
我写了一个 playbook 下载 tar 文件并将其解压缩到 Mac 中的某个目录。但是当我运行 playbook 时它失败并出现以下错误 "msg": "Failed to find handle
我的代码在 iOS 7 上运行: NSData *imageData = [NSKeyedArchiver archivedDataWithRootObject:self.imageView.imag
我是一名优秀的程序员,十分优秀!