From 12bdcbc4c048f06b41a77415ceed82a806800693 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Sun, 25 Sep 2022 16:57:26 +0000 Subject: [PATCH] Update .gitlab-ci.yml, main.yml --- .gitlab-ci.yml | 21 ++++++++++++++++++++- main.yml | 9 +++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 main.yml 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