generated from CC/VMServiceTemplate
n8n ci/cd base
This commit is contained in:
@@ -32,18 +32,16 @@ jobs:
|
||||
- name: Terraform apply
|
||||
run: terraform apply -auto-approve
|
||||
|
||||
- name: Write inventory
|
||||
run: |
|
||||
mkdir -p ../ansible/inventory
|
||||
terraform output -json vm_ipv4_addresses | jq -r '
|
||||
to_entries[] | "[app]\n\(.value) ansible_user=cloud"
|
||||
' > ../ansible/inventory/hosts.ini
|
||||
|
||||
- name: Write tags
|
||||
run: terraform output -json vm_tags > ../ansible/vm_tags.json
|
||||
- name: Upload generated files
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: terraform-outputs
|
||||
path: |
|
||||
ansible/inventory/inventory.yml
|
||||
terraform/vm_data.yml
|
||||
|
||||
ansible-configure:
|
||||
needs: terraform
|
||||
needs: terraform-deploy
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
@@ -51,6 +49,12 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download generated files
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: terraform-outputs
|
||||
path: .
|
||||
|
||||
- name: Install Ansible
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -64,6 +68,12 @@ jobs:
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
echo -e "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null\n" > ~/.ssh/config
|
||||
|
||||
- name: Setup Ansible Directories
|
||||
run: |
|
||||
mkdir inventory
|
||||
cat inventory/inventory.yml
|
||||
ls -r
|
||||
|
||||
- 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