add pg patch role
This commit is contained in:
@@ -8,6 +8,5 @@
|
|||||||
REGISTRY: 10.10.31.243:5000/cmoa3
|
REGISTRY: 10.10.31.243:5000/cmoa3
|
||||||
REPO: "nexus" # dockerhub or nexus
|
REPO: "nexus" # dockerhub or nexus
|
||||||
roles:
|
roles:
|
||||||
- role: agent_os_setting
|
- role: cmoa_install
|
||||||
# - role: cmoa_install
|
delegate_to: 127.0.0.1
|
||||||
# delegate_to: 127.0.0.1
|
|
||||||
|
|||||||
@@ -2,11 +2,15 @@
|
|||||||
10.10.43.210
|
10.10.43.210
|
||||||
|
|
||||||
[worker1]
|
[worker1]
|
||||||
|
10.10.43.211
|
||||||
|
|
||||||
[worker2]
|
[worker2]
|
||||||
|
10.10.43.212
|
||||||
|
|
||||||
[cluster:children]
|
[cluster:children]
|
||||||
master
|
master
|
||||||
|
worker1
|
||||||
|
worker2
|
||||||
|
|
||||||
|
|
||||||
[master:vars]
|
[master:vars]
|
||||||
|
|||||||
Binary file not shown.
@@ -1,24 +1,34 @@
|
|||||||
---
|
---
|
||||||
- name: 1. Get a list of all pods from the namespace
|
- 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"
|
shell: kubectl -n "{{ cmoa_namespace }}" get pods --no-headers -o custom-columns=":metadata.name" |grep postgres
|
||||||
#register: pod_list
|
register: pod_list
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "{{ pod_list.stdout_lines }}"
|
msg: "{{ pod_list.stdout_lines }}"
|
||||||
|
|
||||||
#- name: 2. Copy psql file in postgres (DDL)
|
- name: 2. Copy psql file in postgres
|
||||||
# kubernetes.core.k8s_cp:
|
kubernetes.core.k8s_cp:
|
||||||
# namespace: "{{ cmoa_namespace }}"
|
namespace: "{{ cmoa_namespace }}"
|
||||||
# pod: "{{ pod_list.stdout }}"
|
pod: "{{ pod_list.stdout }}"
|
||||||
# remote_path: /tmp/postgres_patch_{{ pg_version }}.psql
|
remote_path: /tmp/postgres_patch_{{ item }}.psql
|
||||||
# local_path: "{{ role_path }}/files/pg-patch/postgres_patch_{{ pg_version }}.psql"
|
local_path: "{{ role_path }}/files/pg-patch/postgres_patch_{{ item }}.psql"
|
||||||
# with_items: "{{ pg_version }}"
|
with_items: "{{ pg_version }}"
|
||||||
# when: kubernetes_role == 'master'
|
when: kubernetes_role == 'master'
|
||||||
#
|
|
||||||
#- name: 3. Execute a command in postgres (DDL)
|
- name: 3. Execute a command in postgres
|
||||||
# kubernetes.core.k8s_exec:
|
kubernetes.core.k8s_exec:
|
||||||
# namespace: "{{ cmoa_namespace }}"
|
namespace: "{{ cmoa_namespace }}"
|
||||||
# pod: "{{ pod_list.stdout }}"
|
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"
|
command: bash -c "PGPASSWORD='eorbahrhkswp' && /usr/bin/psql -h 'localhost' -U 'admin' -d 'postgresdb' -f /tmp/postgres_patch_{{ item }}.psql"
|
||||||
# with_items: "{{ pg_version }}"
|
register: execute_register
|
||||||
# when: kubernetes_role == 'master'
|
with_items: "{{ pg_version }}"
|
||||||
|
when: kubernetes_role == 'master'
|
||||||
|
|
||||||
|
- ansible.builtin.debug:
|
||||||
|
msg: |
|
||||||
|
______ _ _ _ _____ ___ ___ _____ ___
|
||||||
|
| ___ \| | | | | | / __ \| \/ || _ | / _ \
|
||||||
|
| |_/ /| | ___ __ _ ___ ___ _ __ ___ ___ | |_ __ _ _ __ | |_ | / \/| . . || | | |/ /_\ \
|
||||||
|
| __/ | | / _ \ / _` |/ __| / _ \ | '__| / _ \/ __|| __| / _` || '__|| __| | | | |\/| || | | || _ |
|
||||||
|
| | | || __/| (_| |\__ \| __/ | | | __/\__ \| |_ | (_| || | | |_ | \__/\| | | |\ \_/ /| | | |
|
||||||
|
\_| |_| \___| \__,_||___/ \___| |_| \___||___/ \__| \__,_||_| \__| \____/\_| |_/ \___/ \_| |_/
|
||||||
Reference in New Issue
Block a user