Files
datasaker-agent-ansible/tasks/dsk-log-agent.yml
2023-08-02 11:04:04 +09:00

65 lines
1.9 KiB
YAML

---
- name: "Make agent Directory"
ansible.builtin.file:
path: "/etc/datasaker/{{ item }}"
state: directory
recurse: yes
owner: root
group: root
with_items:
- "dsk-log-agent"
- name: "Create agent config"
ansible.builtin.file:
path: "{{ datasaker_host_path }}/dsk-log-agent/agent-config.yml"
state: touch
- name: "Setting dsk-log-agent config"
template:
src: log-agent-config.yml.j2
dest: "{{ datasaker_host_path }}/dsk-log-agent/agent-config.yml"
- name: "Install fluent-bit"
block:
- name: "Install fluent-bit"
shell: curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
rescue:
- name: "Copy RPM files"
copy:
src: "{{ item }}"
dest: "/tmp/"
with_items:
- "{{ role_path }}/files/libpq-13.5-1.el8.x86_64.rpm"
- "{{ role_path }}/files/libpq-devel-13.5-1.el8.x86_64.rpm"
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'
- name: "Install libpq-13.5-1"
command: rpm -ivh /tmp/{{ item }}
with_items:
- libpq-13.5-1.el8.x86_64.rpm
- libpq-devel-13.5-1.el8.x86_64.rpm
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'
- template:
src: fluent-bit-repo.yml.j2
dest: "/etc/yum.repos.d/fluent-bit.repo"
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '7'
- yum:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- fluent-bit
- file:
path: /tmp/{{ item }}
state: absent
with_items:
- libpq-13.5-1.el8.x86_64.rpm
- libpq-devel-13.5-1.el8.x86_64.rpm
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'