Update .gitlab-ci.yml, main.yml

This commit is contained in:
2022-09-25 16:57:26 +00:00
parent 69baeefc1c
commit 12bdcbc4c0
2 changed files with 29 additions and 1 deletions

View File

@@ -1,5 +1,4 @@
stages:
- validate
- plan
- apply
- ansible
@@ -64,6 +63,26 @@ apply:
- terraform.tfvars
when: manual
ansible:
stage: ansible
image:
name: ubuntu:latest
before_script:
- apt update && apt install ansible -y
- ansible-galaxy collection install kubernetes.core
- echo $kubeconfig > config
script:
- ansible-playbook $CI_PROJECT_DIR/main.yml
only:
changes:
- group_vars/**/*
- roles/**/*
- templates/**/*
- main.yml
- hosts.ini
- terraform.tf
- terraform.tfvars
destroy:
stage: destroy
image:

9
main.yml Normal file
View File

@@ -0,0 +1,9 @@
- hosts: localhost
gather_facts: no
tasks:
- name: Create a k8s namespace
kubernetes.core.k8s:
name: testing
kind: Namespace
state: present
kubeconfig: config