Skip to content

Commit

Permalink
refactor(jmx-exporter): use common conf_dir variable
Browse files Browse the repository at this point in the history
  • Loading branch information
giem-git committed Oct 2, 2024
1 parent 9ff16f0 commit 48e91c6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
10 changes: 1 addition & 9 deletions roles/livy/common/tasks/jmx-exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: Ensure configuration directory
ansible.builtin.file:
path: "{{ livy_jmx_exporter_conf_dir }}"
state: directory
owner: "{{ livy_user }}"
group: "{{ hadoop_group }}"
mode: "750"

- name: Render jmx-exporter config file
ansible.builtin.copy:
content: "{{ jmx_exporter | to_nice_yaml }}"
dest: "{{ livy_jmx_exporter_conf_dir }}/{{ livy_jmx_exporter_conf_file }}"
dest: "{{ livy_root_conf_dir }}/{{ livy_jmx_exporter_conf_file }}"
owner: "{{ livy_user }}"
group: "{{ hadoop_group }}"
mode: "600"
15 changes: 1 addition & 14 deletions roles/livy/server/tasks/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
---
- name: Check if livy config exists
ansible.builtin.stat:
path: "{{ livy_server_conf_dir }}/"
register: livy_config

- name: Backup configuration
ansible.builtin.copy:
src: "{{ livy_server_conf_dir }}/"
Expand All @@ -12,15 +7,7 @@
owner: "{{ livy_user }}"
mode: "755"
remote_src: yes
when: livy_config.stat.exists

- name: Ensure livy config dir exists
ansible.builtin.file:
path: "{{ livy_server_conf_dir }}/"
state: directory
group: root
owner: root
mode: "755"
tags: ['backup', 'never']

- name: Template livy-env.sh
ansible.builtin.template:
Expand Down
8 changes: 8 additions & 0 deletions roles/livy/server/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
mode: "750"
recurse: yes

- name: Create config directory
ansible.builtin.file:
path: "{{ livy_server_conf_dir }}/"
state: directory
group: "{{ hadoop_group }}"
owner: "{{ livy_user }}"
mode: "755"

- name: Template Livy Server service file
ansible.builtin.template:
src: livy-server.service.j2
Expand Down
3 changes: 1 addition & 2 deletions tdp_vars_defaults/livy-spark3/livy-spark3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ livy_conf:
livy.server.recovery.zk-state-store.key-prefix: "livy{{ spark_version }}"

# jmx exporter config
livy_jmx_exporter_conf_dir: "/etc/livy-spark3"
livy_jmx_exporter_conf_file: "jmx-exporter.yml"
exporter_livy_http_port: "{{ exporter_livy_spark3_http_port }}"
jmx_exporter_opts: "{% if 'exporter_jmx' in groups and groups['exporter_jmx'] %}-javaagent:{{ jmx_exporter_install_file }}={{ exporter_livy_spark3_http_port }}:{{ livy_jmx_exporter_conf_dir }}/{{ livy_jmx_exporter_conf_file }}{% endif %}"
jmx_exporter_opts: "{% if 'exporter_jmx' in groups and groups['exporter_jmx'] %}-javaagent:{{ jmx_exporter_install_file }}={{ exporter_livy_spark3_http_port }}:{{ livy_root_conf_dir }}/{{ livy_jmx_exporter_conf_file }}{% endif %}"

jmx_exporter:
startDelaySeconds: 0
Expand Down
3 changes: 1 addition & 2 deletions tdp_vars_defaults/livy/livy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ livy_conf:
livy.server.recovery.zk-state-store.key-prefix: "livy{{ spark_version }}"

# jmx exporter config
livy_jmx_exporter_conf_dir: "/etc/livy"
livy_jmx_exporter_conf_file: "jmx-exporter.yml"
exporter_livy_http_port: "{{ exporter_livy_spark_http_port }}"
jmx_exporter_opts: "{% if 'exporter_jmx' in groups and groups['exporter_jmx'] %}-javaagent:{{ jmx_exporter_install_file }}={{ exporter_livy_spark_http_port }}:{{ livy_jmx_exporter_conf_dir }}/{{ livy_jmx_exporter_conf_file }}{% endif %}"
jmx_exporter_opts: "{% if 'exporter_jmx' in groups and groups['exporter_jmx'] %}-javaagent:{{ jmx_exporter_install_file }}={{ exporter_livy_spark_http_port }}:{{ livy_root_conf_dir }}/{{ livy_jmx_exporter_conf_file }}{% endif %}"
jmx_exporter:
startDelaySeconds: 0
lowercaseOutputName: false
Expand Down

0 comments on commit 48e91c6

Please sign in to comment.