gather_facts 제거 및 제거에 따른 script 수정

This commit is contained in:
변정훈
2023-07-12 14:09:01 +09:00
parent 7d6744837b
commit f69ed091a5
6 changed files with 19 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
- name: host insert
shell: |
PG=$(kubectl get po -n imxc | grep postgres | awk '{print $1}')
for ip in {{ groups['containerd'] | union(groups['docker']) | union(groups['crio']) }}; do
for ip in {{ groups['containerd'] | map('extract', hostvars, ['ansible_host']) | union(groups['docker'] | map('extract', hostvars, ['ansible_host'])) | union(groups['crio'] | map('extract', hostvars, ['ansible_host'])) }}; do
ip_formatted=$(echo "$ip" | sed -e 's/[][]//g' -e 's/,//g')
kubectl exec -it -n imxc $PG -- psql -U admin postgresdb --command="INSERT INTO auth_resource3 VALUES (nextval('hibernate_sequence'), 'host|$ip_formatted:9100', false, null);"
done