diff --git a/README.md b/README.md index 2c12a18..4e0472c 100644 --- a/README.md +++ b/README.md @@ -27,16 +27,6 @@ Collection includes the following roles: See [cluster](playbooks/cluster.yml) and [single](playbooks/single.yml) playbooks for examples of how to use these roles. -Deprecated roles: - -- [docker](./roles/docker) - role for docker installation -- [load_balancer](./roles/load_balancer) - nginx setup for load balancing between select and insert nodes -- [cluster](./roles/cluster) - installs and configures VictoriaMetrics cluster running in docker - -These roles are deprecated in favor of roles for each component. They are still available in the collection, but will be -removed in future releases. -Note that per-component roles are using binary releases of VictoriaMetrics, while cluster role is using docker images. - ## Cluster deployment Cluster deployment example is available in [playbooks/cluster.yml](./playbooks/cluster.yml). diff --git a/galaxy.yml b/galaxy.yml index cd5c00e..09e8b00 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -4,8 +4,7 @@ name: "cluster" version: "0.0.0" readme: "README.md" authors: - - "Zakhar Bessarab " - - "bykvaadm " + - "Zakhar Bessarab " license: - "Apache-2.0" tags: diff --git a/roles/cluster/.yamllint b/roles/cluster/.yamllint deleted file mode 100644 index 8827676..0000000 --- a/roles/cluster/.yamllint +++ /dev/null @@ -1,33 +0,0 @@ ---- -# Based on ansible-lint config -extends: default - -rules: - braces: - max-spaces-inside: 1 - level: error - brackets: - max-spaces-inside: 1 - level: error - colons: - max-spaces-after: -1 - level: error - commas: - max-spaces-after: -1 - level: error - comments: disable - comments-indentation: disable - document-start: disable - empty-lines: - max: 3 - level: error - hyphens: - level: error - indentation: disable - key-duplicates: enable - line-length: disable - new-line-at-end-of-file: disable - new-lines: - type: unix - trailing-spaces: disable - truthy: disable diff --git a/roles/cluster/README.md b/roles/cluster/README.md deleted file mode 100644 index 18efd79..0000000 --- a/roles/cluster/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# VictoriaMetrics cluster role - -Installs and configures VictoriaMetrics cluster running in docker. - -Containers are managed as systemd units. - -*Deprecation notice*: this role is deprecated in favor of roles for each component. It is still available in the collection, but will be removed in future releases. - -## Requirements -- Docker - -## Example Playbook -``` ---- -- hosts: victoria_cluster - collections: - - victoriametrics.cluster - become: true - roles: - - victoriametrics.cluster.docker # replace this with a role that installs Docker in your environment - - victoriametrics.cluster.cluster -``` - -## Parameters - -The following table lists the configurable parameters of the playbook and their default values. - -> Important - `vmstorage_group` parameter should refer name of group in ansible inventory. -> If this parameter is not set correctly you'll see error like the following -> `AnsibleUndefinedVariable: 'dict object' has no attribute 'victoria_cluster'` - -| Parameter | Description | Default | -|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------| -| `vmstorage_group` | Group of servers with victoria metrics storage role. | `victoria_storage` | -| `vmstorage_host_path` | Host path to database | `/var/lib/victoriametrics` | -| `vmstorage_docker_version` | VM storage docker tag override. By default `vm_docker_image_tag` is used | `nil` | -| `vmstorage_exec_stop` | VM storage systemd ExecStop override. By default `exec_stop` is used | `nil` | -| `vmstorage_exec_start_post` | VM storage systemd ExecStartStop override. By default `exec_start_post` is used | `nil` | -| `vmstorage_params` | VM storage params passed to vm binary | type: list. see `defaults/main.yml` | -| `vminsert_docker_version` | VM insert docker tag override. By default `vm_docker_image_tag` is used | `nil` | -| `vminsert_exec_stop` | VM insert systemd ExecStop override. By default `exec_start_post` is used | `nil` | -| `vminsert_exec_start_post` | VM insert systemd ExecStartStop override. By default `exec_start_post` is used | `nil` | -| `vminsert_params` | VM insert params passed to vm binary | type: list. see `defaults/main.yml` | -| `vmselect_docker_version` | VM select docker tag override. By default `vm_docker_image_tag` is used | `nil` | -| `vmselect_exec_stop` | VM select systemd ExecStop override. By default `exec_start_post` is used | `nil` | -| `vmselect_exec_start_post` | VM select systemd ExecStartStop override. By default `exec_start_post` is used | `nil` | -| `vmselect_params` | VM select params passed to vm binary | type: list. see `defaults/main.yml` | -| `vm_docker_image_tag` | Default docker tag for all images | `latest` | -| `vm_conf_host_path` | Host path to configuration files | `/etc/victoriametrics` | -| `environment_file_path` | Path to directory with environment file for systemd EnvironmentFile directive | `/etc/default/vm_environment` | -| `use_environment` | Variable that controls whether pass parameters to vm binary, or to create environment file. or both of them. possible values: true, false, both. | `false` | -| `exec_stop` | Systemd additional ExecStop directive | `nil` | -| `exec_start_post` | Systemd additional ExecStartStop directive | `nil` | -| `systemd_environment_file` | Systemd additional EnvironmentFile directive | `nil` | -| `if_name` | Interface name to gather ip addresses of storage nodes | defaults to first interface | diff --git a/roles/cluster/defaults/main.yml b/roles/cluster/defaults/main.yml deleted file mode 100644 index fb2259a..0000000 --- a/roles/cluster/defaults/main.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -# Docker images defaults -vm_docker_image_tag: v1.101.0-cluster -vminsert_docker_repository: victoriametrics/vminsert -vmselect_docker_repository: victoriametrics/vmselect -vmstorage_docker_repository: victoriametrics/vmstorage -## docker image overrides for particular components -# vmstorage_docker_version: "" -# vminsert_docker_version: "" -# vmselect_docker_version: "" - -# Systemd settings -environment_file_path: "/etc/default" -systemd_environment_file: "" -exec_stop: "" -## ExecStop overrides for particular components -# vmstorage_exec_stop: "" -# vminsert_exec_stop: "" -# vmselect_exec_stop: "" -exec_start_post: "" -## ExecStartPost overrides for particular components -# vmstorage_exec_start_post: "" -# vminsert_exec_start_post: "" -# vmselect_exec_start_post: "" - -# Group of servers with victoria metrics storage role. Used to collect ip addresses for vmselect and vminsert -vmstorage_group: cluster - -# host defaults -vmstorage_host_path: /var/lib/victoriametrics -vm_conf_host_path: /etc/victoriametrics - -######################## -##### PARAMS BLOCK ##### -######################## -# Current limitations: -# 1) do not pass storageNode param anywhere. it is generated automatically. -# 2) u cannot use set environment usage per component. variable defines behavior for all components. - -# possible values: true, false, both -use_environment: false - -# VM storage defaults -vmstorage_params: [] - -# VM insert defaults -vminsert_params: -- param: replicationFactor - value: 1 - -# VM select defaults -vmselect_params: -- param: dedup.minScrapeInterval - value: "1ms" - -# interface to gather ip address -if_name: "{{ vars['ansible_default_ipv4'].interface }}" diff --git a/roles/cluster/handlers/main.yml b/roles/cluster/handlers/main.yml deleted file mode 100644 index 8c924bf..0000000 --- a/roles/cluster/handlers/main.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Restart service victoria-storage - ansible.builtin.systemd: - name: victoria-storage - daemon_reload: yes - enabled: yes - state: restarted - -- name: Restart service victoria-insert - ansible.builtin.systemd: - name: victoria-insert - daemon_reload: yes - enabled: yes - state: restarted - -- name: Restart service victoria-select - ansible.builtin.systemd: - name: victoria-select - daemon_reload: yes - enabled: yes - state: restarted diff --git a/roles/cluster/molecule/default/converge.yml b/roles/cluster/molecule/default/converge.yml deleted file mode 100644 index ff4f838..0000000 --- a/roles/cluster/molecule/default/converge.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: Ensure docker - become: true - hosts: all - roles: [ docker ] - -- name: Ensure victoria_storage - become: true - hosts: all - roles: [ cluster ] - vars: - vm_role: victoria-storage - if_name: enp0s8 - tags: [ 'vm_storage', 'cluster' ] - -- name: Ensure victoria_select - become: true - hosts: all - roles: [ cluster ] - vars: - vm_role: victoria-select - if_name: enp0s8 - tags: [ 'vm_select', 'cluster' ] - -- name: Ensure victoria_insert - become: true - hosts: all - roles: [ cluster ] - vars: - vm_role: victoria-insert - if_name: enp0s8 - tags: [ 'vm_insert', 'cluster' ] diff --git a/roles/cluster/molecule/default/molecule.yml b/roles/cluster/molecule/default/molecule.yml deleted file mode 100644 index 817c40a..0000000 --- a/roles/cluster/molecule/default/molecule.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -dependency: - name: galaxy - -driver: - name: vagrant - -lint: | - set -ex - yamllint . - ansible-lint . - -platforms: - - name: victoria-cluster-bionic-1 - box: ubuntu/bionic64 - memory: 2048 - cpus: 1 - groups: - - cluster - interfaces: - - auto_config: true - network_name: private_network - type: dhcp - - - name: victoria-cluster-bionic-2 - box: ubuntu/bionic64 - memory: 2048 - cpus: 1 - groups: - - cluster - interfaces: - - auto_config: true - network_name: private_network - type: dhcp - - - name: victoria-cluster-bionic-3 - box: ubuntu/bionic64 - memory: 2048 - cpus: 1 - groups: - - cluster - interfaces: - - auto_config: true - network_name: private_network - type: dhcp - -provisioner: - name: ansible - -verifier: - name: ansible - enabled: True diff --git a/roles/cluster/molecule/default/tests/test_defaut.yml b/roles/cluster/molecule/default/tests/test_defaut.yml deleted file mode 100644 index 362eb9a..0000000 --- a/roles/cluster/molecule/default/tests/test_defaut.yml +++ /dev/null @@ -1,20 +0,0 @@ -port: - tcp:8480: - title: Ensure vminsert is listening - listening: true - - tcp:8481: - title: Ensure vmselect is listening - listening: true - - tcp:8482: - title: Ensure vmstorage is listening - listening: true - - tcp:8400: - title: Ensure vmstorage is listening - listening: true - - tcp:8401: - title: Ensure vmstorage is listening - listening: true diff --git a/roles/cluster/molecule/default/verify.yml b/roles/cluster/molecule/default/verify.yml deleted file mode 100644 index 0d0610e..0000000 --- a/roles/cluster/molecule/default/verify.yml +++ /dev/null @@ -1,93 +0,0 @@ ---- -# Molecule Goss Tests - -- name: Verify - hosts: all - become: true - vars: - goss_version: v0.3.10 - goss_arch: amd64 - goss_bin: /usr/local/bin/goss - goss_sha256sum: 150f25495ca0d1d4fd2ef8d0e750dbd767a15e9a522505f99b61dd1dd40a76d4 - goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" - goss_test_directory: /tmp/molecule/goss - goss_format: documentation - tasks: - - name: Download and install Goss - ansible.builtin.get_url: - url: "{{ goss_url }}" - dest: "{{ goss_bin }}" - sha256sum: "{{ goss_sha256sum }}" # noqa: args[module] - mode: "u=rwx,go=rx" - register: download_goss - until: download_goss is succeeded - retries: 3 - - - name: Create Molecule directory for test files - ansible.builtin.file: - path: "{{ goss_test_directory }}" - state: directory - mode: "0755" - - - name: Find Goss tests on localhost - ansible.builtin.find: - paths: "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}" - patterns: - - "test[-.\\w]*.yml" - - "test_host_{{ ansible_hostname }}[-.\\w]*.yml" - excludes: - - "test_host_(?!{{ ansible_hostname }})[-.\\w]*.yml" - use_regex: true - delegate_to: localhost - register: test_files - changed_when: false - become: false - - - name: Debug - ansible.builtin.debug: - msg: "{{ test_files.files }}" - verbosity: 3 - - - name: Copy Goss tests to remote - ansible.builtin.copy: - src: "{{ item.path }}" - dest: "{{ goss_test_directory }}/{{ item.path | basename }}" - mode: "0644" - with_items: - - "{{ test_files.files }}" - loop_control: - label: "{{ item.path | basename }}" - - - name: Register test files - ansible.builtin.find: - paths: - - "{{ goss_test_directory }}" - patterns: - - "test_*.yml" - register: test_files - - - name: Run verify. - when: test_files is succeeded - block: - - name: Execute Goss tests # noqa: no-changed-when - ansible.builtin.command: "{{ goss_bin }} -g {{ item }} validate --format {{ goss_format }}" - register: test_results - with_items: "{{ test_files.files | map(attribute='path') | list }}" - loop_control: - label: "{{ item | basename }}" - failed_when: false - - - name: Display details about the Goss results - ansible.builtin.debug: - msg: "{{ item.stdout_lines }}" - with_items: "{{ test_results.results }}" - loop_control: - label: "{{ item[item.ansible_loop_var] | basename }}" - - - name: Fail when tests fail - ansible.builtin.fail: - msg: "Goss failed to validate" - when: item.rc != 0 - with_items: "{{ test_results.results }}" - loop_control: - label: "{{ item[item.ansible_loop_var] | basename }}" diff --git a/roles/cluster/tasks/main.yml b/roles/cluster/tasks/main.yml deleted file mode 100644 index 3633a57..0000000 --- a/roles/cluster/tasks/main.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- name: Gather facts - ansible.builtin.setup: - -- name: Ensure vm_role for node is set - ansible.builtin.assert: - fail_msg: "Make sure to set 'vm_role', allowed values are: 'victoria-insert', 'victoria-select', 'victoria-storage" - that: - - vm_role is defined - - vm_role in ['victoria-insert', 'victoria-select', 'victoria-storage'] - -- name: Create data directory - ansible.builtin.file: - state: directory - path: "{{ item }}" - owner: root - group: root - mode: 0755 - with_items: - - "{{ vmstorage_host_path }}" - - "{{ vm_conf_host_path }}" - -- name: "Ensure unit file for {{ vm_role }} " - notify: "Restart service {{ vm_role }}" - ansible.builtin.template: - src: "{{ vm_role }}.service.j2" - dest: "/etc/systemd/system/{{ vm_role }}.service" - mode: 0644 - -- name: "Ensure environment_file for {{ vm_role }}" - ansible.builtin.template: - src: vm_environment.j2 - dest: "{{ environment_file_path }}/{{ vm_role }}" - mode: 0644 - notify: "Restart service {{ vm_role }}" - when: use_environment | bool - -- name: Execute handlers - ansible.builtin.meta: flush_handlers - -- name: Start services - ansible.builtin.systemd: - name: "{{ vm_role }}" - daemon_reload: yes - enabled: yes - state: started diff --git a/roles/cluster/templates/victoria-insert.service.j2 b/roles/cluster/templates/victoria-insert.service.j2 deleted file mode 100644 index a01870c..0000000 --- a/roles/cluster/templates/victoria-insert.service.j2 +++ /dev/null @@ -1,40 +0,0 @@ -[Unit] -Requires=docker.service -After=docker.service -[Service] -EnvironmentFile=-{{ systemd_environment_file }} -ExecStartPre=-/usr/bin/docker rm --force %N -ExecStart=/usr/bin/docker run \ - --name=%N \ - --rm=true \ - --network=host \ - --stop-timeout=30 \ -{% if use_environment != false %} - --env-file {{ environment_file_path }}/{{ vm_role }} \ -{% endif %} - {{ vminsert_docker_repository }}:{{ vminsert_docker_version | default(vm_docker_image_tag) }} \ -{% if use_environment == "true" %} - -envflag.enable=true -{% else %} -{% for item in vminsert_params %} - -{{ item.param }}={{ item.value }} \ -{% endfor %} -{% for host in groups[vmstorage_group] %} - -storageNode={{ hostvars[host]['ansible_'~if_name].ipv4.address }}:8400 \ -{% endfor %} -{% if use_environment == "false" %} - -envflag.enable=false -{% else %} - -envflag.enable=true -{% endif %} -{% endif %} - -ExecStartPost={{ vminsert_exec_start_post | default(exec_start_post) }} -ExecStop={{ vminsert_exec_stop | default(exec_stop) }} -ExecStop=-/usr/bin/docker stop %N -Restart=always -StartLimitInterval=0 -RestartSec=10 -KillMode=process -[Install] -WantedBy=multi-user.target diff --git a/roles/cluster/templates/victoria-select.service.j2 b/roles/cluster/templates/victoria-select.service.j2 deleted file mode 100644 index 433f5c3..0000000 --- a/roles/cluster/templates/victoria-select.service.j2 +++ /dev/null @@ -1,40 +0,0 @@ -[Unit] -Requires=docker.service -After=docker.service -[Service] -EnvironmentFile=-{{ systemd_environment_file }} -ExecStartPre=-/usr/bin/docker rm --force %N -ExecStart=/usr/bin/docker run \ - --name=%N \ - --rm=true \ - --network=host \ - --stop-timeout=30 \ -{% if use_environment != false %} - --env-file {{ environment_file_path }}/{{ vm_role }} \ -{% endif %} - {{ vmselect_docker_repository }}:{{ vmselect_docker_version | default(vm_docker_image_tag) }} \ -{% if use_environment == "true" %} - -envflag.enable=true -{% else %} -{% for item in vmselect_params %} - -{{ item.param }}={{ item.value }} \ -{% endfor %} -{% for host in groups[vmstorage_group] %} - -storageNode={{ hostvars[host]['ansible_'~if_name].ipv4.address }}:8401 \ -{% endfor %} -{% if use_environment == "false" %} - -envflag.enable=false -{% else %} - -envflag.enable=true -{% endif %} -{% endif %} - -ExecStartPost={{ vmselect_exec_start_post | default(exec_start_post) }} -ExecStop={{ vmselect_exec_stop | default(exec_stop) }} -ExecStop=-/usr/bin/docker stop %N -Restart=always -StartLimitInterval=0 -RestartSec=10 -KillMode=process -[Install] -WantedBy=multi-user.target diff --git a/roles/cluster/templates/victoria-storage.service.j2 b/roles/cluster/templates/victoria-storage.service.j2 deleted file mode 100644 index c1c5cc8..0000000 --- a/roles/cluster/templates/victoria-storage.service.j2 +++ /dev/null @@ -1,38 +0,0 @@ -[Unit] -Requires=docker.service -After=docker.service -[Service] -EnvironmentFile=-{{ systemd_environment_file }} -ExecStartPre=-/usr/bin/docker rm --force %N -ExecStart=/usr/bin/docker run \ - --name=%N \ - --rm=true \ - --network=host \ - --stop-timeout=30 \ - --volume={{ vmstorage_host_path }}:/vmstorage-data:rw \ -{% if use_environment != false %} - --env-file {{ environment_file_path }}/{{ vm_role }} \ -{% endif %} - {{ vmstorage_docker_repository }}:{{ vmstorage_docker_version | default(vm_docker_image_tag) }} \ -{% if use_environment == "true" %} - -envflag.enable=true -{% else %} -{% for item in vmstorage_params %} - -{{ item.param }}={{ item.value }} \ -{% endfor %} -{% if use_environment == "false" %} - -envflag.enable=false -{% else %} - -envflag.enable=true -{% endif %} -{% endif %} - -ExecStartPost={{ vmstorage_exec_start_post | default(exec_start_post) }} -ExecStop={{ vmstorage_exec_stop | default(exec_stop) }} -ExecStop=-/usr/bin/docker stop %N -Restart=always -StartLimitInterval=0 -RestartSec=10 -KillMode=process -[Install] -WantedBy=multi-user.target diff --git a/roles/cluster/templates/vm_environment.j2 b/roles/cluster/templates/vm_environment.j2 deleted file mode 100644 index 3405a2f..0000000 --- a/roles/cluster/templates/vm_environment.j2 +++ /dev/null @@ -1,15 +0,0 @@ -{% if vm_role == "victoria-storage" %} -{% for item in vmstorage_params %} -{{ item.param | replace(".","_") }}={{ item.value }} -{% endfor %} -{% elif vm_role == "victoria-select" %} -{% for item in vmselect_params %} -{{ item.param | replace(".","_") }}={{ item.value }} -{% endfor %} -storageNode={% for host in groups[vmstorage_group] %}{{ hostvars[host]['ansible_'~if_name].ipv4.address }}:8401{% if not loop.last %},{% endif %}{% endfor %} -{% elif vm_role == "victoria-insert" %} -{% for item in vminsert_params %} -{{ item.param | replace(".","_") }}={{ item.value }} -{% endfor %} -storageNode={% for host in groups[vmstorage_group] %}{{ hostvars[host]['ansible_'~if_name].ipv4.address }}:8400{% if not loop.last %},{% endif %}{% endfor %} -{% endif %} diff --git a/roles/docker/.ansible-lint b/roles/docker/.ansible-lint deleted file mode 100644 index 2641f8f..0000000 --- a/roles/docker/.ansible-lint +++ /dev/null @@ -1,2 +0,0 @@ -skip_list: - - syntax-check[specific] diff --git a/roles/docker/README.md b/roles/docker/README.md deleted file mode 100644 index d24add7..0000000 --- a/roles/docker/README.md +++ /dev/null @@ -1 +0,0 @@ -# Docker role \ No newline at end of file diff --git a/roles/docker/files/daemon.json b/roles/docker/files/daemon.json deleted file mode 100644 index a931797..0000000 --- a/roles/docker/files/daemon.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "exec-opts": [ - "native.cgroupdriver=systemd" - ], - "log-driver": "json-file", - "log-opts": { - "max-size": "100m" - }, - "storage-driver": "overlay2" -} \ No newline at end of file diff --git a/roles/docker/files/docker-ce.repo b/roles/docker/files/docker-ce.repo deleted file mode 100644 index e45af62..0000000 --- a/roles/docker/files/docker-ce.repo +++ /dev/null @@ -1,83 +0,0 @@ -[docker-ce-stable] -name=Docker CE Stable - $basearch -baseurl=https://download.docker.com/linux/centos/7/$basearch/stable -enabled=1 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-stable-debuginfo] -name=Docker CE Stable - Debuginfo $basearch -baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-stable-source] -name=Docker CE Stable - Sources -baseurl=https://download.docker.com/linux/centos/7/source/stable -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-edge] -name=Docker CE Edge - $basearch -baseurl=https://download.docker.com/linux/centos/7/$basearch/edge -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-edge-debuginfo] -name=Docker CE Edge - Debuginfo $basearch -baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-edge-source] -name=Docker CE Edge - Sources -baseurl=https://download.docker.com/linux/centos/7/source/edge -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-test] -name=Docker CE Test - $basearch -baseurl=https://download.docker.com/linux/centos/7/$basearch/test -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-test-debuginfo] -name=Docker CE Test - Debuginfo $basearch -baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-test-source] -name=Docker CE Test - Sources -baseurl=https://download.docker.com/linux/centos/7/source/test -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-nightly] -name=Docker CE Nightly - $basearch -baseurl=https://download.docker.com/linux/centos/7/$basearch/nightly -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-nightly-debuginfo] -name=Docker CE Nightly - Debuginfo $basearch -baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/nightly -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg - -[docker-ce-nightly-source] -name=Docker CE Nightly - Sources -baseurl=https://download.docker.com/linux/centos/7/source/nightly -enabled=0 -gpgcheck=1 -gpgkey=https://download.docker.com/linux/centos/gpg diff --git a/roles/docker/handlers/main.yaml b/roles/docker/handlers/main.yaml deleted file mode 100644 index fb172db..0000000 --- a/roles/docker/handlers/main.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Restart docker daemon - ansible.builtin.systemd: - daemon_reload: yes - name: docker - state: restarted diff --git a/roles/docker/tasks/main.yaml b/roles/docker/tasks/main.yaml deleted file mode 100644 index b300990..0000000 --- a/roles/docker/tasks/main.yaml +++ /dev/null @@ -1,61 +0,0 @@ -- name: Install Docker into Debian like system - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - block: - - name: Install packages - ansible.builtin.apt: - name: - - apt-transport-https - - ca-certificates - - curl - - gnupg2 - - software-properties-common - state: present - update_cache: yes - cache_valid_time: 3600 - - - name: Install repo key - ansible.builtin.apt_key: - url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg - state: present - - - name: Add docker repo - ansible.builtin.apt_repository: - repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable - state: present - - - name: Install docker - ansible.builtin.apt: - name: - - docker-ce - - docker-ce-cli - - containerd.io - update_cache: yes - cache_valid_time: 3600 - -- name: Install Docker into RedHat like system - when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' - block: - - name: Add Docker repo - ansible.builtin.copy: - src: docker-ce.repo - dest: /etc/yum.repos.d/docker-ce.repo - mode: 0644 - - - name: Enable Docker Edge repo - community.general.files.ini_file: - dest: /etc/yum.repos.d/docker-ce.repo - section: 'docker-ce-edge' - option: enabled - value: 0 - - - name: Install Docker - ansible.builtin.yum: - name: docker-ce - update_cache: yes - -- name: Put docker config - ansible.builtin.copy: - src: daemon.json - dest: /etc/docker/daemon.json - mode: 0644 - notify: Restart docker daemon diff --git a/roles/load_balancer/README.md b/roles/load_balancer/README.md deleted file mode 100644 index c3d9803..0000000 --- a/roles/load_balancer/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# LoadBalancer role - -Configures load balancing between `vmselect` and `vminsert` instances. - -Hosts are discovered from ansible inventory groups, naming configured by the following vars `vminsert_group` and `vmselect_group` - -*Deprecation notice*: this role is deprecated in favor vmauth. It is still available in the collection, but will be removed in future releases. - -## Parameters - -The following table lists the configurable parameters of the playbook and their default values. - -| Parameter | Description | Default | -|------------------|---------------------------------------------------------------------------------------------------|------------------------------------------------| -| `vmselect_group` | group of servers with victoria select select role. Used to collect ip addresses for load-balancer | `victoria_storage` | -| `vminsert_group` | group of servers with victoria select insert role. Used to collect ip addresses for load-balancer | `victoria_storage` | -| `if_name` | # interface to gather ip address | `{{ vars['ansible_default_ipv4'].interface }}` | diff --git a/roles/load_balancer/defaults/main.yaml b/roles/load_balancer/defaults/main.yaml deleted file mode 100644 index 71f4e8a..0000000 --- a/roles/load_balancer/defaults/main.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# group of servers with victoria select select role. Used to collect ip addresses for load-balancer -vmselect_group: victoria_cluster -# group of servers with victoria select insert role. Used to collect ip addresses for load-balancer -vminsert_group: victoria_cluster - -# interface to gather ip address -if_name: "{{ vars['ansible_default_ipv4'].interface }}" diff --git a/roles/load_balancer/handlers/main.yml b/roles/load_balancer/handlers/main.yml deleted file mode 100644 index df1214a..0000000 --- a/roles/load_balancer/handlers/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Reload nginx service - ansible.builtin.systemd: - name: nginx - daemon_reload: yes - enabled: yes - state: reloaded diff --git a/roles/load_balancer/tasks/main.yaml b/roles/load_balancer/tasks/main.yaml deleted file mode 100644 index 738e33a..0000000 --- a/roles/load_balancer/tasks/main.yaml +++ /dev/null @@ -1,23 +0,0 @@ -- name: Ensure nginx package - when: ansible_distribution == "Debian" or ansible_distribution == 'Ubuntu' - ansible.builtin.apt: - update_cache: yes - install_recommends: no - name: nginx - -- name: Ensure nginx config - ansible.builtin.template: - src: nginx.conf.j2 - dest: /etc/nginx/nginx.conf - mode: 0644 - notify: reload nginx service - -- name: Execute handlers - ansible.builtin.meta: flush_handlers - -- name: Start nginx service - ansible.builtin.systemd: - name: nginx - daemon_reload: yes - enabled: yes - state: started diff --git a/roles/load_balancer/templates/nginx.conf.j2 b/roles/load_balancer/templates/nginx.conf.j2 deleted file mode 100644 index 5bb1d29..0000000 --- a/roles/load_balancer/templates/nginx.conf.j2 +++ /dev/null @@ -1,43 +0,0 @@ -user www-data; -worker_processes auto; -pid /run/nginx.pid; -include /etc/nginx/modules-enabled/*.conf; - -events { - worker_connections 768; -} -http { - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - include /etc/nginx/mime.types; - default_type application/octet-stream; - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE - ssl_prefer_server_ciphers on; - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; -} - -stream { - server { - listen 8480; - proxy_pass victoria-insert; - } - server { - listen 8481; - proxy_pass victoria-select; - } - - upstream victoria-insert { -{% for host in groups[vminsert_group] %} - server {{ hostvars[host]['ansible_'~if_name].ipv4.address }}:8480; -{% endfor %} - } - upstream victoria-select { -{% for host in groups[vmselect_group] %} - server {{ hostvars[host]['ansible_'~if_name].ipv4.address }}:8481; -{% endfor %} - } -} diff --git a/roles/vmagent/README.md b/roles/vmagent/README.md index 10701d4..4783426 100644 --- a/roles/vmagent/README.md +++ b/roles/vmagent/README.md @@ -7,8 +7,8 @@ Role to install and configure vmagent. Installs by using binary from Github rele The following table lists the configurable parameters of the roles and their default values. > Note that default `vmagent_remote_write_host` is using port for VMSingle installation. For cluster mode installed -> by [role](../cluster) with [loadbalancer](../load_balancer) from this repository it is needed to point at VMInsert -> component which will be `load_balancer:8480`. +> by using roles from this repository it is needed to point at VMSelect component which will be placed behind a load balancer. +> See [playbooks/cluster.yaml](../../playbooks/cluster.yml) for cluster deployment example. | Parameter | Description | Default | |-------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| diff --git a/roles/vmalert/README.md b/roles/vmalert/README.md index 00eb588..51742f1 100644 --- a/roles/vmalert/README.md +++ b/roles/vmalert/README.md @@ -4,7 +4,9 @@ Installs `vmalert` as binary running with systemd ## Parameters -> Note that default `vic_vm_alert_datasource_url` is using port for VMSingle installation. For cluster mode installed by [role](../cluster) with [loadbalancer](../load_balancer) from this repository it is needed to point at VMSelect component which will be `load_balancer:8481`. +> Note that default `vic_vm_alert_datasource_url` is using port for VMSingle installation. For cluster mode installed +> by using roles from this repository it is needed to point at VMSelect component which will be placed behind a load balancer. +> See [playbooks/cluster.yaml](../../playbooks/cluster.yml) for cluster deployment example. | Parameter | Description | Default | |----------------------------------|-------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|