Re: [ansible-project] Keeping inventory and other data separate from code

2022-04-01 Thread Nico Kadel-Garcia
On Fri, Apr 1, 2022 at 10:27 PM Richard Hector  wrote:
>
> Hi all,
>
> Currently my inventory is stored in the same git repo as my play(book)s,
> roles etc, which I don't like.

Consider using git submodules if you want a unified workspace.

> What are common ways to avoid this? Perhaps keep inventory in a subdir
> which is .gitignored, and make that a separate repo?
>
> I also want to keep data which is not strictly inventory - eg lists of
> users, ssh keys etc which are specific to my site/business, but shared
> across many hosts and groups. I think I need to use lookups to access
> this. Perhaps that data and inventory can go together in that other repo?
>
> eg:
>
> /home/richard/ansible/
>.git/
>  .gitignore (ansible/data)
>.ansible.cfg
>/data
>  .git/
>  /inventory
>hosts
>/host_vars
>/group_vars
>  users.yml
>/plays
>/roles
>
> Does that seem reasonable?
>
> That way, if (when) I have questions in the future, I can refer you all
> to my ansible repo without sharing the private data :-)
>
> Are there better ways to do this?
>
> Cheers,
> Richard
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/c0b602a7-b40e-7254-f153-c98a49dd3046%40walnut.gen.nz.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOCN9ryjniK1KgQ33d3-RW0xLK-NM6Zz%3DJoEbyVDJy_LYxKJQw%40mail.gmail.com.


[ansible-project] Keeping inventory and other data separate from code

2022-04-01 Thread Richard Hector

Hi all,

Currently my inventory is stored in the same git repo as my play(book)s, 
roles etc, which I don't like.


What are common ways to avoid this? Perhaps keep inventory in a subdir 
which is .gitignored, and make that a separate repo?


I also want to keep data which is not strictly inventory - eg lists of 
users, ssh keys etc which are specific to my site/business, but shared 
across many hosts and groups. I think I need to use lookups to access 
this. Perhaps that data and inventory can go together in that other repo?


eg:

/home/richard/ansible/
  .git/
.gitignore (ansible/data)
  .ansible.cfg
  /data
.git/
/inventory
  hosts
  /host_vars
  /group_vars
users.yml
  /plays
  /roles

Does that seem reasonable?

That way, if (when) I have questions in the future, I can refer you all 
to my ansible repo without sharing the private data :-)


Are there better ways to do this?

Cheers,
Richard

--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c0b602a7-b40e-7254-f153-c98a49dd3046%40walnut.gen.nz.


Re: [ansible-project] [OT?] What do you call a container container?

2022-04-01 Thread Nico Kadel-Garcia
"Container ship" is pretty clear. Others include:

"Tupperware".

"Mixing bowls"

"Measuringcups"

"Russian Dolls"

"Turtles All The Way Down".

"The inevitable product of people taught only recursion as a valid way
to do anything"

"Pay no attention to that server behind the layer of abstraction"

The list could go on and on, much like what you're describing.

On Fri, Apr 1, 2022 at 5:46 PM Richard Hector  wrote:
>
> Hi all,
>
> I have several leased VPS in which I run LXC containers.
>
> At the moment, the group I use for those is "lxc_hosts", but that has a
> few problems:
>
> - Everything in inventory is a host, so lxc_host could just as well be a
>container as the machine it lives on.
>
> - Separators in general are a pain - ansible doesn't like '-' in many
>places; '_' is invalid in hostnames; '.' and '/' are special in loads
>of places, and I suspect everything else is even riskier
>
> 'host' seems the most natural thing for hosting containers but is
> problematic as above. 'container' would be worse, in this context.
>
> This problem gets worse as I do more complex stuff - eg I'm looking into
> using the lxc_ssh module, to manage containers on remote hosts before
> direct ssh is available.
>
> I've been wondering about 'ship' - as in a container ship contains
> shipping containers - but it's not particularly intuitive, if I was eg
> to share my config here to ask for assistance, or (dreaming) if I get to
> the point of having employees or contractors.
>
> Any other suggestions?
>
> Cheers,
> Richard
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/68a20941-f60a-bc5b-6843-8b9c3436b54b%40walnut.gen.nz.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOCN9ryUHOg_zTDhYUxYAqd1WkNHDvPVsTwckxThUR5Pab3JXQ%40mail.gmail.com.


[ansible-project] [OT?] What do you call a container container?

2022-04-01 Thread Richard Hector

Hi all,

I have several leased VPS in which I run LXC containers.

At the moment, the group I use for those is "lxc_hosts", but that has a 
few problems:


- Everything in inventory is a host, so lxc_host could just as well be a
  container as the machine it lives on.

- Separators in general are a pain - ansible doesn't like '-' in many
  places; '_' is invalid in hostnames; '.' and '/' are special in loads
  of places, and I suspect everything else is even riskier

'host' seems the most natural thing for hosting containers but is 
problematic as above. 'container' would be worse, in this context.


This problem gets worse as I do more complex stuff - eg I'm looking into 
using the lxc_ssh module, to manage containers on remote hosts before 
direct ssh is available.


I've been wondering about 'ship' - as in a container ship contains 
shipping containers - but it's not particularly intuitive, if I was eg 
to share my config here to ask for assistance, or (dreaming) if I get to 
the point of having employees or contractors.


Any other suggestions?

Cheers,
Richard

--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/68a20941-f60a-bc5b-6843-8b9c3436b54b%40walnut.gen.nz.


Re: [ansible-project] Convert with_X to loop: but when: condition being ignored?

2022-04-01 Thread Todd Lewis
Ouch! Then you'd have to put the tasks into their own tasks file, and 
use |include_tasks| ...


Or give |backuppc_client_mysql_dump| a reasonable ||default(...)| so 
that the looped task(s) would do no harm.



blocks are not a way to skip tasks, a 'when' on a block is just fortasks inside 
the block to inherit.

So one solution would be to put both tasks in a block, and put the `when: 
backuppc_client_mysql_dump is defined` condition on the block itself.


​

--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4edb8d8a-ce78-f02b-8737-284f7a991e16%40gmail.com.


Re: [ansible-project] Convert with_X to loop: but when: condition being ignored?

2022-04-01 Thread Brian Coca
blocks are not a way to skip tasks, a 'when' on a block is just for
tasks inside the block to inherit.

> So one solution would be to put both tasks in a block, and put the `when: 
> backuppc_client_mysql_dump is defined` condition on the block itself.


-- 
--
Brian Coca

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7f8o2LuTviDZ5eSKyupdCJrAok35rH7RfwujtjuKKN-BQ%40mail.gmail.com.


[ansible-project] How to take a key matches value in fact

2022-04-01 Thread yuvaraj k
json:

"ec2_asg": {
"changed": false,
"failed": false,
"results": [
{ 
"tags": [
{
"key": "peer_discovery_backend",
"propagate_at_launch": true,
"resource_id": "AnsibleASG",
"resource_type": "auto-scaling-group",
"value": "Rabbitmq"
}
]
} 
- name: Find a group with matching name/prefix and tags
  ec2_asg_info:
name: "{{ AUTOSCALING_GROUP_NAME }}"
  register: ec2_asg


- name: ASG Facts
  set_fact:
PEER_DISCOVERY_BACKEND: "{{*ec2_asg | 
json_query('ec2_asg.results[0].tags[0][?key=='peer_discovery_backend'].value*') 
}}"


getting errror

Thanks
Yuvaraj K

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a05e818d-74fe-448d-ac5a-dda2e668a969n%40googlegroups.com.