Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9lZw-007uJX-0y for pgsql-admin@arkaria.postgresql.org; Fri, 17 Oct 2025 14:37:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v9lZu-0035fn-M3 for pgsql-admin@arkaria.postgresql.org; Fri, 17 Oct 2025 14:37:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9lZu-0035fe-64 for pgsql-admin@lists.postgresql.org; Fri, 17 Oct 2025 14:37:09 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9lZr-002Ijx-1F for pgsql-admin@lists.postgresql.org; Fri, 17 Oct 2025 14:37:08 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-47109187c32so10426675e9.2 for ; Fri, 17 Oct 2025 07:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760711825; x=1761316625; darn=lists.postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=IO/COO4Wj8n1R/s+OVf/ctCnb9Ol5vq8tAG6JTn78G0=; b=PUi/2lfWp3Wz4SLCUZQfFjxfABlsqbKvMF0ANLUGCviGo89HUMmTQiIHWj0o8eCDUo FpFvTq8SXGzF1T0AAJLyNbXRhaDY1a0Vk4QawIIjmiaZcm07kec4WNPQXHNk3aPnhD6h x+D5G8D1Iu4hKdPlX3/kGjB+qwt19ezKkB7XytUJZRr/ui+NbCPjETBs25wDeCMSz/Wp Ow85YFAikO+vbOdMrVNWQ8DaAdlmUuqkocr/olxjA5uUoPwqJd0VBoFykwA/5/tRcBzB 4Df4U4rVWBbcz/ISk6JDNY5VahusxJLTqSpBBHboouJep2ltium4WoLmLs6XsNFwgsSp ZDgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760711825; x=1761316625; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IO/COO4Wj8n1R/s+OVf/ctCnb9Ol5vq8tAG6JTn78G0=; b=b2CL57AOAKW/2yiAhqFJie+OkP6iUYYmj+vtU0dvJKGCowwD3FSSWJpSvUtWX/tIdN kyxlvOAMdvi6z0NGcv4l/Ds5dNokb48P5C+yJWTqx5kDFfULng9jc6zwSlVeF6TBkKhy 9myHCGy1woXs3+BbEzo2uoIyJWYW4ThfR4/gE2nFDLrPUM8QE8T9UjOrp6LWljJaxR2l w6BbhkPxHt08KZRANwAecU3iAXuzRyNL4q2MZGEEKcKzDpFttjlSrtsCMmnXXKdFDzQZ qIieuJWbBQtYa+EfC3wvnha/qzjtFUZHAAsq/H10nMqMm8fUZqAMFl+SdP++T0jOMNem X4EQ== X-Gm-Message-State: AOJu0YyMvwhLdDJvGBdO+K41TbwoXmzcECBOl9tkQgLWpQXbvnMoEpRi eWjN9tpKVKlYNfDscWwhIilJvZ1CCX6emEztMuDER3+sR8w57qZKJRUN X-Gm-Gg: ASbGncuygPiUkr7Mj98FzaskyppfUQr/duRNyU09eJrpqp40yEpgt5bMFsMRSlBp+kK sfKeZ5vuhDVEwBJYoFbJNUeP5pW8Kc2r5aYzlqQ8mpxQqkB6jxWJ0A0K/3h/9n1Szilg8MEPRm4 PYONmYbC3WriU4BaiiuzHufsRGSZViF0zpjuBjz2wcXbrqmXVJ+hd331SArl+fwfuT5TMmHqXLX DhWBjUPikMqv4BgXTxgMIqw9s59pfOG9BWWbkFlGQCJ8bcH1dKHoCeNiKyltx1jItO4d+TTXi6K 6JDNDaAWh1HVjGJmkob13Zv7uqQDCWAGY54ys9VdV9LJm9aYfevhXfK49/+yRu9/z1VxuYEiLtz lvtZ2IhUW1jOgdQJruuMg5ap51Z6mDtysDpKailZ0Rvghx+gEscI5l/iZ7vvyPMDr+0kSpI3IhC Jede9cX1YulZQmYE03hvjrQVN+J5ybKajWklrGvFsoIZ30WDNaoL2/vod0VNvTdwLZGWQirIAj1 ExdYJDfkfrl3vhVuXNsy4DOZRY9jdjeuEDW5ew= X-Google-Smtp-Source: AGHT+IHbkiSgBzxKW1+cpIWIugLnuVU+V1ot+8kgOHGL3J7GpebUbFfAvPhylrxtJQp3coC40XPTVA== X-Received: by 2002:a05:600c:3b22:b0:46e:4704:b01e with SMTP id 5b1f17b1804b1-471178767f4mr30871635e9.8.1760711824605; Fri, 17 Oct 2025 07:37:04 -0700 (PDT) Received: from smtpclient.apple (2a02-8429-e840-3201-48c9-f24d-dbf5-0aea.rev.sfr.net. [2a02:8429:e840:3201:48c9:f24d:dbf5:aea]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm40374098f8f.15.2025.10.17.07.37.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Oct 2025 07:37:04 -0700 (PDT) From: bertrand HARTWIG Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_FBD08598-E9C3-479E-B77C-E1F681422956" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.100.1.1.5\)) Subject: Re: Looking for a linux tool to automate PG admin tasks Date: Fri, 17 Oct 2025 16:36:52 +0200 In-Reply-To: Cc: pgsql-admin To: =?utf-8?Q?Roland_M=C3=BCller?= References: X-Mailer: Apple Mail (2.3864.100.1.1.5) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_FBD08598-E9C3-479E-B77C-E1F681422956 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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 =E2=80=94 running SQL queries on specific databases = that meet certain criteria =E2=80=94 you could write lightweight Ansible = playbooks and let AWX handle the orchestration, scheduling, and logging. It=E2=80=99s 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 =C3=A0 06:16, Roland M=C3=BCller a = =C3=A9crit : >=20 > 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/i= ndex.html >=20 > Br > Roland=20 >=20 > Ron Johnson > = ezt =C3=ADrta (id=C5=91pont: 2025. okt. 16., Cs 17:12): >> On Thu, Oct 16, 2025 at 9:46=E2=80=AFAM hubert depesz lubaczewski = > 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. >>>=20 >>> Well, I'd just use psql, with some simple script using \gexec >>> functionality. Solves virtually any problem of this kind. >>=20 >>=20 >> Ditto. bash scripts are only ugly if you write ugly bash. >>=20 >> -- >> Death to , and butter sauce. >> Don't boil me, I'm still alive. >> lobster! --Apple-Mail=_FBD08598-E9C3-479E-B77C-E1F681422956 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

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 =E2=80=94 running SQL queries on specific databases that = meet certain criteria =E2=80=94 you could write lightweight Ansible = playbooks and let AWX handle the orchestration, scheduling, and = logging.

It=E2=80=99s 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 =C3=A0 06:16, Roland M=C3=BCller <rolmur@gmail.com> a = =C3=A9crit :

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/com= munity/postgresql/index.html

Br
Roland 

Ron Johnson <ronljohnsonjr@gmail.com> = ezt =C3=ADrta (id=C5=91pont: 2025. okt. 16., Cs = 17:12):
On = Thu, Oct 16, 2025 at 9:46=E2=80=AFAM hubert depesz lubaczewski <depesz@depesz.com> 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!

= --Apple-Mail=_FBD08598-E9C3-479E-B77C-E1F681422956--