- name: Generate distro-vars.yml in ansible directory block: - set_fact: t: distro: "{{ distro }}" - copy: content: '{{ t| to_nice_yaml }}' dest: ./ansible/distro-vars.yml - name: copy vagrant generated inventory file - local machine copy: src: .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory dest: ./vagrant_ansible_inventory - name: adapt inventory - ssh options blockinfile: path: ./vagrant_ansible_inventory block: | [all:vars] ansible_ssh_common_args='-o StrictHostKeyChecking=no' - name: copy vagrant generated inventory file - setup machine copy: src: ./vagrant_ansible_inventory dest: ./ansible/vagrant_ansible_inventory - name: adapt inventory - correct ssh key replace: path: ./ansible/vagrant_ansible_inventory regexp: "ansible_ssh_private_key_file='.*/\\.vagrant\\.d/insecure_private_key'" replace: "ansible_ssh_private_key_file='/home/vagrant/ansible/vagrant_insecure_private_ssh_key'" - name: dump ssh config command: vagrant ssh-config register: output - name: store ssh-config in file copy: content: "{{ output.stdout }}\n" dest: ./ssh-config-host - name: copy ssh-config for setup copy: src: ./ssh-config-host dest: ./ansible/ssh-config-setup - name: modify ssh-config-setup replace: path: ./ansible/ssh-config-setup regexp: "IdentityFile .*" replace: "IdentityFile /home/vagrant/ansible/vagrant_insecure_private_ssh_key"