Permalink
Browse files

fix ansible systemd and enable address/port setting in ansible vars (#40

)

* fix systemd reload
* enable address/port in ansible role
* remove restarted from enable handler
  • Loading branch information...
antonmatsiuk authored and erebe committed Feb 5, 2019
1 parent a7bc0d4 commit fe90323a1b97e1ace73d0c482721c5689e990c0a
@@ -9,6 +9,8 @@ Role Variables
| Name | Default Value | Description |
| -------------- | ------------- | -----------------------------------|
| `cassandra_exporter_version` | 2.2.0 | Cassandra exporter package version |
| `cassandra_listen_address` | 0.0.0.0 | Cassandra exporter listening address |
| `cassandra_listen_port` | 8080 | Cassandra exporter listening port |
| `cassandra_exporter_binary_url` | https://github.com/criteo/cassandra_exporter/releases/download/{{cassandra_exporter_version}}/cassandra_exporter-{{cassandra_exporter_version}}-all.jar | Cassandra exporter jar download location |
| `cassandra_exporter_config_url` | https://raw.githubusercontent.com/criteo/cassandra_exporter/master/config.yml | Cassandra exporter config download location |
| `cassandra_exporter_user` | cassandra-exp | UNIX user to run the binary |
@@ -2,6 +2,8 @@

cassandra_exporter_version: 2.2.0

cassandra_listen_address: "0.0.0.0"
cassandra_listen_port: "8080"
cassandra_exporter_binary_url: 'https://github.com/criteo/cassandra_exporter/releases/download/{{cassandra_exporter_version}}/cassandra_exporter-{{cassandra_exporter_version}}-all.jar'
cassandra_exporter_config_url: 'https://raw.githubusercontent.com/criteo/cassandra_exporter/master/config.yml'

@@ -1,7 +1,10 @@
---

- name: reenable cassandra exporter service
command: systemctl reenable prometheus-cassandra-exporter.service
systemd:
daemon_reload: yes
enabled: yes
name: prometheus-cassandra-exporter

- name: reinit cassandra exporter
command: initctl reload-configuration
@@ -24,6 +24,7 @@
with_items:
- '{{ cassandra_exporter_root_dir }}'
- '{{ cassandra_exporter_dist_dir }}'
- '{{ cassandra_exporter_config_dir }}'

- name: 'download cassandra exporter binary'
get_url:
@@ -35,6 +36,18 @@
url: '{{ cassandra_exporter_config_url }}'
dest: '{{ cassandra_exporter_config_dir }}/config.yml'

- name: 'set cassandra listen address'
lineinfile:
regexp: "^listenAddress"
dest: "{{ cassandra_exporter_config_dir }}/config.yml"
line: "listenAddress: {{ cassandra_listen_address }}"

- name: 'set cassandra listen port'
lineinfile:
regexp: "^listenPort"
dest: "{{ cassandra_exporter_config_dir }}/config.yml"
line: "listenPort: {{ cassandra_listen_port }}"

- name: 'generate the shell script'
template:
src: cassandra_exporter.sh.j2

0 comments on commit fe90323

Please sign in to comment.