Initial ansible onboard
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
name: Validate ansible playbooks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "ansible/**"
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
plan:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Sectool
|
||||
uses: a13labs/setup-sectool@v1
|
||||
|
||||
- name: Install Python and required packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-pip
|
||||
python3 -m pip install -r requirements.txt
|
||||
|
||||
- name: Setup SSH Key
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
run: |
|
||||
sectool ssh unlock ansible
|
||||
cp ssh-keys/ansible ~/.ssh/id_rsa
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
- name: Apply Ansible Playbook
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
ANSIBLE_USER: ${{ secrets.ANSIBLE_USER }}
|
||||
ANSIBLE_HOST_KEY_CHECKING: False
|
||||
run: |
|
||||
cd ansible
|
||||
sectool exec ansible-playbook -i inventory/hosts playbook_microk8s.yml
|
||||
sectool exec ansible-playbook -i inventory/hosts playbook_gitea.yml
|
||||
sectool exec ansible-playbook -i inventory/hosts playbook_nextcloud.yml
|
||||
sectool exec ansible-playbook -i inventory/hosts playbook_wordpress.yml
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "k8sapps/**"
|
||||
|
||||
jobs:
|
||||
apply:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v1
|
||||
with:
|
||||
terraform_version: 1.9.6
|
||||
|
||||
- name: Setup Sectool
|
||||
uses: a13labs/setup-sectool@v1
|
||||
with:
|
||||
version: 0.0.3
|
||||
|
||||
- name: Terraform Init
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
run: |
|
||||
cd k8sapps
|
||||
sectool exec terraform init
|
||||
|
||||
- name: Terraform Apply
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
run: |
|
||||
cd k8sapps
|
||||
sectool exec terraform apply --auto-approve
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Validate Terraform
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feature/**
|
||||
paths:
|
||||
- "k8sapps/**"
|
||||
|
||||
jobs:
|
||||
plan:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v1
|
||||
with:
|
||||
terraform_version: 1.9.6
|
||||
|
||||
- name: Setup Sectool
|
||||
uses: a13labs/setup-sectool@v1
|
||||
with:
|
||||
version: 0.0.3
|
||||
|
||||
- name: Terraform Init
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
run: |
|
||||
cd k8sapps
|
||||
sectool exec terraform init
|
||||
|
||||
- name: Terraform Plan
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
run: |
|
||||
cd k8sapps
|
||||
sectool exec terraform plan
|
||||
Reference in New Issue
Block a user