On 9/16/22 9:08 PM, Evan Hisey wrote:
In a follow up to you line of thought, this really looks a variable
(in the example) better handle by usin ansible vault than a variable
file. It was designed for things like passwords.
Oh, for sure:
*---
# group_vars/all/web_centric_vars.yml
web_foopass:
In a follow up to you line of thought, this really looks a variable (in the
example) better handle by usin ansible vault than a variable file. It was
designed for things like passwords.
On Fri, Sep 16, 2022, 7:59 PM Todd Lewis wrote:
>
>
> On 9/16/22 10:23 AM, Brian Coca wrote:
>
> vars_files:
>
On 9/16/22 10:23 AM, Brian Coca wrote:
vars_files:
- group_vars/web/main.yml
Do not load group_vars/host_vars directly, this is the job of the vars plugin,
you create duplicate entries and mask the actual expected values from
normal precedence resolution.
The vars_files thing was my sugges
Sure. That is the purpose of groups. You can but the entire network in a
single inventory, solit it up by groups and groups of groups, then run play
books only against the groups you want. You can also build them on the
fly.
You can also mix that with logic loops in the playbooks to skip certain
Is it possible to have multiple 'inventories'? Like a touch list and do not
touch list?
On Friday, September 16, 2022 at 2:55:07 PM UTC-4 ehi...@gmail.com wrote:
> If hosts are not in the inventory then they dont exist for Ansible. Group
> variables are different than host variables, by the wa
If hosts are not in the inventory then they dont exist for Ansible. Group
variables are different than host variables, by the way.
On Fri, Sep 16, 2022, 1:41 PM Dick Visser wrote:
> Ok thanks for clearing this up.
> Just to be sure: it is not possible to access variables for hosts that are
> not
Ok thanks for clearing this up.
Just to be sure: it is not possible to access variables for hosts that are
not in the inventory?
On Fri, 16 Sep 2022 at 16:25, Brian Coca wrote:
> > vars_files:
> >- group_vars/web/main.yml
> Do not load group_vars/host_vars directly, this is the job of the
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
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
> vars_files:
>- group_vars/web/main.yml
Do not load group_vars/host_vars directly, this is the job of the vars plugin,
you create duplicate entries and mask the actual expected values from
normal precedence resolution.
> msg: '{{ hostvars[groups[''web''][0]].foopass }}: ''dict object''
has
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
This works in my little test. Worth a try, but this feels shaky.
In your first play, at the same indent level as "tasks:", add
vars_files:
- group_vars/web/main.yml
Then "{{ foopass }}" will be available to your task(s) in that first play.
On Friday, September 16, 2022 at 7:39:45 AM UTC-4 d
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
Honestly this sounds more like a need to revisit how you are handling
variables. You are creating a scoping issue with the current approach. The
all group is were things should live that might need to be accessed by
multiple groups. Specific subgroups are for scope specific variables, so
really sho
In that case, in the first play, do a "debug" and see what variables are
available.
- name: groupvars anybody
debug:
msg: "{{ vars }}"
>From that you should be able to work out what the expression would be, if
there is a way to do it.
On Friday, September 16, 2022 at 7:39:45 AM
Hi
Thanks, but that seems to be making the play conditional on whether there
are any 'web' hosts in the play.
What I am looking for is a way to access those group_vars regardless of
whether there are any such hosts in the play.
On Fri, 16 Sept 2022 at 13:19, Todd Lewis wrote:
> Better:
>
Better:
groups['web'] | default([]) | length
On Friday, September 16, 2022 at 6:50:22 AM UTC-4 Todd Lewis wrote:
> Can you add
> when: groups['web'] | length
> onto the "populate secret for use elsewhere" task?
>
> On Friday, September 16, 2022 at 5:34:37 AM UTC-4 dnmv...@gmail.com wrote:
Hello, I'm working with an employer that is looking to hire (at their
London office) someone capable of fulfilling a head of platform
engineering position. Consequently, I had hoped that some members of
this list may like to discuss further. I can be reached using
"JamesBTobin (at) Gmail (dot) Co
Can you add
when: groups['web'] | length
onto the "populate secret for use elsewhere" task?
On Friday, September 16, 2022 at 5:34:37 AM UTC-4 dnmv...@gmail.com wrote:
> Hi
>
> I have a playbook that contains several plays. One play is performing API
> related tasks in AWS, so it's using the
Hi
I have a playbook that contains several plays. One play is performing API
related tasks in AWS, so it's using the local connection and localhost. The
plays after that targets real hosts.
Pseudo code:
- name: do API related work
hosts: localhost
connection: local
become: false
gather_fa
Hello, I'm working with an employer that is looking to hire (at their
London office) someone capable of fulfilling a head of platform
engineering position. Consequently, I had hoped that some members of
this list may like to discuss further. I can be reached using
"JamesBTobin (at) Gmail (dot) Co
I usually use the python from that venv explicitly in my command, for
example:
/opt/venv/bin/python3 /some/script.py
On Fri, 16 Sep 2022 at 08:28, Fenrir Sivar wrote:
> I would like to run a shell command using a python virtual environment on
> a remote server.
> (collecting static files fo
22 matches
Mail list logo