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 - name: host insert
shell: | shell: |
PG=$(kubectl get po -n imxc | grep postgres | awk '{print $1}') 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') 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);" 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 done

View File

@@ -3,13 +3,13 @@
lineinfile: lineinfile:
path: /root/host-agent/nerdctl-host/metric-agent.yml path: /root/host-agent/nerdctl-host/metric-agent.yml
regexp: 'targets' regexp: 'targets'
line: " - targets: ['{{ ansible_default_ipv4.address }}:9100']" line: " - targets: ['{{ ip }}:9100']"
when: when:
- inventory_hostname in groups['containerd'] - inventory_hostname in groups['containerd']
- name: host agent install setting [2] - containerd - name: host agent install setting [2] - containerd
shell: | shell: |
sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa-master'][0]]['ansible_default_ipv4']['address'] }}/" /root/host-agent/nerdctl-host/setup_nerdctl.sh sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa-master'][0]]['ip'] }}/" /root/host-agent/nerdctl-host/setup_nerdctl.sh
sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/nerdctl-host/setup_nerdctl.sh sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/nerdctl-host/setup_nerdctl.sh
when: when:
- inventory_hostname in groups['containerd'] - inventory_hostname in groups['containerd']

View File

@@ -13,27 +13,27 @@
- delete_enabled - delete_enabled
- inventory_hostname in groups['containerd'] - inventory_hostname in groups['containerd']
- name: agent conatiner delete - podman.yaml - name: agent conatiner delete - podman
shell: /root/host-agent/podman-host/stop.sh shell: /root/host-agent/podman-host/stop.sh
ignore_errors: true ignore_errors: true
when: when:
- delete_enabled - delete_enabled
- inventory_hostname in groups['crio'] - inventory_hostname in groups['crio']
- name: jaeger tpcc delete - name: jspd tpcc delete
kubernetes.core.helm: kubernetes.core.helm:
chart_ref: "/root/jaeger-tpcc" chart_ref: "/root/jspd-tpcc"
name: jaeger-tpcc name: jspd-tpcc
namespace: default namespace: default
state: absent state: absent
wait: true wait: true
when: when:
- inventory_hostname == groups['agent-master'][0] - inventory_hostname == groups['agent-master'][0]
- name: jaeger client delete - name: jspd client delete
kubernetes.core.helm: kubernetes.core.helm:
chart_ref: "/root/jaeger-client" chart_ref: "/root/jspd-client"
name: jaeger-client name: jspd-client
namespace: "{{ NAMESAPCE }}" namespace: "{{ NAMESAPCE }}"
state: absent state: absent
wait: true wait: true
@@ -49,19 +49,19 @@
- delete_enabled - delete_enabled
- inventory_hostname in groups['docker'] or inventory_hostname in groups['containerd'] or inventory_hostname in groups['crio'] - inventory_hostname in groups['docker'] or inventory_hostname in groups['containerd'] or inventory_hostname in groups['crio']
- name: old jaeger-client directory delete - name: old jspd-client directory delete
ignore_errors: true ignore_errors: true
file: file:
path: /root/jaeger-client path: /root/jspd-client
state: absent state: absent
when: when:
- delete_enabled - delete_enabled
- inventory_hostname in groups['docker'] or inventory_hostname in groups['containerd'] or inventory_hostname in groups['crio'] - inventory_hostname in groups['docker'] or inventory_hostname in groups['containerd'] or inventory_hostname in groups['crio']
- name: old jaeger-tpcc directory delete - name: old jspd-tpcc directory delete
ignore_errors: true ignore_errors: true
file: file:
path: /root/jaeger-tpcc path: /root/jspd-tpcc
state: absent state: absent
when: when:
- delete_enabled - delete_enabled

View File

@@ -3,13 +3,13 @@
lineinfile: lineinfile:
path: /root/host-agent/docker-host/metric-agent.yml path: /root/host-agent/docker-host/metric-agent.yml
regexp: 'targets' regexp: 'targets'
line: " - targets: ['{{ ansible_default_ipv4.address }}:9100']" line: " - targets: ['{{ ip }}:9100']"
when: when:
- inventory_hostname in groups['docker'] - inventory_hostname in groups['docker']
- name: host agent install setting [2] - docker - name: host agent install setting [2] - docker
shell: | shell: |
sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa-master'][0]]['ansible_default_ipv4']['address'] }}/" /root/host-agent/docker-host/setup.sh sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa-master'][0]]['ip'] }}/" /root/host-agent/docker-host/setup.sh
sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/docker-host/setup.sh sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/docker-host/setup.sh
when: when:
- inventory_hostname in groups['docker'] - inventory_hostname in groups['docker']

View File

@@ -3,13 +3,13 @@
lineinfile: lineinfile:
path: /root/host-agent/podman-host/metric-agent.yml path: /root/host-agent/podman-host/metric-agent.yml
regexp: 'targets' regexp: 'targets'
line: " - targets: ['{{ ansible_default_ipv4.address }}:9100']" line: " - targets: ['{{ ip }}:9100']"
when: when:
- inventory_hostname in groups['crio'] - inventory_hostname in groups['crio']
- name: host agent install setting [2] - crio - name: host agent install setting [2] - crio
shell: | shell: |
sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa-master'][0]]['ansible_default_ipv4']['address'] }}/" /root/host-agent/podman-host/setup.sh sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa-master'][0]]['ip'] }}/" /root/host-agent/podman-host/setup.sh
sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/podman-host/setup.sh sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/podman-host/setup.sh
when: when:
- inventory_hostname in groups['crio'] - inventory_hostname in groups['crio']

View File

@@ -13,7 +13,7 @@
- delete_enabled - delete_enabled
- inventory_hostname in groups['containerd'] - inventory_hostname in groups['containerd']
- name: agent conatiner delete - name: agent conatiner delete - podman
shell: /root/host-agent/podman-host/stop.sh shell: /root/host-agent/podman-host/stop.sh
ignore_errors: true ignore_errors: true
when: when: