From a61e6033393bb22f1ab56053759b49ee8516abf4 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Fri, 3 Dec 2021 09:42:39 +0000 Subject: [PATCH] Try again to move to github action --- .github/workflows/deploy.yaml | 18 +++++++++++++----- deployment/configure.sh | 26 -------------------------- 2 files changed, 13 insertions(+), 31 deletions(-) delete mode 100755 deployment/configure.sh diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 86113b7..1dd144d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -100,8 +100,16 @@ jobs: "https://nsupdate.fedcloud.eu/nic/update?myip=${{ steps.public_ip.outputs.stdout }}" - name: Configure with ansible if: github.ref == 'refs/heads/main' && github.event_name == 'push' - env: - SSH_KEY: ${{ secrets.SSH_KEY }} - run: | - cd deployment - ./configure.sh "$SSH_KEY" "${{ steps.public_ip.outputs.stdout }}" "{{ github.sha }}" + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: playbook.yml + directory: ./deployment + key: ${{secrets.SSH_KEY}} + inventory: | + [all] + ${{ steps.public_ip.outputs.stdout }} + requirements: galaxy-requirements.yaml + options: | + --extra-vars git_ref="{{ github.sha }}" + --ssh-common-args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" + -u egi diff --git a/deployment/configure.sh b/deployment/configure.sh deleted file mode 100755 index 416dda6..0000000 --- a/deployment/configure.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -set -e - -SSH_KEY="$1" -IP="$2" -GIT_REF="$3" - -# Prepare the ansible setup -cat > inventory.yaml << EOF -all: - hosts: - $IP: - ansible_user: egi - ansible_ssh_private_key_file: key - ansible_ssh_common_args: -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null - git_ref: $GIT_REF -EOF - -echo "$SSH_KEY" > key -chmod 400 key - -# and now config -ansible-galaxy install -r galaxy-requirements.yaml - -ansible-playbook -i inventory.yaml playbook.yaml