From 818c997853f287da63f21d03dafc450ffdd40b77 Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Mon, 6 Jan 2025 21:08:06 +0100 Subject: [PATCH] WIP: feat(postgresql): deploy directly (bare-metal) --- roles/postgresql/tasks/deploy-local.yml | 11 +++++++++++ roles/postgresql/vars/main.yml | 1 + 2 files changed, 12 insertions(+) create mode 100644 roles/postgresql/tasks/deploy-local.yml diff --git a/roles/postgresql/tasks/deploy-local.yml b/roles/postgresql/tasks/deploy-local.yml new file mode 100644 index 0000000..a77ca5c --- /dev/null +++ b/roles/postgresql/tasks/deploy-local.yml @@ -0,0 +1,11 @@ +--- +- name: Ensure postgresql package is {{ postgresql_state }} + ansible.builtin.package: + name: "{{ postgresql_os_package_name }}" + state: "{{ postgresql_state }}" + +- name: Ensure postgresql systemd unit is {{ (postgresql_state == 'present') | ternary('enabled', 'disabled') }} + ansible.builtin.systemd: + name: "{{ postgresql_systemd_service_name }}" + enabled: "{{ (postgresql_state == 'present') }}" + when: ansible_facts['service_mgr'] == 'systemd' diff --git a/roles/postgresql/vars/main.yml b/roles/postgresql/vars/main.yml index ed8f50a..5c744e6 100644 --- a/roles/postgresql/vars/main.yml +++ b/roles/postgresql/vars/main.yml @@ -4,3 +4,4 @@ postgresql_states: - absent postgresql_deployment_methods: - docker + - local