git - Ansible Playbook 充当 Git 中间人
问题描述
我的情况是我正在从我的笔记本电脑上运行一个剧本来构建一个新的服务器,我需要从远程源克隆一个 repo。问题是我的新服务器和 GitServer 无法相互通信。
所以我的问题是,如何将我的笔记本电脑用作临时位置,以便我可以将存储库克隆到新服务器?例如,我可以从 GitHub 将 Git 克隆到我的笔记本电脑,然后从我的笔记本电脑在新服务器上进行 git 克隆吗?
- name: Clone between Hosts Part 1
git:
repo: https://github.com/blah/blah.git
dest: /my/laptop/var/tmp/
- name: Clone between Hosts Part 2
git:
repo: /my/laptop/var/tmp/blah.git
dest: /remote/server/directory/
这样的事情可能吗?将 repo 克隆到我的笔记本电脑,然后从我的笔记本电脑将其重新克隆到远程服务器上?
解决方案
您可以使用本地操作将 repo 克隆到本地笔记本电脑:
- name: check out a git repository
local_action: git repo=git://foosball.example.org/path/to/repo.git dest=/local/path
比您可以使用syncronize或copy将文件获取到您的服务器。
从远程服务器到本地机器的 Git 克隆有点困难,因为远程服务器必须能够访问本地笔记本电脑。所以更容易将文件从本地复制到远程服务器。
推荐阅读
- mysql - 查询列出与指定用户回答类似问题的用户
- angular - 在检查要在单元测试中定义的 gridOptions.api 后触发 onGridReady 事件时,gridOptions.api 为 null
- java - Java 2D 旋转 BufferedImage
- javascript - D3 GeoJSON 仅在矩形中渲染部分地图
- python - 如何让我的屏幕在 pygame 中放大和缩小?
- javascript - JS选择
- 跟随一个标签
- esp32 - esp-idf:我不能在组件中包含 mdebtls 目录
- python - 按行垂直扩展数据框并保持相同值的有效方法?
- c++ - VS 自动链接在 Windows 上使用 vcpkg 安装的 SDL2 库
- python - 将熊猫框架中的周六和周五行值求和并分配到周五的行值
包含“foo”的标签
所以我有这个小 chrome 扩展项目,我试图弄清楚如何在包含特定单词的“h2”元素之后找到页面上的第一个“ul”元素。
网页的外观示例...
<div> <h2>Foo</h2> // find the first <h2> tag containing "Foo" <ul></ul&