Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-7854 - split Ansible Jobs by Tags #163

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ansible/roles/schulcloud-calendar-core/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
name: "pg-calendar-secret"
register: db_secret_present
when: WITH_BRANCH_POSTGRES_DB_MANAGEMENT is defined and WITH_BRANCH_POSTGRES_DB_MANAGEMENT
tags:
- 1password

- name: Create Secret for the database (if not existing)
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: secret-database.yml.j2
when: WITH_BRANCH_POSTGRES_DB_MANAGEMENT is defined and WITH_BRANCH_POSTGRES_DB_MANAGEMENT and db_secret_present.resources|length == 0
tags:
- 1password

- name: Create ConfigMap with database configuration script
kubernetes.core.k8s:
Expand All @@ -21,37 +25,49 @@
template: configmap-database-init.yml.j2
apply: yes
when: WITH_BRANCH_POSTGRES_DB_MANAGEMENT is defined and WITH_BRANCH_POSTGRES_DB_MANAGEMENT
tags:
- configmap

- name: Create/execute database configuration script
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: job-database-init.yml.j2
when: WITH_BRANCH_POSTGRES_DB_MANAGEMENT is defined and WITH_BRANCH_POSTGRES_DB_MANAGEMENT
tags:
- job

- name: Service
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: svc.yml.j2
tags:
- service

- name: Configmap
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: configmap.yml.j2
apply: yes
tags:
- configmap

- name: Secret by 1Password
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: onepassword.yml.j2
when: ONEPASSWORD_OPERATOR is defined and ONEPASSWORD_OPERATOR|bool
tags:
- 1password


- name: Deployment
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: deployment.yml.j2
tags:
- deployment
10 changes: 10 additions & 0 deletions ansible/roles/schulcloud-calendar-init/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace: "{{ NAMESPACE }}"
template: configmap_file_init_db.yml.j2
when: WITH_CALENDAR_INIT
tags:
- configmap

- name: Calendar db init job config map
kubernetes.core.k8s:
Expand All @@ -14,6 +16,8 @@
kind: ConfigMap
name: calendar-db-init-file
when: not WITH_CALENDAR_INIT
tags:
- configmap

- name: Test if init job exists
kubernetes.core.k8s_info:
Expand All @@ -24,13 +28,17 @@
name: calendar-db-init-job
register: calendar_init_job_present
when: WITH_CALENDAR_INIT
tags:
- job

- name: Calendar db init job
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: job_init_db.yml.j2
when: WITH_CALENDAR_INIT and calendar_init_job_present.resources|length == 0
tags:
- job

- name: Calendar db init job
kubernetes.core.k8s:
Expand All @@ -41,3 +49,5 @@
kind: Job
name: calendar-db-init-job
when: not WITH_CALENDAR_INIT
tags:
- job