Skip to content

Commit

Permalink
Merge pull request #16 from idealista/develop
Browse files Browse the repository at this point in the history
Develop to Master for Release 1.1.0
  • Loading branch information
ommarmol authored Sep 4, 2024
2 parents 292e346 + 2cbe8ff commit baba357
Show file tree
Hide file tree
Showing 28 changed files with 845 additions and 160 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ env:
script:
- export DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}
- pipenv run molecule test
- pipenv run molecule test -s etcd

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
email:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch
### Removed
### Fixed

## [1.1.0](https://github.com/idealista/patroni_role/tree/1.1.0) (2024-08-24)
### [Full Changelog](https://github.com/idealista/patroni_role/compare/1.0.3...1.1.0)
### Added
- *[#14](https://github.com/idealista/patroni_role/issues/14) Add etcd configuration in patroni_role* @ledepedro

## [1.0.3](https://github.com/idealista/patroni_role/tree/1.0.3) (2024-07-12)
### [Full Changelog](https://github.com/idealista/patroni_role/compare/1.0.2...1.0.3)
### Added
Expand Down
118 changes: 0 additions & 118 deletions config/tasks/main.yml

This file was deleted.

11 changes: 0 additions & 11 deletions config/tasks/pg_hba.yml

This file was deleted.

34 changes: 34 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ proxy_env: {} # yamllint disable rule:braces
# "postgres_cluster" variables
is_master: true

dcs:
# exists: true
# type: 'consul'

etcd:
# version: '3.5.9'
# data_dir: '/var/lib/etcd'
# cluster_name: "etcd-pgdbk-cluster-test"
# election_timeout: '5000'
# heartbeat_interval: '1000'
# initial_election_tick_advance: 'false'
# protocol: 'http'
# add_config: []

patroni:
# is_cluster_installed: false
# is_add_node_cluster: false
Expand All @@ -20,6 +34,26 @@ patroni:
# replication_username: "replicator"
# replication_password: "replicator-pass"
# pending_restart: false

# etcd_hosts: []
# - { host: "10.128.64.140", port: "2379" }
# - { host: "10.128.64.142", port: "2379" }
# - { host: "10.128.64.143", port: "2379" }
# etcd_namespace: "{{ omit }}"
# etcd_username: "{{ omit }}"
# etcd_password: "{{ omit }}"
# etcd_protocol: "{{ omit }}"
# etcd_host: "{{ omit }}"
# etcd_use_proxies: "{{ omit }}"
# etcd_url: "{{ omit }}"
# etcd_proxy: "{{ omit }}"
# etcd_srv: "{{ omit }}"
# etcd_srv_suffix: "{{ omit }}"
# etcd_cacert: "{{ omit }}"
# etcd_cert: "{{ omit }}"
# etcd_key: "{{ omit }}"


# consul_namespace: 'service'
# consul_register_service: "{{ omit }}"
# consul_host: '127.0.0.1:8500'
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/group_vars/all/main
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pg_service_state: started
pg_service_enabled: true
pg_automatic_startup_configuration: auto
pg_os_tuning: false
pg_users_no_log: false
# pg_users_no_log: false
pg_users:
- name: "{{ pgbouncer.auth_username }}"
password: "{{ pgbouncer.auth_password }}"
Expand Down
25 changes: 25 additions & 0 deletions molecule/etcd/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Molecule managed

{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}



RUN if [ $(command -v apt-get) ]; then \
apt-get update && \
apt-get install -y python3 sudo bash ca-certificates gnupg systemd iproute2 systemd-sysv &&\
apt-get clean; \
elif [ $(command -v dnf) ]; then \
cd /etc/yum.repos.d/ & \
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* & \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* & \
dnf update & dnf makecache && \
dnf --assumeyes install python3 sudo python36-devel python3-dnf bash systemd && dnf clean all; \
elif [ $(command -v yum) ]; then \
yum makecache fast && \
yum install -y python sudo yum-plugin-ovl bash systemd systemd-sysv epel-release && \
sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
fi
28 changes: 28 additions & 0 deletions molecule/etcd/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---

- name: Install etc cluster
hosts: etcd_cluster

tasks:
- name: create etc cluster
include_role:
name: patroni_role
tasks_from: create_etcd_cluster.yml
when: not dcs.exists | bool and dcs.type=='etcd'
tags: etcd

- name: Install pgdb cluster
hosts: postgres_cluster

pre_tasks:
- name: pre-checks postgres
import_tasks: "../../tasks/pre-checks/postgres.yml"
tags: always

roles:
- role: postgresql_role
when: postgresql_install | bool and not postgres_installed
- role: pgbouncer_role
when: pgbouncer_install | bool and not pgbouncer_installed
- role: patroni_role

2 changes: 2 additions & 0 deletions molecule/etcd/files/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
patroni.yml
pg_hba.conf
6 changes: 6 additions & 0 deletions molecule/etcd/group_vars/all/consul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

consul_server_nodes:
- consul-server-test

consul_datacenter: mainlocal
Loading

0 comments on commit baba357

Please sign in to comment.