deploy_jenkins #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy_jenkins | |
on: | |
workflow_dispatch: | |
concurrency: | |
group: deploy_jenkins | |
cancel-in-progress: true | |
jobs: | |
deploy_docker: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.JENKINS_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.JENKINS_AWS_SECRET_ACCESS_KEY }} | |
JENKINS_PRIV_KEY_PROD: "${{ secrets.JENKINS_PRIV_KEY_PROD }}" | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
DOCKERHUB_TOKEN_TLCPACKSTAGING: ${{ secrets.DOCKERHUB_TOKEN_TLCPACKSTAGING }} | |
defaults: | |
run: | |
working-directory: ./jenkins | |
steps: | |
- | |
name: Pull repository | |
uses: actions/checkout@v2 | |
- | |
name: Source common environment variables to be used in ansible playbook | |
run: source ./scripts/common.sh | |
- | |
name: Pull Terraform state | |
run: ./scripts/pull_terraform_backend.sh | |
- | |
name: Write ansible key to file | |
run: echo "${{ secrets.GLOBAL_NODE_ACCESS_PRIVATE_KEY }}" > global_node_access_private_key | |
- | |
name: Set permissions on key file | |
run: chmod 600 global_node_access_private_key | |
- | |
name: Deploy docker images to head node | |
run: ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ansible_inventory.txt -u ubuntu -b --private-key=global_node_access_private_key ansible/playbooks/deploy_docker.yaml |