Ubuntu 지원 및 process-agent 추가
This commit is contained in:
10
roles/host/tasks/cmoa.yaml
Normal file
10
roles/host/tasks/cmoa.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: host insert
|
||||
shell: |
|
||||
PG=$(kubectl get po -n imxc | grep postgres | awk '{print $1}')
|
||||
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
|
||||
when: inventory_hostname == groups['cmoa_master'][0]
|
||||
ignore_errors: yes
|
||||
12
roles/host/tasks/containerd.yaml
Normal file
12
roles/host/tasks/containerd.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: host agent install setting - containerd
|
||||
shell: |
|
||||
sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa_master'][0]]['ip'] }}/" /root/host-agent/default_setup.sh
|
||||
sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/default_setup.sh
|
||||
when:
|
||||
- inventory_hostname in groups['containerd']
|
||||
|
||||
- name: host agent install - containerd
|
||||
shell: sh /root/host-agent/default_setup.sh
|
||||
when:
|
||||
- inventory_hostname in groups['containerd']
|
||||
39
roles/host/tasks/delete.yaml
Normal file
39
roles/host/tasks/delete.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: agent container delete - docker
|
||||
shell: /root/host-agent/default_stop.sh
|
||||
ignore_errors: true
|
||||
when:
|
||||
- delete_enabled
|
||||
- inventory_hostname in groups['docker']
|
||||
|
||||
- name: agent container delete - containerd
|
||||
shell: /root/host-agent/default_stop.sh
|
||||
ignore_errors: true
|
||||
when:
|
||||
- delete_enabled
|
||||
- inventory_hostname in groups['containerd']
|
||||
|
||||
- name: agent conatiner delete - podman
|
||||
shell: /root/host-agent/default_stop.sh
|
||||
ignore_errors: true
|
||||
when:
|
||||
- delete_enabled
|
||||
- inventory_hostname in groups['crio']
|
||||
|
||||
- name: old host-agent directory delete
|
||||
ignore_errors: true
|
||||
file:
|
||||
path: /root/host-agent
|
||||
state: absent
|
||||
when:
|
||||
- delete_enabled
|
||||
- inventory_hostname in groups['docker'] or inventory_hostname in groups['containerd'] or inventory_hostname in groups['crio']
|
||||
|
||||
- name: old host-agent.tar.gz delete
|
||||
ignore_errors: true
|
||||
file:
|
||||
path: /root/host-agent.tar.gz
|
||||
state: absent
|
||||
when:
|
||||
- delete_enabled
|
||||
- inventory_hostname in groups['docker'] or inventory_hostname in groups['containerd'] or inventory_hostname in groups['crio']
|
||||
12
roles/host/tasks/docker.yaml
Normal file
12
roles/host/tasks/docker.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: host agent install setting - docker
|
||||
shell: |
|
||||
sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa_master'][0]]['ip'] }}/" /root/host-agent/default_setup.sh
|
||||
sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/default_setup.sh
|
||||
when:
|
||||
- inventory_hostname in groups['docker']
|
||||
|
||||
- name: host agent install - docker
|
||||
shell: sh /root/host-agent/default_setup.sh
|
||||
when:
|
||||
- inventory_hostname in groups['docker']
|
||||
57
roles/host/tasks/hostsetting.yaml
Normal file
57
roles/host/tasks/hostsetting.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
- name: install podman
|
||||
package:
|
||||
name: podman
|
||||
state: latest
|
||||
when:
|
||||
- inventory_hostname in groups['crio']
|
||||
- ansible_distribution == "CentOS" or ansible_distribution == "RedHat" or ansible_distribution == "Rocky"
|
||||
|
||||
- name: install podman
|
||||
shell: |
|
||||
/etc/os-release
|
||||
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_{{ ansible_distribution_version }}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
||||
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_{{ ansible_distribution_version }}/Release.key" | sudo apt-key add -
|
||||
apt -y update
|
||||
apt -y upgrade
|
||||
apt install -y podman
|
||||
when:
|
||||
- inventory_hostname in groups['crio']
|
||||
- ansible_distribution == "Ubuntu"
|
||||
|
||||
- name: nerdctl tar.gz copy
|
||||
copy:
|
||||
src: "{{ role_path }}/files/host-agent/nerdctl-0.19.0-linux-amd64.tar.gz"
|
||||
dest: /root
|
||||
when:
|
||||
- inventory_hostname in groups['containerd']
|
||||
|
||||
- name: nerdctl unarchive
|
||||
unarchive:
|
||||
src: /root/nerdctl-0.19.0-linux-amd64.tar.gz
|
||||
dest: /usr/local/bin
|
||||
remote_src: yes
|
||||
when:
|
||||
- inventory_hostname in groups['containerd']
|
||||
|
||||
- name: host-agent.tar.gz copy
|
||||
copy:
|
||||
src: "{{ role_path }}/files/host-agent/host-agent.tar.gz"
|
||||
dest: /root/
|
||||
when:
|
||||
- inventory_hostname in groups['containerd'] or inventory_hostname in groups['docker'] or inventory_hostname in groups['crio']
|
||||
|
||||
- name: create host-agent directory
|
||||
file:
|
||||
path: /root/host-agent
|
||||
state: directory
|
||||
when:
|
||||
- inventory_hostname in groups['containerd'] or inventory_hostname in groups['docker'] or inventory_hostname in groups['crio']
|
||||
|
||||
- name: host-agent.tar.gz unarchive
|
||||
unarchive:
|
||||
src: /root/host-agent.tar.gz
|
||||
dest: /root/host-agent/
|
||||
remote_src: yes
|
||||
when:
|
||||
- inventory_hostname in groups['containerd'] or inventory_hostname in groups['docker'] or inventory_hostname in groups['crio']
|
||||
30
roles/host/tasks/main.yml
Normal file
30
roles/host/tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: old host-agent dir delete - all
|
||||
include: delete.yaml
|
||||
when:
|
||||
- delete_enabled
|
||||
|
||||
- name: host-agent install settings
|
||||
include: hostsetting.yaml
|
||||
when:
|
||||
- not delete_enabled
|
||||
|
||||
- name: host-agent install - docker
|
||||
include: docker.yaml
|
||||
when:
|
||||
- not delete_enabled
|
||||
|
||||
- name: host-agent install - containerd
|
||||
include: containerd.yaml
|
||||
when:
|
||||
- not delete_enabled
|
||||
|
||||
- name: host-agent install - crio
|
||||
include: podman.yaml
|
||||
when:
|
||||
- not delete_enabled
|
||||
|
||||
- name: host insert
|
||||
include: cmoa.yaml
|
||||
when:
|
||||
- not delete_enabled
|
||||
12
roles/host/tasks/podman.yaml
Normal file
12
roles/host/tasks/podman.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: host agent install setting - crio
|
||||
shell: |
|
||||
sed -i "s/10.10.34.142/{{ hostvars[groups['cmoa_master'][0]]['ip'] }}/" /root/host-agent/default_setup.sh
|
||||
sed -i "s/rel3.4.6/rel{{ VERSION }}/" /root/host-agent/default_setup.sh
|
||||
when:
|
||||
- inventory_hostname in groups['crio']
|
||||
|
||||
- name: host agent install - crio
|
||||
shell: sh /root/host-agent/default_setup.sh
|
||||
when:
|
||||
- inventory_hostname in groups['crio']
|
||||
Reference in New Issue
Block a user