I am trying to automate the creation of postgresql services on a shared 
postgres Server as my target.

we create an .env file for each service on the target with contains the 
portnumber used for that particular instance. Based on that I detect the 
largest currently reserved postgres port.

I can detect that number by this command on that host (not knowing whether this 
is the most scientific way to do this, but it works). 

   grep -r 'PGPORT=' /opt/db/postgres/bin/ | cut -d: -f2 | cut -d= -f2 | tail -1

It is worth mentioning that port scannic with i.e. netstat can not be utilized 
because it is possible a service may not be running at the time of play which 
might return a false result.

Now I want to create a vairable pg_service_port for my playbook with the next 
larger number detected (if the above returns 5433 the new value 5434 (5433 +1) 
shall be applied for the current run.

can somebody kindly point me to the right approach for such an endeavour? I 
could imagine debug may play a role in this but don't really have much of a 
clue with it.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1581651985.579758.1663334350698%40office.mailbox.org.

Reply via email to