promtail improvements #87
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: Init cluster | |
on: | |
push: | |
branches: | |
- main | |
- devel | |
pull_request: | |
branches: | |
- main | |
- devel | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
env: | |
description: 'ENV' | |
required: true | |
default: 'prod' | |
tags: | |
description: 'Choose environment' | |
jobs: | |
deploy: | |
#runs-on: self-hosted | |
runs-on: ubuntu-latest | |
container: | |
image: fejk/alpine-aws | |
steps: | |
# Checkout code | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Prepare SSH | |
shell: bash | |
run: | | |
mkdir -p ~/.ssh | |
ssh-agent -a ${SSH_AUTH_SOCK} > /dev/null | |
ssh-add <(echo "${SSH_KEY}") | |
ssh-add -l | |
cat > ~/.ssh/config<<EOF | |
Host * | |
User root | |
StrictHostKeyChecking no | |
EOF | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/* | |
cp -a ~/.ssh /root/ | |
env: | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
- name: Prepare vultr.ini | |
shell: bash | |
run: | | |
cat > ./vultr.ini<<EOF | |
[default] | |
key = $VULTR_API_KEY | |
timeout = 30 | |
EOF | |
chmod 600 ./vultr.ini | |
env: | |
VULTR_API_KEY: ${{ secrets.VULTR_API_KEY }} | |
- name: Install ansible dependencies | |
run: ansible-galaxy install -r requirements.yml --force | |
- name: Linter | |
run: ansible-lint . | |
# Configure servers | |
- name: ${env} - run init-cluster.yml | |
run: | | |
echo "${VAULT_PASS}" > ../vault-pass | |
echo "SKIP ansible-playbook --vault-password-file ../vault-pass -i ./env/${env} ./init-cluster.yml --diff" | |
env: | |
env: ${{ github.event.inputs.env }} | |
VAULT_PASS: ${{ secrets.VAULT_PASS }} | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
# - name: Don't kill instace | |
# if: ${{ failure() }} | |
# run: sleep 10m |