generated from CC/VMServiceTemplate
n8n ansible base
This commit is contained in:
@@ -13,7 +13,7 @@ on:
|
||||
- multi.tfvars.example
|
||||
|
||||
jobs:
|
||||
terraform:
|
||||
terraform-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: hashicorp/setup-terraform@v3
|
||||
- uses: hashicorp/setup-terraform@v4
|
||||
|
||||
- name: Select tfvars
|
||||
run: cp "${{ inputs.tfvars_file }}" terraform.tfvars
|
||||
@@ -42,16 +42,28 @@ jobs:
|
||||
- name: Write tags
|
||||
run: terraform output -json vm_tags > ../ansible/vm_tags.json
|
||||
|
||||
deploy:
|
||||
ansible-configure:
|
||||
needs: terraform
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ansible
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Ansible
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install --upgrade pip
|
||||
pip install ansible community.docker
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ansible
|
||||
|
||||
- name: Deploy app
|
||||
run: ansible-playbook -i ansible/inventory/hosts.ini ansible/playbooks/deploy.yml
|
||||
- name: Set up SSH
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
echo -e "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null\n" > ~/.ssh/config
|
||||
|
||||
- name: Run playbook
|
||||
run: |
|
||||
ansible-playbook playbooks/docker_copy.yml -i inventory/inventory.yml -u cloud --private-key ~/.ssh/id_rsa
|
||||
|
||||
Reference in New Issue
Block a user