From e71957d277bf3cb4416e8918bfd232e2f56e558a Mon Sep 17 00:00:00 2001 From: martindemko <325073@mail.muni.cz> Date: Mon, 16 Dec 2024 01:51:21 +0100 Subject: [PATCH] adds tool installation into github actions --- .../install-tools-playbook/action.yaml | 22 +++++++++++++++++++ .../actions/run-ansible-playbook/action.yaml | 6 ++++- .github/workflows/install-tools-qa1.yaml | 21 ++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/actions/install-tools-playbook/action.yaml create mode 100644 .github/workflows/install-tools-qa1.yaml diff --git a/.github/actions/install-tools-playbook/action.yaml b/.github/actions/install-tools-playbook/action.yaml new file mode 100644 index 0000000..ead3b19 --- /dev/null +++ b/.github/actions/install-tools-playbook/action.yaml @@ -0,0 +1,22 @@ +#! vim: ts=2 expandtab: + +name: install-tools + +runs: + using: 'composite' + steps: + - name: Make SSH connection + shell: bash + run: | + mkdir -p $HOME/.ssh + install -m 600 -D /dev/null $HOME/.ssh/id_rsa + echo "$SSH_PRIVATE_KEY" > $HOME/.ssh/id_rsa + ssh -f -o StrictHostKeyChecking=no $TARGET_USER@$TARGET_HOSTNAME hostname + + - name: Create vault password + shell: bash + run: echo "$VAULT_PASSWORD" >.vault-password.txt + + - name: Run galaxy_tools.yaml playbook + shell: bash + run: ansible-playbook -vvv --limit $TARGET_HOSTNAME galaxy_tools.yml diff --git a/.github/actions/run-ansible-playbook/action.yaml b/.github/actions/run-ansible-playbook/action.yaml index 7871547..34577a2 100644 --- a/.github/actions/run-ansible-playbook/action.yaml +++ b/.github/actions/run-ansible-playbook/action.yaml @@ -21,6 +21,10 @@ runs: shell: bash run: echo "$VAULT_PASSWORD" >.vault-password.txt - - name: Run playbook + - name: Run galaxy.yaml playbook shell: bash run: ansible-playbook -vvv --limit $TARGET_HOSTNAME galaxy.yml + + - name: Run galaxy_tools.yaml playbook + shell: bash + run: ansible-playbook -vvv --limit $TARGET_HOSTNAME galaxy_tools.yml diff --git a/.github/workflows/install-tools-qa1.yaml b/.github/workflows/install-tools-qa1.yaml new file mode 100644 index 0000000..74a6fb9 --- /dev/null +++ b/.github/workflows/install-tools-qa1.yaml @@ -0,0 +1,21 @@ +#! vim: ts=2 expandtab: + +name: install-tools-qa1 + +# TODO: run automatically on push to main +on: [ workflow_dispatch ] + +jobs: + call-common: + runs-on: ubuntu-latest + steps: + - name: Checkout actions + uses: actions/checkout@v2 + + - name: Call install-tools-playbook action + uses: ./.github/actions/install-tools-playbook + env: + TARGET_HOSTNAME: galaxy-qa1.galaxy.cloud.e-infra.cz + TARGET_USER: debian + VAULT_PASSWORD: ${{ secrets.VAULT_PASSWORD_QA1 }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_QA1 }}