Created
March 24, 2023 16:17
-
-
Save blockloop/1a0ecc8adcc5845f35d51fae6a62e61f to your computer and use it in GitHub Desktop.
gpt playground
This file contains 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
--- | |
- name: Install Gostatsd and Carbon Relay NG | |
hosts: all | |
become: true | |
handlers: | |
- name: Restart Carbon Relay NG | |
ansible.builtin.systemd: | |
name: carbon-relay-ng | |
tasks: | |
- name: Install dependencies | |
ansible.builtin.apt: | |
name: | |
- build-essential | |
- git | |
- libtool | |
- automake | |
- autoconf | |
- libyaml-dev | |
- libzmq3-dev | |
- pkg-config | |
- python | |
- python-dev | |
- python-pip | |
state: present | |
- name: Install Go | |
become: true | |
vars: | |
go_version: "1.20.2" | |
go_arch: "amd64" | |
go_url: "https://golang.org/dl/go{{ go_version }}.linux-{{ go_arch }}.tar.gz" | |
go_path: "/usr/local/go" | |
block: | |
- name: Download Go | |
ansible.builtin.get_url: | |
mode: 0644 | |
url: "{{ go_url }}" | |
dest: /tmp/go.tar.gz | |
- name: Extract Go | |
ansible.builtin.unarchive: | |
src: /tmp/go.tar.gz | |
dest: /usr/local | |
- name: Set Go environment variables | |
ansible.builtin.blockinfile: | |
path: /etc/profile | |
backup: true | |
insertbefore: EOF | |
create: false | |
block: | | |
export PATH="$PATH:/usr/local/go/bin" | |
export GOPATH="$HOME/go" | |
export PATH="$PATH:$GOPATH/bin" | |
- name: Create GOPATH directory | |
ansible.builtin.file: | |
path: "{{ item }}" | |
state: directory | |
mode: '0755' | |
with_items: | |
- "/tmp/go" | |
- "/tmp/go/src" | |
- "/tmp/go/bin" | |
- "/tmp/go/pkg" | |
- name: Install Gostatsd | |
become: true | |
vars: | |
gostatsd_version: "v0.13.1" | |
gostatsd_path: "/tmp/go/src/github.com/uber-go/gostatsd" | |
block: | |
- name: Clone Gostatsd repository | |
ansible.builtin.git: | |
repo: "https://github.com/uber-go/gostatsd.git" | |
dest: "{{ gostatsd_path }}" | |
version: "{{ gostatsd_version }}" | |
- name: Build Gostatsd | |
ansible.builtin.shell: > | |
cd {{ gostatsd_path }} && /usr/local/go/bin/go build -o gostatsd -i . | |
args: | |
creates: "{{ gostatsd_path }}/gostatsd" | |
environment: | |
GOPATH: "/tmp/go" | |
- name: Install Carbon Relay NG | |
become: true | |
ansible.builtin.apt_repository: | |
repo: "deb https://packagecloud.io/raintank/raintank/ubuntu/ {{ ansible_distribution_release }} main" | |
state: present | |
filename: raintank.list | |
keyserver: keyserver.ubuntu.com | |
key_id: 'B68D652E' | |
notify: Restart Carbon Relay NG | |
- name: Install Carbon Relay NG Package | |
become: true | |
ansible.builtin.package: | |
name: | |
- carbon-relay-ng | |
state: present | |
- name: Configure Carbon Relay NG | |
ansible.builtin.template: | |
mode: 0640 | |
owner: carbon-relay | |
src: templates/carbon-relay-ng.conf.j2 | |
dest: /etc/carbon-relay-ng/carbon-relay-ng.conf | |
notify: Restart Carbon Relay NG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment