相关疑难解决方法(0)

登录时启动ssh-agent

我有一个站点作为远程Git repo从Bitbucket.com使用SSH别名拉.我可以在我的服务器上手动启动ssh-agent,但每次通过SSH登录时都必须这样做.

我手动启动ssh-agent:

eval ssh-agent $SHELL
Run Code Online (Sandbox Code Playgroud)

然后我添加代理:

ssh-add ~/.ssh/bitbucket_id
Run Code Online (Sandbox Code Playgroud)

然后它出现在我做的时候:

ssh-add -l
Run Code Online (Sandbox Code Playgroud)

我很高兴去.有没有办法自动化这个过程,所以我不必每次登录都这样做?服务器正在运行RedHat 6.2(Santiago).

git ssh redhat bitbucket ssh-agent

230
推荐指数
8
解决办法
21万
查看次数

无法使用 ansible 在本地进行 git clone

我正在尝试在我的本地系统上克隆一个 git repo。我已手动完成此操作并且它工作正常,但是当我尝试通过 ansible 执行此操作时,它不起作用

这是我的玩法:

---
  - name: Create a directory on root
    file:
      path: "{{ local_home_dir }}/superb-queue"
      owner: "{{ local_user }}"
      group: "{{ local_user }}"
      state: directory
    delegate_to: localhost

  - name: Clone the bitbucket queue repo locally
    git:
      repo: git@bitbucket.org:superbhq/queue-main.git
      dest: "{{ local_home_dir }}/superb-queue"
      clone: yes
      recursive: yes
      force: yes
      accept_hostkey: yes
      version: master
      key_file: "{{ local_home_dir }}/.ssh/id_rsa"
    become_user: "{{ local_user }}"
    delegate_to: localhost
Run Code Online (Sandbox Code Playgroud)

我得到的错误是

ASK [deploy-queue-main : Clone the bitbucket queue repo locally] ******************************************************************************************************************************************
fatal: [10.0.3.219 -> …
Run Code Online (Sandbox Code Playgroud)

git ansible

3
推荐指数
2
解决办法
7600
查看次数

当我们想用 github 动作执行 ansible 命令时如何管理 ssh 密钥文件

我有一个 github 存储库、一个 docker 存储库和一个 Amazon ec2 实例。我正在尝试使用这些工具创建 CI/CD 管道。这个想法是在 github 存储库主分支发生推送时将 docker 容器部署到 ec2 实例。我已经使用 github 操作来构建代码、构建 docker 镜像并将 docker 镜像推送到 docker hub。现在我想将最新的镜像从 docker hub 拉到远程 ec2 实例并运行它。为此,我试图从 github 操作执行 ansible 命令。但我需要将 .pem 文件指定为 ansible 命令的参数。我试图将 .pem 文件保存在 github secretes 中,但没有用。我真的很困惑如何进行这个。这是我的 github 工作流文件

name: helloworld_cicd
on: 
  push:
    branches: 
      - master
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

    - name: Check out code into the Go module directory
      uses: actions/checkout@v1

    - name: Go Build
      run: go build

    - name: Docker …
Run Code Online (Sandbox Code Playgroud)

amazon-ec2 ansible docker github-actions

2
推荐指数
1
解决办法
792
查看次数

标签 统计

ansible ×2

git ×2

amazon-ec2 ×1

bitbucket ×1

docker ×1

github-actions ×1

redhat ×1

ssh ×1

ssh-agent ×1