Run a task only on remote host if this hosts a specific database

Hello,

I’m looking for ideas on how I can realize the following:

I wan’t to change some database parameters on a specific database. I’ve several ideas but I’m not sure how to realize this.
For example:

  • Having local facts defined on remote machine containing a list of databases running on this host
  • Having local list of host-database-relationship on the ansible host itself

Does anyone of you have an better idea?

thanks
Christian

Hi Christian,

- Having local facts defined on remote machine containing a list of
databases running on this host
- Having local list of host-database-relationship on the ansible host itself

Does anyone of you have an better idea?

If I was going to have multiple tasks interacting with the list of
databases I think I would go the fact route.

Otherwise I would probably run a command that listed the databases,
register it in a variable and then do things in later tasks based on
that variable.

Cheers,
Andy