exemONE Agent Installer 작성
This commit is contained in:
23
roles/one_agent/tasks/container-agent.yml
Normal file
23
roles/one_agent/tasks/container-agent.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: Create exemONE Agent Directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ EXEM_HOME }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy exemONE Container-Agent File
|
||||
ansible.posix.synchronize:
|
||||
src: "{{ role_path }}/files/container"
|
||||
dest: "{{ EXEM_HOME }}"
|
||||
|
||||
- name: Create Agent Script
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ EXEM_HOME }}/container/{{ item }}"
|
||||
mode: '0755'
|
||||
with_items:
|
||||
- start.sh
|
||||
- stop.sh
|
||||
|
||||
- name: exem-container-agent start
|
||||
ansible.builtin.shell: "{{ EXEM_HOME }}/container/start.sh"
|
||||
57
roles/one_agent/tasks/host-agent.yml
Normal file
57
roles/one_agent/tasks/host-agent.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
- name: Create exemONE Agent Directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ EXEM_HOME }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy exemONE Host-Agent File
|
||||
ansible.posix.synchronize:
|
||||
src: "{{ role_path }}/files/host"
|
||||
dest: "{{ EXEM_HOME }}"
|
||||
|
||||
- name: Create Agent Script
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ EXEM_HOME }}/host/script/{{ item }}"
|
||||
mode: '0755'
|
||||
with_items:
|
||||
- binary_start.sh
|
||||
- binary_stop.sh
|
||||
- systemctl_stop.sh
|
||||
|
||||
- name: Create Service Script
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ EXEM_HOME }}/host/service/{{ item }}"
|
||||
mode: '0755'
|
||||
with_items:
|
||||
- exem-host-agent
|
||||
- exem-host-agent.service
|
||||
|
||||
- name: Move exem-host-agent Binary
|
||||
ansible.builtin.copy:
|
||||
src: "{{ EXEM_HOME }}/host/os_binary/exem-host-agent_linux-2.6-x86_64-64"
|
||||
dest: "{{ EXEM_HOME }}/host/bin/exem-host-agent"
|
||||
mode: '0755'
|
||||
|
||||
- name: Setting SELinux
|
||||
ansible.builtin.shell: |
|
||||
chcon -t bin_t {{ EXEM_HOME }}/host/script/binary_start.sh
|
||||
chcon -R -t var_run_t {{ EXEM_HOME }}/host/data/
|
||||
chcon -R -t var_run_t {{ EXEM_HOME }}/host/service/
|
||||
|
||||
- name: Create Symbolic link
|
||||
ansible.builtin.file:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
state: link
|
||||
loop:
|
||||
- { src: "{{ EXEM_HOME }}/host/service/exem-host-agent.service", dest: /etc/systemd/system/exem-host-agent.service }
|
||||
- { src: "{{ EXEM_HOME }}/host/service/exem-host-agent", dest: /usr/bin/exem-host-agent }
|
||||
|
||||
- name: exem-host-agent start and enable
|
||||
ansible.builtin.service:
|
||||
name: exem-host-agent
|
||||
state: started
|
||||
enabled: yes
|
||||
13
roles/one_agent/tasks/main.yml
Normal file
13
roles/one_agent/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- include_tasks: rsync.yml
|
||||
|
||||
- include_tasks: host-agent.yml
|
||||
when:
|
||||
- agent_list | select('search', 'host-agent') | list | count > 0
|
||||
- "'host_agent' in group_names"
|
||||
|
||||
- include_tasks: container-agent.yml
|
||||
when:
|
||||
- agent_list | select('search', 'container-agent') | list | count > 0
|
||||
- "'container_agent' in group_names"
|
||||
|
||||
45
roles/one_agent/tasks/rsync.yml
Normal file
45
roles/one_agent/tasks/rsync.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: Create exemONE Agent Directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ EXEM_HOME }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy rsync install rpm OS - 7
|
||||
ansible.builtin.copy:
|
||||
src: "{{ role_path }}/files/rpm/rhel7.rpm"
|
||||
dest: "{{ EXEM_HOME }}/rhel7.rpm"
|
||||
mode: '0755'
|
||||
when: ansible_distribution_major_version == '7'
|
||||
|
||||
- name: install rsync os version 7
|
||||
ansible.builtin.yum:
|
||||
name: "{{ EXEM_HOME }}/rhel7.rpm"
|
||||
state: present
|
||||
when: ansible_distribution_major_version == '7'
|
||||
|
||||
- name: Copy rsync install rpm OS - 8
|
||||
ansible.builtin.copy:
|
||||
src: "{{ role_path }}/files/rpm/rhel8.rpm"
|
||||
dest: "{{ EXEM_HOME }}/rhel8.rpm"
|
||||
mode: '0755'
|
||||
when: ansible_distribution_major_version == '8'
|
||||
|
||||
- name: install rsync os version 8
|
||||
ansible.builtin.yum:
|
||||
name: "{{ EXEM_HOME }}/rhel8.rpm"
|
||||
state: present
|
||||
when: ansible_distribution_major_version == '8'
|
||||
|
||||
- name: Copy rsync install rpm OS - 9
|
||||
ansible.builtin.copy:
|
||||
src: "{{ role_path }}/files/rpm/rhel9.rpm"
|
||||
dest: "{{ EXEM_HOME }}/rhel9.rpm"
|
||||
mode: '0755'
|
||||
when: ansible_distribution_major_version == '9'
|
||||
|
||||
- name: install rsync os version 9
|
||||
ansible.builtin.yum:
|
||||
name: "{{ role_path }}/files/rpm/rhel9.rpm"
|
||||
state: present
|
||||
when: ansible_distribution_major_version == '9'
|
||||
Reference in New Issue
Block a user