Re: [ansible-project] create ansible download archive (zip or gz) which is installable locally without internet

2023-04-18 Thread for tan
Mssge received. Was sort of trying to comply with requests & fit into whatever practices were in place when i arrived on project team. sounds like u r ahead of us on all u have shared. will go with this & share with team. Thx again ! On Tue, Apr 18, 2023, 8:16 PM Nico Kadel-Garcia wrote

Re: [ansible-project] create ansible download archive (zip or gz) which is installable locally without internet

2023-04-18 Thread Nico Kadel-Garcia
On Tue, Apr 18, 2023 at 9:38 PM for tan wrote: > > Thats great. And could likely use this as is , at times, sometimes... but > the liklihood this gz bundle is exactly as we need it to be each time we need > it, is not likely. That's why pypi.org publishes these with release numbers, and for m

Re: [ansible-project] create ansible download archive (zip or gz) which is installable locally without internet

2023-04-18 Thread for tan
Thats great. And could likely use this as is , at times, sometimes... but the liklihood this gz bundle is exactly as we need it to be each time we need it, is not likely. What would be the recipe to creat this so can add delete chane parts as needed. I scrounged up this skeleton to create a rem

Re: [ansible-project] create ansible download archive (zip or gz) which is installable locally without internet

2023-04-18 Thread Nico Kadel-Garcia
On Tue, Apr 18, 2023 at 3:40 PM for tan wrote: > > > how can we download ( not install - at least for now) all files for ansible > to a zip ? It's published as a gzip: https://files.pythonhosted.org/packages/source/a/ansible-7.4.0.tar.gz These are consistently published at pypi.org:

[ansible-project] create ansible download archive (zip or gz) which is installable locally without internet

2023-04-18 Thread for tan
how can we download ( not install - at least for now) all files for ansible to a zip ? and then - later on ( not immediately) use this downloaded archive to install ansible to create new or existing ansible or non ansible host ( Why they want to do zip/gz vs installing via "sudo pip Inst

Re: [ansible-project] copy files based on descending precedence

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
My sense is they are searching from most specific to least specific file. The first one they find they use. The remaining params are hardcoded. We do a similar thing when looking for vars files. We might search for RedHat8, then RedHat, then Linux. - name: Add OS specific variables for {{ ansib

Re: [ansible-project] merging lists

2023-04-18 Thread Vladimir Botka
On Tue, 18 Apr 2023 10:40:40 -0400 Todd Lewis wrote: > - debug: msg="{{ [list_12, list_34, list_56] | sum(start=[]) }}" Isn't *flatten* simpler? - debug: msg="{{ [list_12, list_34, list_56] | flatten }}" -- Vladimir Botka -- You received this message because you are subscribed t

Re: [ansible-project] random length password

2023-04-18 Thread Matt Martz
I believe this is roughly what you want: {{ lookup('ansible.builtin.password', '/dev/null', chars=['ascii_letters', 'digits'], length=range(8, 12)|random) }} 1. You cannot nest {{ }} 2. Instead of `range(8-12)` I think you want `range(8, 13)`. First you want a comma, and then range is non-inclus

Re: [ansible-project] Re: copy files based on descending precedence

2023-04-18 Thread Todd Lewis
It seems to me that you're re-implementing variable precedence, but only for one variable. What if, in group_vars/all, you define    access_conf_src_file: access.conf Then in your group_vars//whatever/ (for relevant groups of course, for which the other one isn't specific enough), you define   

Re: [ansible-project] random length password

2023-04-18 Thread Kathy Lyons
I looked at that, but we want to vary the length of the password each time this is run. On Tue, Apr 18, 2023 at 12:30 PM Abhijeet Kasurde wrote: > Have you tried - > > - name: Generate random string with length 12 > ansible.builtin.debug: > var: lookup('community.general.random_string', le

Re: [ansible-project] merging lists

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
And if you really wanted only unique list items this also works ... - debug: msg="{{ [listb] | sum(start=lista) | unique }}" Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123 On Apr 18, 2023, at 12:44 PM, 'Rowe, Walter P. (Fed)' via Ansible Project wr

Re: [ansible-project] merging lists

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
I just tested and this also works. - debug: msg="{{ [listb] | sum(start=lista) }}" Walter On Apr 18, 2023, at 11:01 AM, Michael DiDomenico wrote: agreed, brillant. i'll give that a whirl, but it looks like exactly what i'm after. thanks On Tue, Apr 18, 2023 at 10:40 AM Todd Lewis wrote

Re: [ansible-project] copy files based on descending precedence

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
I'm not sure what value the with_items adds to this. Its all hardcoded values so why not hard code them into the parameters of the task? ansible.builtin.copy: src: "{{ lookup('ansible.builtin.first_found', findme) }}" dest: "/etc/security/access.conf" owner: "root" group: "root" m

Re: [ansible-project] random length password

2023-04-18 Thread Abhijeet Kasurde
Have you tried - - name: Generate random string with length 12 ansible.builtin.debug: var: lookup('community.general.random_string', length=12) # Example result: ['Uan0hUiX5kVG'] On Tue, Apr 18, 2023 at 7:40 AM Kathy L wrote: > Currently we are using pwgen to generate our random length

[ansible-project] Re: copy files based on descending precedence

2023-04-18 Thread Michael DiDomenico
i managed to come up with this, but seems like it could be cleaner --- - name: copy pam etc/security/access.conf file vars: findme: | {%- set findme = [] -%} {%- for groupn in group_names -%} {{- findme.append('files/' + item.src + '_AG' + groupn) -}} {%- endfor -%}

[ansible-project] copy files based on descending precedence

2023-04-18 Thread Michael DiDomenico
the below block is an example block i use in a few places to copy in config files and select a host specific file if it exists. not sure if it's the best way, but it works for now. what i'd like to do is add in group selection as well. ie if there's group file look for that first so above line

Re: [ansible-project] merging lists

2023-04-18 Thread Michael DiDomenico
agreed, brillant. i'll give that a whirl, but it looks like exactly what i'm after. thanks On Tue, Apr 18, 2023 at 10:40 AM Todd Lewis wrote: > > Also, by using the sum() filter: > > [utoddl@tango ansible]$ cat foo.yml > --- > - name: test lists > become: false > gather_facts: false > hos

Re: [ansible-project] merging lists

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
Brilliant! Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123 On Apr 18, 2023, at 10:40 AM, Todd Lewis wrote: Also, by using the sum() filter: [utoddl@tango ansible]$ cat foo.yml --- - name: test lists become: false gather_facts: false hosts: localho

Re: [ansible-project] random grub password

2023-04-18 Thread 'Matt Zagrabelny' via Ansible Project
On Thu, Mar 30, 2023 at 3:55 AM Kathy L wrote: > I currently have a task that adds a grub password so if the user wants to > change anything in grub they have to enter the proper user and password. > > The problem is that I have it working only when I generate the password by > hand using grub-mk

Re: [ansible-project] merging lists

2023-04-18 Thread Todd Lewis
Also, by using the sum() filter: [utoddl@tango ansible]$ cat foo.yml --- - name: test lists become: false gather_facts: false hosts: localhost vars: list_12: - { one: 'str1', two: 'str2' } list_34: - { three: 'str3', four: 'str4' } list_56: - { five: 'str5',

[ansible-project] random length password

2023-04-18 Thread Kathy L
Currently we are using pwgen to generate our random length passwords, but we would like to use an Ansible module to make things easier. What I have is not working - set_fact: user_password: "{{ lookup('ansible.builtin.password', chars=['ascii_letters', 'digits'], length = {{ range(8-12)|ra

Re: [ansible-project] random grub password

2023-04-18 Thread Kathy L
Thanks for that. Guess I need to learn more about the stdout options On Sunday, April 16, 2023 at 2:29:07 PM UTC-4 Kai Stian Olstad wrote: > On 12.04.2023 11:52, Kathy L wrote: > > That is pretty cool. Mgmt is not thrilled with using a filter and want > > me > > to see if I can do it another way

Re: [ansible-project] merging lists

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
% cat foo.yml --- - name: test lists become: false gather_facts: false hosts: localhost vars: lista: - { one: 'str1', two: 'str2' } listb: - { three: 'str3', four: 'str4' } tasks: - debug: var=lista - debug: var=listb - set_fact: li

Re: [ansible-project] merging lists

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
This isn't a double expansion of listb. lista and listb happen to have the same values. change one of them and run the playbook to prove it. Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123 On Apr 18, 2023, at 9:07 AM, Michael DiDomenico wrote: On Tue, A

Re: [ansible-project] merging lists

2023-04-18 Thread Michael DiDomenico
On Tue, Apr 18, 2023 at 8:56 AM 'Rowe, Walter P. (Fed)' via Ansible Project wrote: > > TASK [debug] > *** > ok: [localhost] => { > "listb": [ > [ > { > "

Re: [ansible-project] merging lists

2023-04-18 Thread 'Rowe, Walter P. (Fed)' via Ansible Project
--- - name: test lists become: false gather_facts: false hosts: localhost vars: lista: - { one: 'str1', two: 'str2' } listb: - { one: 'str1', two: 'str2' } tasks: - debug: var=lista - debug: var=listb - set_fact: listb: [ "{{ lista + listb }}" ]

[ansible-project] slim vs fat ansible

2023-04-18 Thread Dick Visser
Hii We use ansible in a few dozen separate virtualenvs, which causes quite a lot of disk space to be used because of the large number of included collections. Rather than starting another discussion about that, I wanted to share a shell helper that installs a slimmed down ansible version: https:/

Re: [ansible-project] merging lists

2023-04-18 Thread Dick Visser
On Tue, 18 Apr 2023 at 00:22, Michael DiDomenico wrote: > i want to do this, but i'm not getting exactly what i want > > lista: > - { one: 'str1', two: 'str2' } > > listb: > - "{{ lookup('vars','lista') }}" > - { one: 'str1', two: 'str2' } > > the output i want is > > listb: > { one: 'str1', two: