troykinsella.archive
troykinsella.archive
这是一个用于获取和解压档案文件以及验证其校验和的 Ansible 角色。
角色变量
- archive_file_name: 档案文件名。
- archive_file_mode: 可选。获取的档案文件的权限模式。默认值:644。
- archive_url: 该档案文件可下载的完整 URL。
- archive_fetch_headers: 可选。在 HTTP 获取档案时传递的头信息。默认值:""。格式: "key:value,key:value"。
- archive_checksum: 获取的档案文件的预期校验和。
- archive_checksum_algorithm: 可选。校验和算法:如 md5、sha1、sha256 - 具体取决于可用的校验工具。默认值:sha256。
- archive_cache_path: 可选。档案文件下载的目录路径。默认值:/usr/local/pkg。
- archive_destination_path: 可选。解压档案内容的目录路径。默认值:/usr/local。
- archive_extracted_file_name: 从档案中解压得到的根文件或目录的预期名称。
- archive_destination_file_name: 可选。将解压的文件重命名为该值。
- archive_destination_link_name: 可选。创建一个符号链接,名称为
archive_extracted_file_name
(或archive_destination_file_name
,如果指定的话)。
示例剧本
- hosts: servers
roles:
- role: troykinsella.archive
archive_file_name: go1.5.3.linux-amd64.tar.gz
archive_file_mode: 0700
archive_url: https://storage.googleapis.com/golang/{{ archive_file_name }}
archive_checksum: 43afe0c5017e502630b1aea4d44b8a7f059bf60d7f29dfd58db454d4e4e0ae53
archive_checksum_algorithm: sha256
archive_cache_path: /usr/local/pkg
archive_destination_path: /usr/local/
archive_extracted_file_name: go
archive_destination_file_name: go1.5.3 # 移动解压的文件/目录
archive_destination_link_name: go # 创建指向当前版本的链接
平台
(未测试)
- EL
- Fedora
- opensuse
- Amazon
- Ubuntu
- Debian
许可证
MIT