homework 8.4: partially complete

This commit is contained in:
2022-08-01 10:45:28 +07:00
parent fbece247aa
commit 0115945805
10 changed files with 201 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
inventory/prod.yml
files/*

View File

@@ -0,0 +1,8 @@
---
clickhouse_version: "22.3.3.44"
clickhouse_dbs_custom:
- { "name": logs }
clickhouse_packages:
- clickhouse-client
- clickhouse-server
- clickhouse-common-sta

View File

@@ -0,0 +1,6 @@
---
nginx_username: dannc
lighthouse_vcs: https://github.com/VKCOM/lighthouse.git
lighthouse_vcs_version: d701335c25cd1bb9b5155711190bad8ab852c2ce
lighthouse_location: /var/www/lighthouse
lighthouse_access_log_name: lighthouse

View File

@@ -0,0 +1,6 @@
---
vector_version: 0.23.0
vector_config_dir: /var/lib/vector
vector_config:
data_dir: /var/lib/vector
# todo добавить конфигурацию https://vector.dev/docs/reference/configuration/

View File

@@ -0,0 +1,13 @@
---
clickhouse:
hosts:
clickhouse-01:
ansible_host: <IP_here>
vector:
hosts:
vector-01:
ansible_host: <IP_here>
lighthouse:
hosts:
lighthouse-01:
ansible_host: <IP_here>

View File

@@ -0,0 +1,9 @@
---
- src: git@github.com:AlexeySetevoi/ansible-clickhouse.git
scm: git
version: "1.13"
name: clickhouse
- src: git@github.com:Dannecron/netology-devops-ansible-lighthouse.git
scm: git
version: "1.0.1"
name: lighthouse

View File

@@ -0,0 +1,78 @@
---
- name: clickhouse
hosts: clickhouse
roles:
- clickhouse
tags:
- clickhouse
- name: lighthouse
hosts: lighthouse
roles:
- lighthouse
tags:
- lighthouse
- name: vector
hosts: vector
tasks:
- name: vector | install archive manager
become: true
ansible.builtin.yum:
name:
- tar
- name: vector | get distrib
ansible.builtin.get_url:
url: "https://packages.timber.io/vector/{{ vector_version }}/vector-{{ vector_version }}-x86_64-unknown-linux-musl.tar.gz"
dest: "./vector-{{ vector_version }}-x86_64-unknown-linux-musl.tar.gz"
mode: "755"
- name: vector | unpack distrib
ansible.builtin.unarchive:
src: "./vector-{{ vector_version }}-x86_64-unknown-linux-musl.tar.gz"
dest: "./"
remote_src: true
- name: vector | install
become: true
ansible.builtin.copy:
src: "vector-x86_64-unknown-linux-musl/bin/vector"
dest: "/usr/local/bin/"
remote_src: true
mode: "755"
- name: vector | check installed version
ansible.builtin.command:
cmd: vector --version
register: result
changed_when:
- 'vector_version not in result.stdout'
tags:
- vector_check_version
- name: vector | create data dir
become: true
ansible.builtin.file:
mode: "755"
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
path: "{{ vector_config_dir }}"
state: "directory"
- name: vector | template config
ansible.builtin.template:
src: "templates/vector.config.j2"
dest: "{{ vector_config_dir }}/vector.yaml"
mode: "755"
- name: vector | register as service
become: true
ansible.builtin.template:
src: "templates/vector.service.j2"
dest: "/etc/systemd/system/vector.service"
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
mode: "0644"
backup: true
- name: vector | start service
become: true
ansible.builtin.service:
name: vector
state: started
daemon_reload: true
tags:
- vector