diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e78e8c..e9b6e0e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/main.yml b/main.yml new file mode 100644 index 0000000..b6ca856 --- /dev/null +++ b/main.yml @@ -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