Re: [ansible-project] kubernetes.core.helm throwing Invalid Syntax

2022-07-20 Thread Abhijeet Kasurde
Python 2 is End of life and not supported by Ansible. Also, kubernetes.core collection is supported on Python3 ( https://github.com/ansible-collections/kubernetes.core#python-support). I would recommend you upgrade to the latest Python version. After installing the latest Python 3 version use ```

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread David Logan
I didn't see the main.yml file and can't comment on your setup. Yes, root should have access however I'm not sure become would carry over all tasks. I thought it was task specific unless you set it in your group vars https://docs.ansible.com/ansible/latest/user_guide/become.html On Thu, 21 Jul

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Todd Lewis
It would have root access — on the target machine, but not on the Ansible controller. On Wednesday, July 20, 2022 at 6:24:24 PM UTC-4 tdub...@gmail.com wrote: > But I used become: in my main.yml > > Would that have root access? > -- You received this message because you are subscribed to the

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Tony Wong
But I used become: in my main.yml Would that have root access? On Wed, Jul 20, 2022 at 3:13 PM David Logan wrote: > Usually the .ssh/authorized_key file has fairly specific permissions (rw > user only) as does the .ssh directory. It may well be the ansible user > cannot see the files in the

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread David Logan
Usually the .ssh/authorized_key file has fairly specific permissions (rw user only) as does the .ssh directory. It may well be the ansible user cannot see the files in the .ssh directory as it may not have the correct permissions. On Thu, 21 Jul 2022 at 07:37, Tony Wong wrote: > now different

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Tony Wong
now different error TASK [rancherpocreplay : Setup authkeys for user rke] ** [WARNING]: Unable to find '/home/rke/.ssh/id_rsa.pub' in expected paths (use -v to see paths) fatal: [k8master]: FAILED! => {"msg": "An unhandled exception occurred

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Todd Lewis
Mustaches never nest. key: "{{ lookup('file', '/home/' ~ username ~ '/.ssh/id_rsa.pub') }}" On Wednesday, July 20, 2022 at 5:37:15 PM UTC-4 tdub...@gmail.com wrote: > tried this way and got same error > > - name: Setup authkeys for user rke > authorized_key: > user: '{{ username }}' >

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Tony Wong
tried this way and got same error - name: Setup authkeys for user rke authorized_key: user: '{{ username }}' state: present key: "{{ lookup(‘file’, '/home/{{ username }}/.ssh/id_rsa.pub') }}" On Wed, Jul 20, 2022 at 2:12 PM Tony Wong wrote: > can i use jinja like this? > > -

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Tony Wong
can i use jinja like this? - name: Setup authkeys for user rke authorized_key: user: rke state: present key: “{{ lookup(‘file’, ‘{{ authorized_key }}’) }}” keep getting error Setup authkeys for user rke] *** fatal: [k8master]: FAILED! =>

[ansible-project] Ansible skipping other hosts

2022-07-20 Thread boncalo mihai
Hi, I have some tasks in a role that creates .ssh directory, generates a key on one of the servers, copy the public key on local and then run authorized_key module to copy the public key in the other nodes. The problem is that after generating the key with the condition that gets executed only on

Re: [ansible-project] Get list of failed instances

2022-07-20 Thread Vinita Shah
This helped. Thank you so much. Much appreciated. On Monday, July 18, 2022 at 11:54:25 PM UTC-7 vbo...@gmail.com wrote: > On Mon, 18 Jul 2022 22:39:49 -0700 (PDT) > Vinita Shah wrote: > > > I have a dynamic inventory of hosts. *How do I get a list of failed > > instances?* > > For example, >

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread boncalo mihai
Just did that, you use authorized_key module On Wed, Jul 20, 2022 at 4:24 PM Tony Wong wrote: > how do I lookup id_rsa.pub on a host and then run ansible playbook to copy > it to their authorized_key file? > > > -- > You received this message because you are subscribed to the Google Groups >

Re: [ansible-project] display information returned with debug in a more usable layout

2022-07-20 Thread Vladimir Botka
On Wed, 20 Jul 2022 14:48:51 +0200 (CEST) dulhaver via Ansible Project wrote: > I see there is a lot to learn and understand yet (in this case "use > of variables" for example). > > > - hosts: all > > > vars: > > > ansible_user: gwagner > > > ver: "{{ ansible_play_hosts| > > >

Re: [ansible-project] identation and spaces with lininfile

2022-07-20 Thread Mike Eggleston
Add spaces inside the double quote? Mike > On Jul 20, 2022, at 11:44, Tony Wong wrote: > > I am really stuck trying to insert a line with lineinfile with 5 space > indentation > > any idea? > > task is > > - name: add line > lineinfile: > backup: no > #backrefs: yes > state: present >

[ansible-project] identation and spaces with lininfile

2022-07-20 Thread Tony Wong
I am really stuck trying to insert a line with lineinfile with 5 space indentation any idea? task is - name: add line lineinfile: backup: no #backrefs: yes state: present path: "{{ file_path }}" #regexp: '^(\s*)[#]?{{ item.search }}(: )*' insertafter: "{{ line.replace_with }}" *line: "\n{{

Re: [ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Dick Visser
1. https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_lookup.html 2. https://docs.ansible.com/ansible/latest/collections/ansible/posix/authorized_key_module.html On Wed, 20 Jul 2022 at 15:24, Tony Wong wrote: > > how do I lookup id_rsa.pub on a host and then run ansible

[ansible-project] how do i lookup id_rsa.pub on a host and copy it to authorized keys on multiple servers

2022-07-20 Thread Tony Wong
how do I lookup id_rsa.pub on a host and then run ansible playbook to copy it to their authorized_key file? -- 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

Re: [ansible-project] display information returned with debug in a more usable layout

2022-07-20 Thread dulhaver via Ansible Project
thnks, that worked (of course). I try not to be embarrased too much for having someone spelling this outfor me like this :-). Hopefully I'll be able to pay back to this list later down the road. I see there is a lot to learn and understand yet (in this case "use of variables" for example).

[ansible-project] kubernetes.core.helm throwing Invalid Syntax

2022-07-20 Thread DEEPANSHU DANG
Hi team, I'm running ansible on centos 7 in which python 2 coming by default and some dependencies like yum etc is depended on that. When Ansible is install it picking the default python2 as INTERPRETER Ansible --version ansible 2.9.27 config file = /etc/ansible/ansible.cfg configured module

Re: [ansible-project] display information returned with debug in a more usable layout

2022-07-20 Thread Vladimir Botka
You're welcome. Put the declarations of *ver* and *pkg* into the *vars*. I edited your code in-line On Wed, 20 Jul 2022 13:48:40 +0200 (CEST) Gunnar Wagner wrote: > - hosts: all > vars: > ansible_user: gwagner > ver: "{{ ansible_play_hosts| > map('extract', hostvars,

Re: [ansible-project] display information returned with debug in a more usable layout

2022-07-20 Thread dulhaver via Ansible Project
thx for the suggestions. I am sure they are grant, but I seem not to be at level to put them to work correctly yet. So, would you mind to specify how to utilize those lines successfully? my interpretation looked like this: # playbook # - hosts:

[ansible-project] find element with dictionary in Ansible and return value

2022-07-20 Thread maulik patel
hi , i'm trying to value of one yaml file1 with another file2 which has list of dict and if element if file1 matched with key/value of file2 then need to use value of file1 need to use as a key of file2 and return value of it... not sure how we can leverage "when" condition or might any other