Re: [ansible-project] How to fix this ssh-keyscan problem in my playbook?

2020-01-22 Thread Stefan Hornburg (Racke)
On 1/23/20 12:24 AM, RobertF wrote: > I have an Ansible playbook for provisioning servers.  After the server is > provisioned, I want to remove the old FQDN > and/or hostname alias for that server from my local SSH known_hosts file, > pause until the server is up, and then run the > ssh-keyscan

[ansible-project] Re: The List manipulation doesnt work

2020-01-22 Thread Rakesh Parida
Kindly Help me on this as i am stuck On Thursday, January 23, 2020 at 2:49:28 AM UTC+5:30, Rakesh Parida wrote: > > Hi Ansible Gurus, > > I have created a list and from that list i want to prepare some customise > list as per my need. > But when i execute my playbook i get at last step when i

[ansible-project] I have Ansible and Jenkins installed on Different Servers how can i configure both

2020-01-22 Thread Sai Prasha
I have Ansible and Jenkins on Windows but on different servers how can i establish a connection between this two to trigger a playbook based on inventory files What is the inventory path to be given? My inventory file is as shown below [win] 10.96.43.61 10.96.43.177 [win:vars]

Re: [ansible-project] Export in-memory inventory to yml or ini file

2020-01-22 Thread Mike V
I played around some more and was able to figure it out. thanks for teaching me how to fish. On Wed, Jan 22, 2020 at 4:35 PM Mike V wrote: > Works great! I never used templates, just a little bit more help, how do > I export the host variables and group variables too? > Thank you! > > On Wed,

Re: [ansible-project] Export in-memory inventory to yml or ini file

2020-01-22 Thread Mike V
Works great! I never used templates, just a little bit more help, how do I export the host variables and group variables too? Thank you! On Wed, Jan 22, 2020 at 4:20 PM Vladimir Botka wrote: > On Wed, 22 Jan 2020 16:10:42 -0800 > Mike V wrote: > > > I have a playbook that generates in-memory

Re: [ansible-project] Export in-memory inventory to yml or ini file

2020-01-22 Thread Vladimir Botka
On Wed, 22 Jan 2020 16:10:42 -0800 Mike V wrote: > I have a playbook that generates in-memory inventory. The hosts are part > of multiple groups. Is there a module or easy way to export the in-memory > inventory to an output file? Yes. It is. For example use this template {% for group in

[ansible-project] Export in-memory inventory to yml or ini file

2020-01-22 Thread Mike V
I have a playbook that generates in-memory inventory. The hosts are part of multiple groups. Is there a module or easy way to export the in-memory inventory to an output file? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy Malhan
Hi Jordan, thanks for explaining. My question was referenced to the playbook that you gave me as it says *Upgrades*. I thought if we run this it is automatically going to upgrade everything in windows host but it didn't. tasks: - name: Install all security, critical, and rollup updates

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jordan Borean
Please read through the doc for win_updates again https://docs.ansible.com/ansible/latest/modules/win_updates_module.html. I've told you multiple times why updates can be filtered and in your case it's because the categories you specify don't match up with the updates that are available. Even

[ansible-project] How to fix this ssh-keyscan problem in my playbook?

2020-01-22 Thread RobertF
I have an Ansible playbook for provisioning servers. After the server is provisioned, I want to remove the old FQDN and/or hostname alias for that server from my local SSH known_hosts file, pause until the server is up, and then run the ssh-keyscan command to add the new server's public SSH

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy Malhan
why did it filter this time? I don't understand... --- - hosts: windows vars: ansible_connection: winrm ansible_ssh_port: 5986 anisble_winrm_transport: kerberos ansible_winrm_server_cert_validation: ignore validate_certs: false ansible_winrm_scheme: https

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy Malhan
1. Well we provided *reboot: yes * doesn't it suppose to make mandatory reboot by itself? 2. I used the same playbook to a different instance. For some reason, it filtered out the required information but didn't install. root@ip-10-0-2-209:/etc/ansible/windows-playbook# ansible-playbook

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jordan Borean
According to https://docs.microsoft.com/en-us/previous-versions/windows/desktop/hh968413(v=vs.85), the HRESULT value 0x80240016 corresponds to WU_E_INSTALL_NOT_ALLOWED Operation tried to install while another installation was in progress or > the system was pending a mandatory restart. >

Re: [ansible-project] Filtering a complex list of dictionaries into another list of dictionaries in an efficient way

2020-01-22 Thread Vladimir Botka
On Wed, 22 Jan 2020 21:49:43 +0100 Vladimir Botka wrote: > The task below does the job > > - set_fact: > result_list: "{{ result_list| > default([]) + [ > dict(keys| > zip(keys| >

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy Malhan
root@ip-10-0-2-209:/etc/ansible/windows-playbook# ansible-playbook upgrades.yml -vvv ansible-playbook 2.9.2 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location =

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy Malhan
*I ran through an error * *here is the playbook : - * --- - hosts: windows vars: ansible_connection: winrm ansible_ssh_port: 5986 anisble_winrm_transport: kerberos ansible_winrm_server_cert_validation: ignore validate_certs: false ansible_winrm_scheme: https

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jordan Borean
So read your filtered updates list, you can see both updates are in there ok: [MQN-CKMH5E31UM7.corp.medqia.com] => { "changed": false, "filtered_updates": { "20668013-76d9-43ec-a6f2-f76fb4271642": { "categories": [ "Definition Updates",

Re: [ansible-project] How do I include another playbook in current playbook?

2020-01-22 Thread Xinhuan Zheng
> Take a look again at the example in > https://docs.ansible.com/ansible/latest/modules/import_playbook_module.html. > > To me it does not know where > > > roles: > - role: testrole1 > tags: testrole1 > > belongs. Should it be > > - hosts: mywebservers > gather_facts:

Re: [ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy Malhan
Attached is the target host and it shows that it needs to be updated. I have provided the update in KB number but it's not working. and it's not rebooting too. [image: target host.PNG] On Wed, Jan 22, 2020 at 1:17 PM Jordan Borean wrote: > Have a look through your output, the

[ansible-project] The List manipulation doesnt work

2020-01-22 Thread Rakesh Parida
Hi Ansible Gurus, I have created a list and from that list i want to prepare some customise list as per my need. But when i execute my playbook i get at last step when i want to see my customised list i get an error . Can someone guide me where i am doing wrong. TASK [Display Lists]

[ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jordan Borean
Have a look through your output, the "filtered_updates" key show all the updates that the Windows Update Agent can find and also displays why they have been filtered in the win_updates task. So there's nothing the win_updates module is set to do because Windows is reporting no updates are

Re: [ansible-project] How do I include another playbook in current playbook?

2020-01-22 Thread Mauricio Tavares
On Wed, Jan 22, 2020 at 3:47 PM Xinhuan Zheng wrote: > > Hello, > > I created a playbook which needs to call another playbook. This is my current > playbook: > > --- > # file: current_playbook.yml > > - hosts: mywebservers > gather_facts: yes > > #- import_playbook: another.yml > > roles: >

[ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy
*Can you give me an example that how to specify the category KB update applies too* *Here is the output: - * ansible-playbook windows.yml -vvvansible-playbook 2.9.2 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules',

Re: [ansible-project] Filtering a complex list of dictionaries into another list of dictionaries in an efficient way

2020-01-22 Thread Vladimir Botka
On Wed, 22 Jan 2020 10:32:56 -0800 (PST) jean-christophe manciot wrote: > list: > - key1: > - 'abc' > - 'def' > key2: 'ghi' > key3: 'jkl' > - key1: > - 'mno' > - 'pqr' > key3: 'stu' > key4: 'dfg' > - key1: >

[ansible-project] How do I include another playbook in current playbook?

2020-01-22 Thread Xinhuan Zheng
Hello, I created a playbook which needs to call another playbook. This is my current playbook: --- # file: current_playbook.yml - hosts: mywebservers gather_facts: yes #- import_playbook: another.yml roles: - role: testrole1 tags: testrole1 post_tasks: - name: Install

[ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jordan Borean
That's probably because win_updates runs on various filters, you can't just specify the KB, you also need to specify the category the update applies to. If you run with -vvv you can see all the updates that have been filtered (skipped) and the categories they apply to. If the update is not in

[ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy
But the target host has not achieved the desired result like it's not updating/upgrading the OS based on KB number provided and is not rebooting. Any ideaa? On Wednesday, January 22, 2020 at 12:21:15 PM UTC-8, Jordan Borean wrote: > > It's showing OK because there was the state was already

[ansible-project] Re: Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jordan Borean
It's showing OK because there was the state was already achieved. Ansible is running and the modules you are running with just have nothing to do. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

Re: [ansible-project] Add host using add_host not taking effect

2020-01-22 Thread Kai Stian Olstad
On 22.01.2020 19:55, Vladimir Botka wrote: On Wed, 22 Jan 2020 19:15:27 +0100 Kai Stian Olstad wrote: > - name: add host > add_host: > name: 'test' > groups: all There is no point in adding a host to all, the all group are a special group that all hosts is a member of. The

[ansible-project] Ansible playbook is not working on the target host but shows in play recap - OK

2020-01-22 Thread Jimmy
Nothing changed on the target host, not even rebooted but able to ping and can do a handshake Playbook - PLAY [windows] * TASK

Re: [ansible-project] Add host using add_host not taking effect

2020-01-22 Thread Vladimir Botka
On Wed, 22 Jan 2020 19:15:27 +0100 Kai Stian Olstad wrote: > > - name: add host > > add_host: > > name: 'test' > > groups: all > There is no point in adding a host to all, the all group are a special > group that all hosts is a member of. The point is to add a host that hasn't

[ansible-project] Filtering a complex list of dictionaries into another list of dictionaries in an efficient way

2020-01-22 Thread jean-christophe manciot
*ansible 2.9.4* Let's assume the following list of dictionaries: list: - key1: - 'abc' - 'def' key2: 'ghi' key3: 'jkl' - key1: - 'mno' - 'pqr' key3: 'stu' key4: 'dfg' - key1: - 'vwx' - 'yza'

Re: [ansible-project] Add host using add_host not taking effect

2020-01-22 Thread Kai Stian Olstad
On 22.01.2020 18:46, Punit Jain wrote: run.yml -- --- - hosts: all connection: local gather_facts: no tasks: - name: include role task include_role: name: role1 tasks_from: hello - hosts: all connection: local gather_facts: no tasks: - name:

Re: [ansible-project] Add host using add_host not taking effect

2020-01-22 Thread Punit Jain
In below usecase it is not working: run.yml -- --- - hosts: all connection: local gather_facts: no tasks: - name: include role task include_role: name: role1 tasks_from: hello - hosts: all connection: local gather_facts: no tasks: - name:

[ansible-project] Re: How to specify the user home directory dynamatically with /home/{{ 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?

2020-01-22 Thread FRANK L
Dick, Thanks for the suggestion. We use visudo for editing the sudoers file in the first place. So if any mistakes made we could catch up in the first place. Your suggestion is the good one, and I like it. Frank On Tuesday, January 21, 2020 at 9:07:45 PM UTC-5, FRANK L wrote: > > Hi, >

Re: [ansible-project] Add host using add_host not taking effect

2020-01-22 Thread Vladimir Botka
On Wed, 22 Jan 2020 21:32:54 +0530 Punit Jain wrote: > - hosts: all > connection: local > gather_facts: no > > tasks: > - name: add host > add_host: > name: 'testserver' > groups: all > > - name: refresh > meta: refresh_inventory > > - name: print

Re: [ansible-project] Re: Ansible passwordless login not working

2020-01-22 Thread Yehuda Pinhas
Yea you are right. I am hitting this bug and I can't see myself pulling this off. I'll just go with the pubkey method although I wanted to avoid it because I have lots of network devices. But no choice here because Ansible is not going to work without SSH keys on these IOS versions. FYI, This

[ansible-project] Add host using add_host not taking effect

2020-01-22 Thread Punit Jain
Hi, I am doing a very straight forward testing of adding a new host dynamically. --- - hosts: all connection: local gather_facts: no tasks: - name: add host add_host: name: 'testserver' groups: all - name: refresh meta: refresh_inventory - name:

[ansible-project] Re: How to specify the user home directory dynamatically with /home/{{ 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?

2020-01-22 Thread FRANK L
Hi Michael, Thanks for the tip. Yes, it works. Frank On Tuesday, January 21, 2020 at 9:07:45 PM UTC-5, FRANK L wrote: > > Hi, > > I would like to use git for managing Ansible playbooks for version control > on an admin server in GCP. So the idea is this: > each user in the admin group

Re: [ansible-project] How to specify the user home directory dynamatically with /home/{{ 'echo{$USER}' }}/sub_dir for copying files with Ansible copy module ?

2020-01-22 Thread Dick Visser
Also, use the 'validate' parameter when you're deploying sudoers files. Without this, mistakes can cause you to completely lose access. On Wed, 22 Jan 2020 at 03:07, FRANK L wrote: > Hi, > > I would like to use git for managing Ansible playbooks for version control > on an admin server in

Re: [ansible-project] Update hostname based on IP

2020-01-22 Thread Dick Visser
https://docs.ansible.com/ansible/latest/modules/hostname_module.html ‪On Wed, 22 Jan 2020 at 09:17, ‫דודו דודו‬‎ wrote:‬ > Hi, > I would like to update hostname based on server IP. > In my ansible host, I have a group that includes 5 servers IP, for each > server, I will need to define

Re: [ansible-project] ansible playbook error

2020-01-22 Thread Vivek Kothawale
Hi Sandy, The issue is with indentation Under tasks you have to give two white space to make it indent Try following tasks: - name: something Let me know if you have any issue. Thanks, Vivek On Wed, Jan 22, 2020, 2:31 PM Sandy Hung wrote: > ERROR! unexpected parameter type in

Re: [ansible-project] Re: Ansible passwordless login not working

2020-01-22 Thread Phil Griffiths
I only removed the SSH key to remove pub key authentication from the router. As it’s the first authentication protocol used, the ansible command was ignoring the passed in username/password. It was for testing only. Your router config does pub key -> kbd interactive -> password authentication

[ansible-project] ansible playbook error

2020-01-22 Thread Sandy Hung
ERROR! unexpected parameter type in action: The error appears to be in '/home/sandy/phpldapadmin.yml': line 8, column 6, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - name: install phpopenldap ^ here

[ansible-project] Update hostname based on IP

2020-01-22 Thread דודו דודו
Hi, I would like to update hostname based on server IP. In my ansible host, I have a group that includes 5 servers IP, for each server, I will need to define hostname name based on the IP. [web server] 130.1.1.1 130.1.1.2 130.1.1.3 130.1.1.4 130.1.1.5 130.1.1.1 >> web-1 130.1.1.2 >> web-2

Re: [ansible-project] Re: Ansible passwordless login not working

2020-01-22 Thread Yehuda Pinhas
[ansible@Netauto-Dev new_vlan]$ ansible -m ios_command -e commands='sh ip int br' -i /etc/ansible/inventory/ R-TEST-SNIF -e 'ansible_connection=network_cli' -e 'ansible_network_os=ios' -e 'remote_user=ansible' -k SSH password: [WARNING]: Found variable using reserved name: remote_user