suzuki-shunsuke.ghq-module
ansible-ghq-module
使用 motemen/ghq 管理远程仓库。 虽然它在 Ansible Galaxy 中分发, 但这不是一个 Ansible 角色,而是一个 Ansible 模块和动作插件。
https://galaxy.ansible.com/suzuki-shunsuke/ghq-module/
注意事项
- 此模块不支持检查模式。
要求
- Go
- motemen/ghq
安装
此模块在 Ansible Galaxy 中分发。
因此,您可以使用 ansible-galaxy
命令安装它。
$ ansible-galaxy install suzuki-shunsuke.ghq-module
# playbook.yml
- hosts: default
roles:
# 调用此模块后,可以使用它
- suzuki-shunsuke.ghq-module
选项
参数 | 必需 | 默认值 | 选择 | 说明 |
---|---|---|---|---|
name | 否 | 仓库路径 | ||
executable | 否 | ghq 命令的可执行文件路径 | ||
update | 否 | no | bool | 如果是,添加 -u 选项 |
ssh | 否 | no | bool | 如果是,添加 -p 选项 |
shallow | 否 | no | bool | 如果是,添加 -shallow 选项 |
src | 否 | "ghq import" 命令的源路径 | ||
subcommand | 否 | get | get | "ghq import" 命令的子命令 |
示例
# 克隆 suzuki-shunsuke/zsh.conf
ghq:
name: suzuki-shunsuke/zsh.conf
# 指定 ghq 命令的路径
ghq:
name: suzuki-shunsuke/zsh.conf
executable: "{{ansible_env.HOME}}/.go/bin/ghq"
# 更新
go:
name: suzuki-shunsuke/zsh.conf
update: yes
# 通过 ssh
ghq:
name: suzuki-shunsuke/zsh.conf
ssh: yes
# 浅克隆
ghq:
name: suzuki-shunsuke/zsh.conf
shallow: yes
# 从文件导入
# 空行和以 # 开头的行会被忽略
ghq:
src: repos.txt
# 通过子命令导入
ghq:
subcommand: starred motemen
# 子命令可以是字符串或字符串列表
ghq:
subcommand: ["starred", "motemen"]
许可证
MIT
开发者指南
要求
- Vagrant
- Ansible
设置测试
$ cd tests
$ ansible-galaxy install -r roles.yml
在 Vagrant 环境中测试
$ cd tests
$ vagrant up --provision-with=ansible
$ vagrant up --provision-with=ansible_local
在本地测试
$ ansible-playbook test.yml