Created
January 16, 2019 09:16
-
-
Save foamdino/d9c09bb60ee043e17897a7fa91801a33 to your computer and use it in GitHub Desktop.
Prometheus ansible role
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - debug: msg="Deploying prometheus and m3coordinator" | |
| - name: Fetch m3db | |
| shell: wget https://github.com/m3db/m3/releases/download/v0.4.8/m3_0.4.8_linux_amd64.tar.gz -O /tmp/m3_0.4.8_linux_amd64.tar.gz | |
| - name: Make directory if not present | |
| file: path=/opt/m3 state=directory | |
| - name: Make directory if not present | |
| file: path=/var/lib/m3db/m3kv state=directory | |
| - name: Copy binaries | |
| shell: tar -C /opt/m3 -zxvf /tmp/m3_0.4.8_linux_amd64.tar.gz --strip-components=1 | |
| - name: Fetch prometheus | |
| shell: wget https://github.com/prometheus/prometheus/releases/download/v2.5.0/prometheus-2.5.0.linux-amd64.tar.gz -O /tmp/prometheus-2.5.0.linux-amd64.tar.gz | |
| - name: Make directory if not present | |
| file: path=/opt/prometheus state=directory | |
| - name: Copy binaries | |
| shell: tar -C /opt/prometheus -zxvf /tmp/prometheus-2.5.0.linux-amd64.tar.gz --strip-components=1 | |
| - name: Update prometheus service config for consul | |
| template: src=prometheus-service-definition.json.j2 dest=/opt/consul/conf/prometheus.json owner=consul | |
| - name: Update m3coordinator service config for consul | |
| template: src=m3coordinator-service-definition.json.j2 dest=/opt/consul/conf/m3coordinator.json owner=consul | |
| - name: Reload consul config | |
| command: /opt/consul/consul reload | |
| - name: Copy m3coordinator service file | |
| copy: src=m3coordinator.service dest=/etc/systemd/system/ owner=root | |
| - name: Copy prometheus service file | |
| copy: src=prometheus.service dest=/etc/systemd/system/ owner=root | |
| - name: Load the m3coordinator system service | |
| command: systemctl enable /etc/systemd/system/m3coordinator.service | |
| notify: reload systemd | |
| - name: Load the prometheus ystem service | |
| command: systemctl enable /etc/systemd/system/prometheus.service | |
| notify: reload systemd | |
| - name: Reload sysctl config | |
| command: sysctl --system | |
| - name: Copy m3coordinator config | |
| template: src=m3coordinator-cluster.yml.j2 dest=/opt/m3/m3coordinator-cluster.yml owner=root | |
| notify: restart m3coordinator | |
| - name: Copy prometheus config | |
| template: src=prometheus-config.yml.j2 dest=/opt/prometheus/prometheus.yml owner=root | |
| notify: restart prometheus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment