Skip to content

Commit

Permalink
fix ansible systemd and enable address/port setting in ansible vars (#40
Browse files Browse the repository at this point in the history
)

* 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 fe90323
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ansible/roles/ansible-cassandra-exporter/README.md
Expand Up @@ -9,6 +9,8 @@ Role Variables
| Name | Default Value | Description | | Name | Default Value | Description |
| -------------- | ------------- | -----------------------------------| | -------------- | ------------- | -----------------------------------|
| `cassandra_exporter_version` | 2.2.0 | Cassandra exporter package version | | `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_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_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 | | `cassandra_exporter_user` | cassandra-exp | UNIX user to run the binary |
Expand Down
2 changes: 2 additions & 0 deletions ansible/roles/ansible-cassandra-exporter/defaults/main.yml
Expand Up @@ -2,6 +2,8 @@


cassandra_exporter_version: 2.2.0 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_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' cassandra_exporter_config_url: 'https://raw.githubusercontent.com/criteo/cassandra_exporter/master/config.yml'


Expand Down
5 changes: 4 additions & 1 deletion ansible/roles/ansible-cassandra-exporter/handlers/main.yml
@@ -1,7 +1,10 @@
--- ---


- name: reenable cassandra exporter service - 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 - name: reinit cassandra exporter
command: initctl reload-configuration command: initctl reload-configuration
Expand Down
13 changes: 13 additions & 0 deletions ansible/roles/ansible-cassandra-exporter/tasks/main.yml
Expand Up @@ -24,6 +24,7 @@
with_items: with_items:
- '{{ cassandra_exporter_root_dir }}' - '{{ cassandra_exporter_root_dir }}'
- '{{ cassandra_exporter_dist_dir }}' - '{{ cassandra_exporter_dist_dir }}'
- '{{ cassandra_exporter_config_dir }}'


- name: 'download cassandra exporter binary' - name: 'download cassandra exporter binary'
get_url: get_url:
Expand All @@ -35,6 +36,18 @@
url: '{{ cassandra_exporter_config_url }}' url: '{{ cassandra_exporter_config_url }}'
dest: '{{ cassandra_exporter_config_dir }}/config.yml' 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' - name: 'generate the shell script'
template: template:
src: cassandra_exporter.sh.j2 src: cassandra_exporter.sh.j2
Expand Down

0 comments on commit fe90323

Please sign in to comment.