Ansible - Appending to lists and dictionaries n this blog post I'll show how to add items to lists and dictionaries, when using loops, and across tasks. Normally when trying to add a new item to the variable, while in the loop, or between tasks, Ansible will ovewrite the values, keeping the result of the last iteration. For example, let's see what will be the result of running the following playbook: --- - name: Append to list hosts: localhost vars: cisco: - CiscoRouter01 - CiscoRouter02 - CiscoRouter03 - CiscoSwitch01 arista: - AristaSwitch01 - AristaSwitch02 - AristaSwitch03 tasks: - name: Add Cisco and Airsta devices to the list set_fact: devices: "{{ item }}" with_items: - "{{ cisco }}" - "{{ arista }}" - name: Debug list debug: var: devices verbosity: 0 [przemek@quasar blog]$ ansible-playbook append_list.yml PLAY [Append to list] ****************...
How to set host_key_checking=false in ansible inventory file? Due to the fact that I answered this in 2014, I have updated my answer to account for more recent versions of ansible. Yes, you can do it at the host/inventory level (Which became possible on newer ansible versions ) or global level: inventory : Add the following. ansible_ssh_common_args='-o StrictHostKeyChecking=no' host : Add the following. ansible_ssh_extra_args='-o StrictHostKeyChecking=no' hosts/inventory options will work with connection type ssh and not paramiko . Some people may strongly argue that inventory and hosts is more secure because the scope is more limited. global: Ansible User Guide - Host Key Checking You can do it either in the /etc/ansible/ansible.cfg or ~/.ansible.cfg file: [defaults] host_key_checking = False Or you can setup and env variable (this might not work on newer ansible versions): export ANSIBLE_HOST_KEY_CHECKING=False ...