Skip to content

Instantly share code, notes, and snippets.

@ticktockhouse
Last active October 19, 2022 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ticktockhouse/81629e9c97817a2a0cd741dc4293abda to your computer and use it in GitHub Desktop.
Save ticktockhouse/81629e9c97817a2a0cd741dc4293abda to your computer and use it in GitHub Desktop.
name: staging-to-dev-test
on:
workflow_dispatch:
inputs:
DONOR_ENV:
description: "The env we're cloning from"
required: true
type: choice
# default: staging
default: dev
options:
- dev
- staging
- prod
env:
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_READ_ONLY }}
JUMPBOX_IP: <public jumpbox IP>
DONOR_ENV: ${{ inputs.DONOR_ENV }}
COMPLETE_KNOWN_HOSTS: |
${{ secrets.JUMPBOX_KNOWN_HOSTS }}
${{ secrets.DEV_KNOWN_HOSTS }}
jobs:
test-job:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Install SSH key (jumpbox)
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEPLOY_SSH_KEY }}
known_hosts: ${{ secrets.JUMPBOX_KNOWN_HOSTS }}
name: id_rsa-jumpbox
config: |
Host jumpbox
Hostname ${{ env.JUMPBOX_IP }}
User deploy
IdentityFile ~/.ssh/id_rsa-jumpbox
- name: Install SSH key (dev-web)
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEPLOY_SSH_KEY }}
known_hosts: ${{ secrets.DEV_KNOWN_HOSTS }}
name: id_rsa-dev
config: |
Host web-dev
Hostname <private jumpbox ip>
User deploy
IdentityFile ~/.ssh/id_rsa-dev
ProxyCommand ssh -W %h:%p jumpbox
- name: Test SSH to web-dev
run: ssh -vv web-dev
- name: Debug!
run: echo $DONOR_ENV
- name: List recursive
run: ls -laR
- name: Run some ansible!
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: test-tf-vars.yml
directory: ansible/chubb
key: ${{ secrets.DEPLOY_SSH_KEY }}
# key: ~/.ssh/id_rsa
known_hosts: ${{ secrets.DEV_KNOWN_HOSTS }}
options: |
-vvv
-l ${{ env.DONOR_ENV }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment