25 lines
971 B
YAML
25 lines
971 B
YAML
---
|
|
- name: 1. Get a list of all pods from the namespace
|
|
command: kubectl -n "{{ cmoa_namespace }}" get pods --no-headers -o custom-columns=":metadata.name"
|
|
#register: pod_list
|
|
|
|
- debug:
|
|
msg: "{{ pod_list.stdout_lines }}"
|
|
|
|
#- name: 2. Copy psql file in postgres (DDL)
|
|
# kubernetes.core.k8s_cp:
|
|
# namespace: "{{ cmoa_namespace }}"
|
|
# pod: "{{ pod_list.stdout }}"
|
|
# remote_path: /tmp/postgres_patch_{{ pg_version }}.psql
|
|
# local_path: "{{ role_path }}/files/pg-patch/postgres_patch_{{ pg_version }}.psql"
|
|
# with_items: "{{ pg_version }}"
|
|
# when: kubernetes_role == 'master'
|
|
#
|
|
#- name: 3. Execute a command in postgres (DDL)
|
|
# kubernetes.core.k8s_exec:
|
|
# namespace: "{{ cmoa_namespace }}"
|
|
# pod: "{{ pod_list.stdout }}"
|
|
# command: bash -c "PGPASSWORD='eorbahrhkswp' && /usr/bin/psql -h 'localhost' -U 'admin' -d 'postgresdb' -f /tmp/postgres_patch_{{ pg_version }}.psql"
|
|
# with_items: "{{ pg_version }}"
|
|
# when: kubernetes_role == 'master'
|