public inbox for [email protected]  
help / color / mirror / Atom feed
Looking for a linux tool to automate PG admin tasks
7+ messages / 7 participants
[nested] [flat]

* Looking for a linux tool to automate PG admin tasks
@ 2025-10-16 13:17 Jean-Christophe Boggio <[email protected]>
  2025-10-16 13:24 ` Re: Looking for a linux tool to automate PG admin tasks Keith Christian <[email protected]>
  2025-10-16 13:46 ` Re: Looking for a linux tool to automate PG admin tasks hubert depesz lubaczewski <[email protected]>
  2025-10-17 12:24 ` Re: Looking for a linux tool to automate PG admin tasks raphi <[email protected]>
  0 siblings, 3 replies; 7+ messages in thread

From: Jean-Christophe Boggio @ 2025-10-16 13:17 UTC (permalink / raw)
  To: pgsql-admin <[email protected]>

Hello,
I have several servers with many databases on them for different 
applications.
I need to execute some tasks on some databases depending on some criteria.

For example, execute query xxx but only on databases where table 
public.sometable exists or if number of rows in table yyy is > 1M.
Before reinventing the wheel with ugly bash scripts, do you know of some 
tools that would suit my case ?
Some tasks will have to execute periodically (with crons probably) and 
others will be one-off.
CLI tools if possible because I'm working remotely on those servers of 
course.
Thanks,
JC






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Looking for a linux tool to automate PG admin tasks
  2025-10-16 13:17 Looking for a linux tool to automate PG admin tasks Jean-Christophe Boggio <[email protected]>
@ 2025-10-16 13:24 ` Keith Christian <[email protected]>
  2 siblings, 0 replies; 7+ messages in thread

From: Keith Christian @ 2025-10-16 13:24 UTC (permalink / raw)
  To: Jean-Christophe Boggio <[email protected]>; +Cc: pgsql-admin <[email protected]>

Expect comes to mind.
I've automated many CLI based systems with it.
------Keith



On Thu, Oct 16, 2025, 07:17 Jean-Christophe Boggio <
[email protected]> wrote:

> Hello,
> I have several servers with many databases on them for different
> applications.
> I need to execute some tasks on some databases depending on some criteria.
>
> For example, execute query xxx but only on databases where table
> public.sometable exists or if number of rows in table yyy is > 1M.
> Before reinventing the wheel with ugly bash scripts, do you know of some
> tools that would suit my case ?
> Some tasks will have to execute periodically (with crons probably) and
> others will be one-off.
> CLI tools if possible because I'm working remotely on those servers of
> course.
> Thanks,
> JC
>
>
>
>


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Looking for a linux tool to automate PG admin tasks
  2025-10-16 13:17 Looking for a linux tool to automate PG admin tasks Jean-Christophe Boggio <[email protected]>
@ 2025-10-16 13:46 ` hubert depesz lubaczewski <[email protected]>
  2025-10-16 14:11   ` Re: Looking for a linux tool to automate PG admin tasks Ron Johnson <[email protected]>
  2 siblings, 1 reply; 7+ messages in thread

From: hubert depesz lubaczewski @ 2025-10-16 13:46 UTC (permalink / raw)
  To: Jean-Christophe Boggio <[email protected]>; +Cc: pgsql-admin <[email protected]>

On Thu, Oct 16, 2025 at 03:17:16PM +0200, Jean-Christophe Boggio wrote:
> Hello,
> I have several servers with many databases on them for different
> applications.
> I need to execute some tasks on some databases depending on some criteria.
> For example, execute query xxx but only on databases where table
> public.sometable exists or if number of rows in table yyy is > 1M.
> Before reinventing the wheel with ugly bash scripts, do you know of some
> tools that would suit my case ?
> Some tasks will have to execute periodically (with crons probably) and
> others will be one-off.
> CLI tools if possible because I'm working remotely on those servers of
> course.

Well, I'd just use psql, with some simple script using \gexec
functionality. Solves virtually any problem of this kind.

Best regards,

depesz






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Looking for a linux tool to automate PG admin tasks
  2025-10-16 13:17 Looking for a linux tool to automate PG admin tasks Jean-Christophe Boggio <[email protected]>
  2025-10-16 13:46 ` Re: Looking for a linux tool to automate PG admin tasks hubert depesz lubaczewski <[email protected]>
@ 2025-10-16 14:11   ` Ron Johnson <[email protected]>
  2025-10-17 04:16     ` Re: Looking for a linux tool to automate PG admin tasks Roland Müller <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Ron Johnson @ 2025-10-16 14:11 UTC (permalink / raw)
  To: pgsql-admin <[email protected]>

On Thu, Oct 16, 2025 at 9:46 AM hubert depesz lubaczewski <[email protected]>
wrote:

> On Thu, Oct 16, 2025 at 03:17:16PM +0200, Jean-Christophe Boggio wrote:
> > Hello,
> > I have several servers with many databases on them for different
> > applications.
> > I need to execute some tasks on some databases depending on some
> criteria.
> > For example, execute query xxx but only on databases where table
> > public.sometable exists or if number of rows in table yyy is > 1M.
> > Before reinventing the wheel with ugly bash scripts, do you know of some
> > tools that would suit my case ?
> > Some tasks will have to execute periodically (with crons probably) and
> > others will be one-off.
> > CLI tools if possible because I'm working remotely on those servers of
> > course.
>
> Well, I'd just use psql, with some simple script using \gexec
> functionality. Solves virtually any problem of this kind.
>

Ditto.  bash scripts are only ugly if you write ugly bash.

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Looking for a linux tool to automate PG admin tasks
  2025-10-16 13:17 Looking for a linux tool to automate PG admin tasks Jean-Christophe Boggio <[email protected]>
  2025-10-16 13:46 ` Re: Looking for a linux tool to automate PG admin tasks hubert depesz lubaczewski <[email protected]>
  2025-10-16 14:11   ` Re: Looking for a linux tool to automate PG admin tasks Ron Johnson <[email protected]>
@ 2025-10-17 04:16     ` Roland Müller <[email protected]>
  2025-10-17 14:36       ` Re: Looking for a linux tool to automate PG admin tasks bertrand HARTWIG <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Roland Müller @ 2025-10-17 04:16 UTC (permalink / raw)
  To: pgsql-admin <[email protected]>

May be Ansible? There is a dedicated module for Postgresql and a lot of
modules for general tasks such as installation etc.
https://docs.ansible.com/ansible/latest/collections/community/postgresql/index.html

Br
Roland

Ron Johnson <[email protected]> ezt írta (időpont: 2025. okt. 16., Cs
17:12):

> On Thu, Oct 16, 2025 at 9:46 AM hubert depesz lubaczewski <
> [email protected]> wrote:
>
>> On Thu, Oct 16, 2025 at 03:17:16PM +0200, Jean-Christophe Boggio wrote:
>> > Hello,
>> > I have several servers with many databases on them for different
>> > applications.
>> > I need to execute some tasks on some databases depending on some
>> criteria.
>> > For example, execute query xxx but only on databases where table
>> > public.sometable exists or if number of rows in table yyy is > 1M.
>> > Before reinventing the wheel with ugly bash scripts, do you know of some
>> > tools that would suit my case ?
>> > Some tasks will have to execute periodically (with crons probably) and
>> > others will be one-off.
>> > CLI tools if possible because I'm working remotely on those servers of
>> > course.
>>
>> Well, I'd just use psql, with some simple script using \gexec
>> functionality. Solves virtually any problem of this kind.
>>
>
> Ditto.  bash scripts are only ugly if you write ugly bash.
>
> --
> Death to <Redacted>, and butter sauce.
> Don't boil me, I'm still alive.
> <Redacted> lobster!
>


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Looking for a linux tool to automate PG admin tasks
  2025-10-16 13:17 Looking for a linux tool to automate PG admin tasks Jean-Christophe Boggio <[email protected]>
  2025-10-16 13:46 ` Re: Looking for a linux tool to automate PG admin tasks hubert depesz lubaczewski <[email protected]>
  2025-10-16 14:11   ` Re: Looking for a linux tool to automate PG admin tasks Ron Johnson <[email protected]>
  2025-10-17 04:16     ` Re: Looking for a linux tool to automate PG admin tasks Roland Müller <[email protected]>
@ 2025-10-17 14:36       ` bertrand HARTWIG <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: bertrand HARTWIG @ 2025-10-17 14:36 UTC (permalink / raw)
  To: Roland Müller <[email protected]>; +Cc: pgsql-admin <[email protected]>

Hi all,

An option worth considering is Ansible AWX (the open-source version of Ansible Tower).

It allows you to:

Schedule jobs easily (no need for external crons),

Track job executions and results in a clear web UI,

Manage credentials and inventories securely,

And of course, execute Ansible playbooks or ad-hoc commands conditionally across multiple servers and databases.

For your use case — running SQL queries on specific databases that meet certain criteria — you could write lightweight Ansible playbooks and let AWX handle the orchestration, scheduling, and logging.

It’s simple to set up and provides much better visibility and control than scattered bash scripts.

Best,

Bertrand

ps.: i am using AWX every day for this kind of job


> Le 17 oct. 2025 à 06:16, Roland Müller <[email protected]> a écrit :
> 
> May be Ansible? There is a dedicated module for Postgresql and a lot of modules for general tasks such as installation etc. https://docs.ansible.com/ansible/latest/collections/community/postgresql/index.html
> 
> Br
> Roland 
> 
> Ron Johnson <[email protected] <mailto:[email protected]>> ezt írta (időpont: 2025. okt. 16., Cs 17:12):
>> On Thu, Oct 16, 2025 at 9:46 AM hubert depesz lubaczewski <[email protected] <mailto:[email protected]>> wrote:
>>> On Thu, Oct 16, 2025 at 03:17:16PM +0200, Jean-Christophe Boggio wrote:
>>> > Hello,
>>> > I have several servers with many databases on them for different
>>> > applications.
>>> > I need to execute some tasks on some databases depending on some criteria.
>>> > For example, execute query xxx but only on databases where table
>>> > public.sometable exists or if number of rows in table yyy is > 1M.
>>> > Before reinventing the wheel with ugly bash scripts, do you know of some
>>> > tools that would suit my case ?
>>> > Some tasks will have to execute periodically (with crons probably) and
>>> > others will be one-off.
>>> > CLI tools if possible because I'm working remotely on those servers of
>>> > course.
>>> 
>>> Well, I'd just use psql, with some simple script using \gexec
>>> functionality. Solves virtually any problem of this kind.
>> 
>> 
>> Ditto.  bash scripts are only ugly if you write ugly bash.
>> 
>> --
>> Death to <Redacted>, and butter sauce.
>> Don't boil me, I'm still alive.
>> <Redacted> lobster!



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Looking for a linux tool to automate PG admin tasks
  2025-10-16 13:17 Looking for a linux tool to automate PG admin tasks Jean-Christophe Boggio <[email protected]>
@ 2025-10-17 12:24 ` raphi <[email protected]>
  2 siblings, 0 replies; 7+ messages in thread

From: raphi @ 2025-10-17 12:24 UTC (permalink / raw)
  To: [email protected]

Hi,

if you don't want to deal with bash scripts and everything that comes 
with it (like manually distributing them every time you change 
something), you could look into ansible. It's pretty straight forward 
once you've got the hang of it and if you have gitlab, you can run the 
playbooks in a (scheduled) pipeline. It also scales very well and if you 
add new databases automatically to your inventory, you'll never have to 
login to a server again. The biggest caveat though is that it needs ssh 
access to remotely execute the plays, but if you can install bash 
scripts I figure you already have ssh access.

have fun ;)
raphi

Am 16.10.2025 um 15:17 schrieb Jean-Christophe Boggio:
> Hello,
> I have several servers with many databases on them for different 
> applications.
> I need to execute some tasks on some databases depending on some 
> criteria.
>
> For example, execute query xxx but only on databases where table 
> public.sometable exists or if number of rows in table yyy is > 1M.
> Before reinventing the wheel with ugly bash scripts, do you know of 
> some tools that would suit my case ?
> Some tasks will have to execute periodically (with crons probably) and 
> others will be one-off.
> CLI tools if possible because I'm working remotely on those servers of 
> course.
> Thanks,
> JC
>
>
>






^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2025-10-17 14:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-10-16 13:17 Looking for a linux tool to automate PG admin tasks Jean-Christophe Boggio <[email protected]>
2025-10-16 13:24 ` Keith Christian <[email protected]>
2025-10-16 13:46 ` hubert depesz lubaczewski <[email protected]>
2025-10-16 14:11   ` Ron Johnson <[email protected]>
2025-10-17 04:16     ` Roland Müller <[email protected]>
2025-10-17 14:36       ` bertrand HARTWIG <[email protected]>
2025-10-17 12:24 ` raphi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox