Compare commits
No commits in common. "ac3b258dff528204ed7b3451882b3d4bc261fce0" and "3c8ba1d94ddd40b4eaaa20d32321b51fee749f7c" have entirely different histories.
ac3b258dff
...
3c8ba1d94d
18
galaxy.yml
18
galaxy.yml
@ -1,18 +0,0 @@
|
|||||||
namespace: finallycoffee
|
|
||||||
name: databases
|
|
||||||
version: 0.1.0
|
|
||||||
readme: README.md
|
|
||||||
authors:
|
|
||||||
- transcaffeine <transcaffeine@finally.coffee>
|
|
||||||
description: Collection for deploying and configuring databases
|
|
||||||
dependencies:
|
|
||||||
"community.docker": "^3.0.0"
|
|
||||||
license_file: LICENSE.md
|
|
||||||
build_ignore:
|
|
||||||
- '*.tar.gz'
|
|
||||||
repository: https://git.finally.coffee/finallycoffee/databases
|
|
||||||
issues: https://codeberg.org/finallycoffee/ansible-collection-databases/issues
|
|
||||||
tags:
|
|
||||||
- elasticsearch
|
|
||||||
- mariadb
|
|
||||||
- docker
|
|
@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
requires_ansible: ">=2.15"
|
|
@ -1,22 +0,0 @@
|
|||||||
# `finallycoffee.base.elastiscsearch`
|
|
||||||
|
|
||||||
A simple ansible role which deploys a single-node elastic container to provide
|
|
||||||
an easy way to do some indexing.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Per default, `/opt/elasticsearch/data` is used to persist data, it is
|
|
||||||
customizable by using either `elasticsearch_base_path` or `elasticsearch_data_path`.
|
|
||||||
|
|
||||||
As elasticsearch be can be quite memory heavy, the maximum amount of allowed RAM
|
|
||||||
can be configured using `elasticsearch_allocated_ram_mb`, defaulting to 512 (mb).
|
|
||||||
|
|
||||||
The cluster name and discovery type can be overridden using
|
|
||||||
`elasticsearch_config_cluster_name` (default: elastic) and
|
|
||||||
`elasticsearch_config_discovery_type` (default: single-node), should one
|
|
||||||
need a multi-node elasticsearch deployment.
|
|
||||||
|
|
||||||
Per default, no ports or networks are mapped, and explizit mapping using
|
|
||||||
either ports (`elasticsearch_container_ports`) or networks
|
|
||||||
(`elasticsearch_container_networks`) is required in order for other services
|
|
||||||
to use elastic.
|
|
@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
elasticsearch_version: 8.15.3
|
|
||||||
elasticsearch_state: present
|
|
||||||
|
|
||||||
elasticsearch_base_path: /opt/elasticsearch
|
|
||||||
elasticsearch_data_path: "{{ elasticsearch_base_path }}/data"
|
|
||||||
|
|
||||||
elasticsearch_config_cluster_name: elastic
|
|
||||||
elasticsearch_config_discovery_type: single-node
|
|
||||||
elasticsearch_config_boostrap_memory_lock: true
|
|
||||||
elasticsearch_allocated_ram_mb: 512
|
|
||||||
|
|
||||||
elasticsearch_container_image_registry: docker.elastic.co
|
|
||||||
elasticsearch_container_image_namespace: elasticsearch
|
|
||||||
elasticsearch_container_image_name: elasticsearch-oss
|
|
||||||
elasticsearch_container_image_tag: ~
|
|
||||||
elasticsearch_container_image: >-2
|
|
||||||
{{
|
|
||||||
([
|
|
||||||
elasticsearch_container_image_registry | default([], true),
|
|
||||||
elasticsearch_container_image_namespace | default([], true),
|
|
||||||
elasticsearch_container_image_name,
|
|
||||||
] | flatten | join('/'))
|
|
||||||
+ ':' +
|
|
||||||
(elasticsearch_container_image_tag | default(elasticsearch_version, true))
|
|
||||||
}}
|
|
||||||
elasticsearch_container_image_source: pull
|
|
||||||
elasticsearch_container_image_force_source: >-2
|
|
||||||
{{ elasticsearch_container_image_tag | default(false, true) | bool }}
|
|
||||||
|
|
||||||
elasticsearch_container_name: elasticsearch
|
|
||||||
elasticsearch_container_env:
|
|
||||||
"ES_JAVA_OPTS": "-Xms{{ elasticsearch_allocated_ram_mb }}m -Xmx{{ elasticsearch_allocated_ram_mb }}m"
|
|
||||||
"cluster.name": "{{ elasticsearch_config_cluster_name }}"
|
|
||||||
"discovery.type": "{{ elasticsearch_config_discovery_type }}"
|
|
||||||
"bootstrap.memory_lock": "{{ 'true' if elasticsearch_config_boostrap_memory_lock else 'false' }}"
|
|
||||||
elasticsearch_container_user: ~
|
|
||||||
elasticsearch_container_ports: ~
|
|
||||||
elasticsearch_container_labels:
|
|
||||||
version: "{{ elasticsearch_version }}"
|
|
||||||
elasticsearch_container_ulimits:
|
|
||||||
# - "memlock:{{ (1.5 * 1024 * elasticsearch_allocated_ram_mb) | int }}:{{ (1.5 * 1024 * elasticsearch_allocated_ram_mb) | int }}"
|
|
||||||
- "memlock:-1:-1"
|
|
||||||
elasticsearch_container_volumes:
|
|
||||||
- "{{ elasticsearch_data_path }}:/usr/share/elasticsearch/data:z"
|
|
||||||
elasticsearch_container_networks: ~
|
|
||||||
elasticsearch_container_purge_networks: ~
|
|
||||||
elasticsearch_container_restart_policy: unless-stopped
|
|
||||||
elasticsearch_container_state: >-2
|
|
||||||
{{ (elasticsearch_state == 'present') | ternary('started', 'absent') }}
|
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
allow_duplicates: true
|
|
||||||
dependencies: []
|
|
||||||
galaxy_info:
|
|
||||||
role_name: elasticsearch
|
|
||||||
description: >-2
|
|
||||||
Deploy elasticsearch in a docker container
|
|
||||||
galaxy_tags:
|
|
||||||
- elasticsearch
|
|
||||||
- docker
|
|
@ -1,39 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Check if state is valid
|
|
||||||
ansible.builtin.fail:
|
|
||||||
msg: >-2
|
|
||||||
Unsupported state '{{ elasticsearch_state }}'. Supported
|
|
||||||
states are {{ elasticsearch_states | join(', ') }}.
|
|
||||||
when: elasticsearch_state not in elasticsearch_states
|
|
||||||
|
|
||||||
- name: Ensure host directories are {{ elasticsearch_state }}
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: directory
|
|
||||||
mode: "0777"
|
|
||||||
loop:
|
|
||||||
- "{{ elasticsearch_base_path }}"
|
|
||||||
- "{{ elasticsearch_data_path }}"
|
|
||||||
|
|
||||||
- name: Ensure elasticsearch container image '{{ elasticsearch_container_image }}' is {{ elasticsearch_state }}
|
|
||||||
community.docker.docker_image:
|
|
||||||
name: "{{ elasticsearch_container_image }}"
|
|
||||||
state: "{{ elasticsearch_state }}"
|
|
||||||
source: "{{ elasticsearch_container_image_source }}"
|
|
||||||
force_source: "{{ elasticsearch_container_image_force_source }}"
|
|
||||||
force_source: "{{ elasticsearch_container_image_tag|default(false, true)|bool }}"
|
|
||||||
|
|
||||||
- name: Ensure elasticsearch container '{{ elasticsearch_container_name }}' is {{ elasticsearch_container_state }}
|
|
||||||
community.docker.docker_container:
|
|
||||||
name: "{{ elasticsearch_container_name }}"
|
|
||||||
image: "{{ elasticsearch_container_image }}"
|
|
||||||
env: "{{ elasticsearch_container_env | default(omit, True) }}"
|
|
||||||
user: "{{ elasticsearch_container_user | default(omit, True) }}"
|
|
||||||
ports: "{{ elasticsearch_container_ports | default(omit, True) }}"
|
|
||||||
labels: "{{ elasticsearch_container_labels | default(omit, True) }}"
|
|
||||||
volumes: "{{ elasticsearch_container_volumes }}"
|
|
||||||
ulimits: "{{ elasticsearch_container_ulimits }}"
|
|
||||||
networks: "{{ elasticsearch_container_networks | default(omit, True) }}"
|
|
||||||
purge_networks: "{{ elasticsearch_container_purge_networks | default(omit, True) }}"
|
|
||||||
restart_policy: "{{ elasticsearch_container_restart_policy }}"
|
|
||||||
state: "{{ elasticsearch_container_state }}"
|
|
@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
elasticsearch_states:
|
|
||||||
- present
|
|
||||||
- absent
|
|
@ -1,9 +1,8 @@
|
|||||||
---
|
---
|
||||||
mariadb_version: "10.11.9"
|
|
||||||
|
mariadb_version: "10.6.11"
|
||||||
mariadb_base_path: /var/lib/mariadb
|
mariadb_base_path: /var/lib/mariadb
|
||||||
mariadb_data_path: >-2
|
mariadb_data_path: "{{ mariadb_base_path }}/{{ mariadb_version }}"
|
||||||
{{ mariadb_base_path }}/{{ mariadb_version | split('.') | first }}
|
|
||||||
mariadb_state: present
|
|
||||||
|
|
||||||
mariadb_root_password: ~
|
mariadb_root_password: ~
|
||||||
mariadb_database: ~
|
mariadb_database: ~
|
||||||
@ -14,24 +13,10 @@ mariadb_container_base_environment:
|
|||||||
MARIADB_ROOT_PASSWORD: "{{ mariadb_root_password }}"
|
MARIADB_ROOT_PASSWORD: "{{ mariadb_root_password }}"
|
||||||
mariadb_container_extra_environment: {}
|
mariadb_container_extra_environment: {}
|
||||||
|
|
||||||
mariadb_container_image_registry: docker.io
|
|
||||||
mariadb_container_image_namespace: ~
|
|
||||||
mariadb_container_image_name: mariadb
|
|
||||||
mariadb_container_image_tag: ~
|
|
||||||
mariadb_container_image: >-2
|
|
||||||
{{
|
|
||||||
([
|
|
||||||
mariadb_container_image_registry | default([], true),
|
|
||||||
mariadb_container_image_namespace | default([], true),
|
|
||||||
mariadb_container_image_name,
|
|
||||||
] | flatten | join('/'))
|
|
||||||
+ ':' + mariadb_container_image_tag | default(mariadb_version, true)
|
|
||||||
}}
|
|
||||||
mariadb_container_image_source: pull
|
|
||||||
mariadb_container_image_force_source: >-2
|
|
||||||
{{ mariadb_container_image_tag | default(false, true) | bool }}
|
|
||||||
|
|
||||||
mariadb_container_name: mariadb
|
mariadb_container_name: mariadb
|
||||||
|
mariadb_container_image_name: docker.io/mariadb
|
||||||
|
mariadb_container_image_tag: ~
|
||||||
|
mariadb_container_image: "{{ mariadb_container_image_name }}:{{ mariadb_container_image_tag | default(mariadb_version, true) }}"
|
||||||
mariadb_container_base_volumes:
|
mariadb_container_base_volumes:
|
||||||
- "{{ mariadb_data_path }}:{{ mariadb_container_data_path }}:z"
|
- "{{ mariadb_data_path }}:{{ mariadb_container_data_path }}:z"
|
||||||
mariadb_container_extra_volumes: []
|
mariadb_container_extra_volumes: []
|
||||||
@ -45,5 +30,3 @@ mariadb_container_environment: >-2
|
|||||||
if (mariadb_database and mariadb_username and mariadb_password)
|
if (mariadb_database and mariadb_username and mariadb_password)
|
||||||
else {}, recursive=True)
|
else {}, recursive=True)
|
||||||
| combine(mariadb_container_extra_environment) }}
|
| combine(mariadb_container_extra_environment) }}
|
||||||
mariadb_container_state: >-2
|
|
||||||
{{ (mariadb_state == 'present') | ternary('started', 'absent') }}
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
allow_duplicates: true
|
|
||||||
dependencies: []
|
|
||||||
galaxy_info:
|
|
||||||
role_name: mariadb
|
|
||||||
description: >-2
|
|
||||||
Deploy mariadb using docker
|
|
||||||
galaxy_tags:
|
|
||||||
- mariadb
|
|
||||||
- docker
|
|
@ -1,21 +1,20 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure mariadb container image '{{ mariadb_container_image }}' is {{ mariadb_state }}
|
- name: Ensure mariaDB container image is present on host
|
||||||
community.docker.docker_image:
|
community.docker.docker_image:
|
||||||
name: "{{ mariadb_container_image }}"
|
name: "{{ mariadb_container_image }}"
|
||||||
state: "{{ mariadb_state }}"
|
state: present
|
||||||
source: "{{ mariadb_container_image_source }}"
|
source: pull
|
||||||
force_source: "{{ mariadb_container_image_force_source }}"
|
|
||||||
|
|
||||||
- name: Ensure mariadb container '{{ mariadb_container_name }}' is {{ mariadb_container_state }}
|
- name: Ensure mariaDB {{ mariadb_version }} is running as '{{ mariadb_container_name }}'
|
||||||
community.docker.docker_container:
|
community.docker.docker_container:
|
||||||
name: "{{ mariadb_container_name }}"
|
name: "{{ mariadb_container_name }}"
|
||||||
image: "{{ mariadb_container_image }}"
|
image: "{{ mariadb_container_image }}"
|
||||||
env: "{{ mariadb_container_environment }}"
|
env: "{{ mariadb_container_environment }}"
|
||||||
ports: "{{ mariadb_container_ports | default(omit, true) }}"
|
ports: "{{ mariadb_container_ports }}"
|
||||||
labels: "{{ mariadb_container_labels | default(omit, true) }}"
|
labels: "{{ mariadb_container_labels }}"
|
||||||
volumes: "{{ mariadb_container_volumes }}"
|
volumes: "{{ mariadb_container_volumes }}"
|
||||||
networks: "{{ mariadb_container_networks | default(omit, true) }}"
|
networks: "{{ mariadb_container_networks | default(omit, true) }}"
|
||||||
etc_hosts: "{{ mariadb_container_etc_hosts | default(omit, true) }}"
|
etc_hosts: "{{ mariadb_container_etc_hosts | default(omit, true) }}"
|
||||||
purge_networks: "{{ mariadb_container_purge_networks | default(omit, true) }}"
|
purge_networks: "{{ mariadb_container_purge_networks | default(omit, true) }}"
|
||||||
restart_policy: "{{ mariadb_container_restart_policy }}"
|
restart_policy: "{{ mariadb_container_restart_policy }}"
|
||||||
state: "{{ mariadb_container_state }}"
|
state: started
|
||||||
|
Loading…
x
Reference in New Issue
Block a user