Skip to content

Commit

Permalink
๐Ÿ”ง refactor(verify.yml): include asserts playbook for postgres
Browse files Browse the repository at this point in the history
๐Ÿ†• feat(vip_manager_package_repo.yml): add new file to assert vip_manager_package_repo
๐Ÿ†• feat(main.yml): add new file to include all asserts
๐Ÿ”ง refactor(Debian.yml): split vip_manager_package_repo into base_url and package_repo

The asserts playbook for postgres is now included in verify.yml to ensure the correct functioning of postgres. A new file, vip_manager_package_repo.yml, has been added to assert the vip_manager_package_repo, which helps in validating the correctness of the package repository. Another new file, main.yml, has been added to include all asserts, which helps in organizing and managing all assertions in one place. In Debian.yml, the vip_manager_package_repo has been split into base_url and package_repo to improve readability and maintainability.
  • Loading branch information
ThomasSanson committed Jul 14, 2023
1 parent b5a1aff commit b4abf65
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
- name: Include asserts playbook for postgres
ansible.builtin.import_playbook: "../tests/variables/main.yml"

- name: Molecule | Verify | All
hosts: all

Expand Down
21 changes: 21 additions & 0 deletions molecule/tests/variables/asserts/vip_manager_package_repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Include vars
ansible.builtin.include_vars:
file: ../../../../vars/Debian.yml

- name: Setting vip_manager_version
ansible.builtin.set_fact:
vip_manager_version: "1.0.0"

- name: Debug vip_manager_package_repo
debug:
var: vip_manager_package_repo

- name: Assert vip_manager_package_repo
assert:
that:
- vip_manager_package_repo == "https://github.com/cybertec-postgresql/vip-manager/releases/download/v1.0.0/vip-manager_1.0.0_Linux_x86_64.deb"
fail_msg: >
Assertion failed: vip_manager_package_repo is "{{ vip_manager_package_repo }}",
but expected "https://github.com/cybertec-postgresql/vip-manager/releases/download/v1.0.0/vip-manager_1.0.0_Linux_x86_64.deb"
success_msg: "vip_manager_package_repo is correct"
9 changes: 9 additions & 0 deletions molecule/tests/variables/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- hosts: localhost
gather_facts: false

tasks:
- name: Molecule | Tests | Include all asserts
ansible.builtin.include_tasks: "{{ item }}"
with_fileglob:
- asserts/*.yml
4 changes: 3 additions & 1 deletion vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ postgresql_packages:

# Extra packages
etcd_package_repo: "https://github.com/etcd-io/etcd/releases/download/v{{ etcd_version }}/etcd-v{{ etcd_version }}-linux-amd64.tar.gz"
vip_manager_package_repo: "https://github.com/cybertec-postgresql/vip-manager/releases/download/v{{ vip_manager_version }}/vip-manager_{{ vip_manager_version }}_Linux_x86_64.deb"
vip_manager_base_url: "https://github.com/cybertec-postgresql/vip-manager/releases/download"
vip_manager_package_repo: "{{ vip_manager_base_url }}/v{{ vip_manager_version }}/vip-manager_{{ vip_manager_version }}_Linux_x86_64.deb"

# (if with_haproxy_load_balancing: true)
haproxy_installation_method: "deb" # (default)"deb" or "src"
haproxy_install_repo: true # or 'false'
Expand Down

0 comments on commit b4abf65

Please sign in to comment.