Skip to content

Commit

Permalink
fix: correctly link the task files
Browse files Browse the repository at this point in the history
To be able to use the tasks from within both playbooks and roles and also
satisfy the ansible-lint requirements.

Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Jan 2, 2025
1 parent 1896da5 commit e9a5f48
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 25 deletions.
1 change: 1 addition & 0 deletions playbooks/tasks
1 change: 1 addition & 0 deletions roles/deploy/tasks/check-pod-running.yml
1 change: 1 addition & 0 deletions roles/deploy/tasks/check-up-to-date.yml
1 change: 1 addition & 0 deletions roles/deploy/tasks/k8s.yml
50 changes: 25 additions & 25 deletions roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Include tasks/project-dir.yml
ansible.builtin.include_tasks: tasks/project-dir.yml
- name: Include project-dir.yml
ansible.builtin.include_tasks: project-dir.yml
tags:
- always

Expand All @@ -9,18 +9,18 @@
tags:
- always

- name: Include tasks/check-up-to-date.yml
ansible.builtin.include_tasks: tasks/check-up-to-date.yml
- name: Include check-up-to-date.yml
ansible.builtin.include_tasks: check-up-to-date.yml
tags:
- always

- name: Include deployment facts
ansible.builtin.include_tasks: tasks/set-deployment-facts.yml
ansible.builtin.include_tasks: set-deployment-facts.yml
tags:
- always

- name: Include tasks/set-facts.yml
ansible.builtin.include_tasks: tasks/set-facts.yml
- name: Include set-facts.yml
ansible.builtin.include_tasks: set-facts.yml
tags:
- always

Expand Down Expand Up @@ -106,7 +106,7 @@
changed_when: true

- name: Deploy secrets
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/secret-packit-ssh.yml.j2') }}"
- "{{ lookup('template', '{{ project_dir }}/openshift/secret-packit-secrets.yml.j2') }}"
Expand Down Expand Up @@ -135,14 +135,14 @@
changed_when: "'added:' in rolebinding.stdout"

- name: Deploy postgres
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/postgres.yml.j2') }}"
tags:
- postgres

- name: Deploy key-value database ({{ kv_database }})
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('file', '{{ project_dir }}/openshift/configmap-redis_like_config.yml') }}"
- "{{ lookup('template', '{{ project_dir }}/openshift/{{ kv_database }}.yml.j2') }}"
Expand All @@ -151,7 +151,7 @@
- kv_database

- name: Deploy fluentd image stream and config
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/fluentd.yml.j2') }}"
tags:
Expand All @@ -160,7 +160,7 @@
when: with_fluentd_sidecar

- name: Deploy packit-service
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-service.yml.j2') }}"
tags:
Expand Down Expand Up @@ -189,7 +189,7 @@
worker_requests_cpu: "100m"
worker_limits_memory: "1024Mi"
worker_limits_cpu: "400m"
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-worker.yml.j2') }}"
tags:
Expand All @@ -207,7 +207,7 @@
worker_requests_cpu: "80m"
worker_limits_memory: "640Mi"
worker_limits_cpu: "700m"
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-worker.yml.j2') }}"
tags:
Expand Down Expand Up @@ -239,23 +239,23 @@
worker_requests_cpu: "100m"
worker_limits_memory: "2048Mi"
worker_limits_cpu: "600m"
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-worker.yml.j2') }}"
tags:
- packit-worker
when: workers_long_running > 0

- name: Deploy packit-service-beat
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-service-beat.yml.j2') }}"
when: with_beat
tags:
- packit-service-beat

- name: Deploy dashboard
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/dashboard.yml.j2') }}"
when: with_dashboard
Expand All @@ -279,7 +279,7 @@
- name: Deploy redis-commander
vars:
k8s_apply: true
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/redis-commander.yml.j2') }}"
when: with_redis_commander
Expand All @@ -288,15 +288,15 @@
register: redis_commander

- name: Deploy flower
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/flower.yml.j2') }}"
when: with_flower
tags:
- flower

- name: Deploy packit-service-fedmsg
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/packit-service-fedmsg.yml.j2') }}"
tags:
Expand Down Expand Up @@ -329,7 +329,7 @@
when: with_tokman

- name: Deploy aggregating pushgateway
ansible.builtin.include_tasks: tasks/k8s.yml
ansible.builtin.include_tasks: k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/pushgateway.yml.j2') }}"
tags:
Expand All @@ -348,7 +348,7 @@
password: "{{ vault.flower.basic_auth | regex_replace('flower-boss:', '') }}"
mode: 0640
- name: Deploy flower-htpasswd secret
# Don't use tasks/k8s.yml here because the loop item is always evaluated
# Don't use k8s.yml here because the loop item is always evaluated
k8s:
namespace: "{{ project }}"
resource_definition: "{{ lookup('template', '{{ project_dir }}/openshift/secret-flower-htpasswd.yml.j2') }}"
Expand All @@ -373,19 +373,19 @@
- name: Wait for worker-0 to be running
vars:
pod_name: packit-worker-0
ansible.builtin.include_tasks: tasks/wait_for_pod.yml
ansible.builtin.include_tasks: wait_for_pod.yml
when: workers_all_tasks > 0

- name: Wait for worker-short-running-0 to be running
vars:
pod_name: packit-worker-short-running-0
ansible.builtin.include_tasks: tasks/wait_for_pod.yml
ansible.builtin.include_tasks: wait_for_pod.yml
when: workers_short_running > 0

- name: Wait for worker-long-running-0 to be running
vars:
pod_name: packit-worker-long-running-0
ansible.builtin.include_tasks: tasks/wait_for_pod.yml
ansible.builtin.include_tasks: wait_for_pod.yml
when: workers_long_running > 0

- name: Select project to check status on command line
Expand Down
1 change: 1 addition & 0 deletions roles/deploy/tasks/project-dir.yml
1 change: 1 addition & 0 deletions roles/deploy/tasks/set-deployment-facts.yml
1 change: 1 addition & 0 deletions roles/deploy/tasks/set-facts.yml
1 change: 1 addition & 0 deletions roles/deploy/tasks/wait_for_pod.yml

0 comments on commit e9a5f48

Please sign in to comment.