Re: [ansible-project] create variable from value gathered on remote

2022-09-26 Thread Todd Lewis
Better put a `-n` on that `sort`. On Tuesday, September 20, 2022 at 5:13:40 AM UTC-4 dulh...@mailbox.org wrote: > this is how I manged this in the end. probably the solution suggested by > @Vladimit Botka is more scientific but I could not indorporate the find > operation required with the res

Re: [ansible-project] create variable from value gathered on remote

2022-09-20 Thread dulhaver via Ansible Project
this is how I manged this in the end. probably the solution suggested by @Vladimit Botka is more scientific but I could not indorporate the find operation required with the rest of the suggestion ###

Re: [ansible-project] create variable from value gathered on remote

2022-09-19 Thread dulhaver via Ansible Project
> On 09/19/2022 4:25 PM CEST Todd Lewis wrote: > > do this: > >loop: "{{ found_files.files | map(attribute='path') | map('basename') | > list }}" great, that works. So one part of the puzzle is solved, thx -- You received this message because you are subscribed to the Google Groups "A

Re: [ansible-project] create variable from value gathered on remote

2022-09-19 Thread Todd Lewis
You're so close. You're passing in a list as a single item. Instead of loop: - "{{ found_files.files | map(attribute='path') | map('basename') | list }}" do this: loop: "{{ found_files.files | map(attribute='path') | map('basename') | list }}" On 9/19/22 10:06 AM, dulhaver via Ansi

Re: [ansible-project] create variable from value gathered on remote

2022-09-19 Thread dulhaver via Ansible Project
I manage to get something like this from a set_fact following the find TASK TASK [creating a list with the filenames] * task path: /home/gwagner/repos/ansible/open_source/postgres_create_service/tasks/fetchsomething.yml:20 ok: [vm-4140

Re: [ansible-project] create variable from value gathered on remote

2022-09-19 Thread Vladimir Botka
On Mon, 19 Sep 2022 12:23:14 +0200 (CEST) dulhaver via Ansible Project wrote: > ... does not localize the files I am looking for. > >- name: fetch all .env files to fetched > ansible.builtin.fetch: >src: /opt/db/postgres/bin/.pg*env >dest: fetched/ >flat: true >

Re: [ansible-project] create variable from value gathered on remote

2022-09-19 Thread dulhaver via Ansible Project
Thanks Vladimir ... that looks pretty sophisticated (almost out of sight-ish) ... but could be a nice challenge to even understand what is going on :-) so far I detected one challenge. Maybe my initial question has not been sufficientely explicit with this. I run this against a single host that

Re: [ansible-project] create variable from value gathered on remote

2022-09-16 Thread Vladimir Botka
For example, given the files shell> ssh admin@test_11 cat /tmp/.env SMTPPORT: 5432 POPPORT: 5431 PGPORT: 5433 shell> ssh admin@test_12 cat /tmp/.env SMTPPORT: 4432 POPPORT: 4431 PGPORT: 4433 shell> ssh admin@test_13 cat /tmp/.env SMTPPORT: 3432 POPPORT: 3431 PGPORT: 3433 Fetch the files and dec

Re: [ansible-project] create variable from value gathered on remote

2022-09-16 Thread Brian Coca
Dick above gave a better answer, but just to have the original question literally answered: - shell: grep -r 'PGPORT=' /opt/db/postgres/bin/ | cut -d: -f2 | cut -d= -f2 | tail -1 register: myport myport['stdout'] will have the value you want -- -- Brian Coca -- You received th

Re: [ansible-project] create variable from value gathered on remote

2022-09-16 Thread Dick Visser
On Fri, 16 Sept 2022 at 15:19, dulhaver via Ansible Project < ansible-project@googlegroups.com> wrote: > 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

[ansible-project] create variable from value gathered on remote

2022-09-16 Thread dulhaver via Ansible Project
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