valentinocossar / trellis-database-uploads-migration

Ansible playbook for Trellis that manages database and uploads migration.
MIT License
94 stars 13 forks source link

SSH connection with vagrant fails #15

Closed briggySmalls closed 6 years ago

briggySmalls commented 6 years ago

Submit a feature request or bug report

Replace any X with your information.


What is the current behavior?

When executing ./bin/database.sh production <sitename> push

TASK [Check if <_sitename_> folder exists]

fails with:

SSH Error: data could not be sent to remote host "192.168.50.5". Make sure
this host can be reached over ssh
fatal: [production_host]: UNREACHABLE! => {
    "changed": false,
    "unreachable": true
}

If too many key pairs are found by ssh.

What is the expected or desired behavior?

A connection to be successfully made to the vagrant VM to check the existence of the folder.


Bug report

Executing:

ansible-playbook database-backup.yml -e env=production -e site=<sitename> -vvv

Returns the following:

ansible-playbook 2.5.3
  config file = /Users/sambriggs/Code/web/skin-deep-server-2/trellis/ansible.cfg
  configured module search path = [u'/Users/sambriggs/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/sambriggs/.local/share/virtualenvs/trellis-sM8LJ5lG/lib/python2.7/site-packages/ansible
  executable location = /Users/sambriggs/.local/share/virtualenvs/trellis-sM8LJ5lG/bin/ansible-playbook
  python version = 2.7.15 (default, May  1 2018, 16:44:08) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
Using /Users/sambriggs/Code/web/skin-deep-server-2/trellis/ansible.cfg as config file
Parsed /Users/sambriggs/Code/web/skin-deep-server-2/trellis/hosts/development inventory source with ini plugin
Parsed /Users/sambriggs/Code/web/skin-deep-server-2/trellis/hosts/production inventory source with ini plugin
Parsed /Users/sambriggs/Code/web/skin-deep-server-2/trellis/hosts/staging inventory source with ini plugin

PLAYBOOK: database-push.yml **********************************************************************************************************************************
1 plays in database-push.yml

PLAY [Push site database from development to production] *****************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
task path: /Users/sambriggs/Code/web/skin-deep-server-2/trellis/database-push.yml:2
Using module file /Users/sambriggs/.local/share/virtualenvs/trellis-sM8LJ5lG/lib/python2.7/site-packages/ansible/modules/system/setup.py
<skindeepmag.ml> ESTABLISH SSH CONNECTION FOR USER: web
<skindeepmag.ml> SSH: EXEC ssh -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 -o ControlPath=/Users/sambriggs/.ansible/cp/fcbe8e2b10 skindeepmag.ml '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<skindeepmag.ml> (0, '\n{"invocation": {"module_args": {"filter": "*", "gather_subset": ["all"], "fact_path": "/etc/ansible/facts.d", "gather_timeout": 10}}, "ansible_facts": {"ansible_product_serial": "NA", "ansible_form_factor": "Other", "ansible_real_group_id": 33, "ansible_distribution_file_parsed": true, "ansible_fips": false, "ansible_service_mgr": "systemd", "ansible_user_id": "web", "ansible_selinux_python_present": false, "ansible_userspace_bits": "64", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDOxFbhr/J5kTRtA+YWK680JoDl8iJX+o7R33by6YAMYGQhmtAlnMOpzBiXKfvHdW3/MaYsv9Zot057jXz9BPwfO5Gqe2WWMtcUirZJh35l3/ceeKib4fve7cora6cpiCvUS9XUm1ad3MCLrxzY1an1t7lY4isdqFkDTQFogvBqs7rMkoCKNsABqs3uTQH2f7f1XZhCrbgnwmUsPLxIO+vZQIYev/Fp75mJ/aXDbP47wWIAb2lfg0W9lnxKPEHG8ndcSv3YK0+doU8bCzeJCApiolFrkBdqwLYmafpFhAJy7CdyxEo9XkHfIft/Bx5ccZWmaeXtx/wVQZRa42Dohodz", "gather_subset": ["all"], "ansible_architecture": "x86_64", "ansible_local": {}, "ansible_distribution_version": "16.04", "ansible_domain": "", "ansible_distribution_file_path": "/etc/os-release", "ansible_user_shell": "/bin/bash", "ansible_virtualization_type": "kvm", "ansible_real_user_id": 1000, "ansible_processor_cores": 1, "ansible_virtualization_role": "host", "ansible_distribution_file_variety": "Debian", "ansible_dns": {"nameservers": ["67.207.67.3", "67.207.67.2"]}, "ansible_effective_group_id": 33, "ansible_bios_version": "20171212", "ansible_processor": ["0", "GenuineIntel", "Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz"], "ansible_date_time": {"weekday_number": "5", "iso8601_basic_short": "20180615T075550", "tz": "UTC", "weeknumber": "24", "hour": "07", "year": "2018", "minute": "55", "tz_offset": "+0000", "month": "06", "epoch": "1529049350", "iso8601_micro": "2018-06-15T07:55:50.078476Z", "weekday": "Friday", "time": "07:55:50", "date": "2018-06-15", "iso8601": "2018-06-15T07:55:50Z", "day": "15", "iso8601_basic": "20180615T075550078394", "second": "50"}, "ansible_lo": {"features": {"tx_checksum_ipv4": "off [fixed]", "generic_receive_offload": "on", "tx_checksum_ipv6": "off [fixed]", "tx_scatter_gather_fraglist": "on [fixed]", "rx_all": "off [fixed]", "highdma": "on [fixed]", "rx_fcs": "off [fixed]", "tx_lockless": "on [fixed]", "tx_tcp_ecn_segmentation": "on", "tx_tcp6_segmentation": "on", "tx_gso_robust": "off [fixed]", "tx_ipip_segmentation": "off [fixed]", "tx_checksumming": "on", "vlan_challenged": "on [fixed]", "loopback": "on [fixed]", "fcoe_mtu": "off [fixed]", "tx_checksum_sctp": "on [fixed]", "tx_vlan_stag_hw_insert": "off [fixed]", "rx_vlan_stag_hw_parse": "off [fixed]", "rx_vlan_stag_filter": "off [fixed]", "large_receive_offload": "off [fixed]", "tx_scatter_gather": "on [fixed]", "rx_checksumming": "on [fixed]", "tx_tcp_segmentation": "on", "netns_local": "on [fixed]", "busy_poll": "off [fixed]", "generic_segmentation_offload": "on", "tx_udp_tnl_segmentation": "off [fixed]", "tcp_segmentation_offload": "on", "l2_fwd_offload": "off [fixed]", "rx_vlan_offload": "off [fixed]", "ntuple_filters": "off [fixed]", "tx_vlan_offload": "off [fixed]", "tx_nocache_copy": "off [fixed]", "udp_fragmentation_offload": "on", "scatter_gather": "on", "tx_sit_segmentation": "off [fixed]", "tx_checksum_fcoe_crc": "off [fixed]", "hw_tc_offload": "off [fixed]", "tx_checksum_ip_generic": "on [fixed]", "tx_fcoe_segmentation": "off [fixed]", "rx_vlan_filter": "off [fixed]", "receive_hashing": "off [fixed]", "tx_gre_segmentation": "off [fixed]"}, "hw_timestamp_filters": [], "mtu": 65536, "device": "lo", "promisc": false, "timestamping": ["rx_software", "software"], "ipv4": {"broadcast": "host", "netmask": "255.0.0.0", "network": "127.0.0.0", "address": "127.0.0.1"}, "ipv6": [{"scope": "host", "prefix": "128", "address": "::1"}], "active": true, "type": "loopback"}, "ansible_memtotal_mb": 992, "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLdxE6UhC0bwSDJnkE3Rtqlz6nPLwju6STv381e4qrWA+VPdxdFrymDfxCXaS6nALwHTdpbSGol6YYRyrV3I7wA=", "ansible_device_links": {"masters": {}, "labels": {"vda15": ["UEFI"], "vda1": ["cloudimg-rootfs"]}, "ids": {}, "uuids": {"vda15": ["8B2D-8848"], "vda1": ["4f425d70-4afd-48e1-b6b9-de854eb103ac"]}}, "ansible_default_ipv4": {"macaddress": "32:82:f3:a6:fe:74", "network": "167.99.192.0", "mtu": 1500, "broadcast": "167.99.207.255", "alias": "eth0", "netmask": "255.255.240.0", "address": "167.99.206.93", "interface": "eth0", "type": "ether", "gateway": "167.99.192.1"}, "ansible_swapfree_mb": 946, "ansible_default_ipv6": {}, "ansible_distribution_release": "xenial", "ansible_system_vendor": "DigitalOcean", "ansible_os_family": "Debian", "ansible_cmdline": {"BOOT_IMAGE": "/boot/vmlinuz-4.4.0-127-generic", "ro": true, "root": "LABEL=cloudimg-rootfs", "console": "ttyS0"}, "ansible_effective_user_id": 1000, "ansible_user_gid": 33, "ansible_selinux": {"status": "Missing selinux Python library"}, "ansible_product_version": "20171212", "ansible_apparmor": {"status": "enabled"}, "ansible_userspace_architecture": "x86_64", "ansible_product_uuid": "NA", "ansible_fqdn": "skin-deep-test", "ansible_system": "Linux", "ansible_pkg_mgr": "apt", "ansible_memfree_mb": 152, "ansible_devices": {"vda": {"scheduler_mode": "", "rotational": "1", "vendor": "0x1af4", "sectors": "52428800", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "SCSI storage controller: Red Hat, Inc Virtio block device", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {"vda15": {"sectorsize": 512, "uuid": "8B2D-8848", "links": {"masters": [], "labels": ["UEFI"], "ids": [], "uuids": ["8B2D-8848"]}, "sectors": "217088", "start": "10240", "holders": [], "size": "106.00 MB"}, "vda14": {"sectorsize": 512, "uuid": null, "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sectors": "8192", "start": "2048", "holders": [], "size": "4.00 MB"}, "vda1": {"sectorsize": 512, "uuid": "4f425d70-4afd-48e1-b6b9-de854eb103ac", "links": {"masters": [], "labels": ["cloudimg-rootfs"], "ids": [], "uuids": ["4f425d70-4afd-48e1-b6b9-de854eb103ac"]}, "sectors": "52201439", "start": "227328", "holders": [], "size": "24.89 GB"}}, "holders": [], "size": "25.00 GB"}, "loop3": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop2": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop1": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop0": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop7": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop6": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop5": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}, "loop4": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "0", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {}, "holders": [], "size": "0.00 Bytes"}}, "ansible_user_uid": 1000, "ansible_memory_mb": {"real": {"total": 992, "used": 840, "free": 152}, "swap": {"cached": 0, "total": 953, "free": 946, "used": 7}, "nocache": {"used": 304, "free": 688}}, "ansible_distribution": "Ubuntu", "ansible_user_dir": "/home/web", "ansible_env": {"LANG": "en_US.UTF-8", "SHELL": "/bin/bash", "XDG_RUNTIME_DIR": "/run/user/1000", "MAIL": "/var/mail/web", "SHLVL": "1", "SSH_AUTH_SOCK": "/tmp/ssh-W7tuSEtWjL/agent.30261", "SSH_CLIENT": "77.102.184.47 61519 22", "PWD": "/home/web", "LOGNAME": "web", "USER": "web", "HOME": "/home/web", "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games", "SSH_CONNECTION": "77.102.184.47 61519 167.99.206.93 22", "XDG_SESSION_ID": "634", "_": "/bin/sh"}, "ansible_distribution_major_version": "16", "module_setup": true, "ansible_processor_count": 1, "ansible_hostname": "skin-deep-test", "ansible_processor_vcpus": 1, "ansible_swaptotal_mb": 953, "ansible_lsb": {"release": "16.04", "major_release": "16", "codename": "xenial", "id": "Ubuntu", "description": "Ubuntu 16.04.4 LTS"}, "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIPvCjkR9TeR+1oAorWJEzTfvnexwqCPFTV/utxLdIrG4", "ansible_bios_date": "12/12/2017", "ansible_all_ipv6_addresses": ["fe80::3082:f3ff:fea6:fe74"], "ansible_interfaces": ["lo", "eth0"], "ansible_uptime_seconds": 302559, "ansible_machine_id": "e1dd3b30941b45dea33df90bcb09005c", "ansible_kernel": "4.4.0-127-generic", "ansible_user_gecos": "", "ansible_system_capabilities_enforced": "True", "ansible_python": {"executable": "/usr/bin/python", "version": {"micro": 12, "major": 2, "releaselevel": "final", "serial": 0, "minor": 7}, "type": "CPython", "has_sslcontext": true, "version_info": [2, 7, 12, "final", 0]}, "ansible_processor_threads_per_core": 1, "ansible_is_chroot": false, "ansible_mounts": [{"block_used": 824971, "uuid": "4f425d70-4afd-48e1-b6b9-de854eb103ac", "size_total": 25832497152, "block_total": 6306762, "mount": "/", "block_available": 5481791, "size_available": 22453415936, "fstype": "ext4", "inode_total": 3225600, "options": "rw,relatime,data=ordered", "device": "/dev/vda1", "inode_used": 122029, "block_size": 4096, "inode_available": 3103571}, {"block_used": 6874, "uuid": "8B2D-8848", "size_total": 109422592, "block_total": 213716, "mount": "/boot/efi", "block_available": 206842, "size_available": 105903104, "fstype": "vfat", "inode_total": 0, "options": "rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro", "device": "/dev/vda15", "inode_used": 0, "block_size": 512, "inode_available": 0}], "ansible_eth0": {"macaddress": "32:82:f3:a6:fe:74", "features": {"tx_checksum_ipv4": "off [fixed]", "generic_receive_offload": "on", "tx_checksum_ipv6": "off [fixed]", "tx_scatter_gather_fraglist": "off [fixed]", "rx_all": "off [fixed]", "highdma": "on [fixed]", "rx_fcs": "off [fixed]", "tx_lockless": "off [fixed]", "tx_tcp_ecn_segmentation": "on", "tx_tcp6_segmentation": "on", "tx_gso_robust": "on [fixed]", "tx_ipip_segmentation": "off [fixed]", "tx_checksumming": "on", "vlan_challenged": "off [fixed]", "loopback": "off [fixed]", "fcoe_mtu": "off [fixed]", "tx_checksum_sctp": "off [fixed]", "tx_vlan_stag_hw_insert": "off [fixed]", "rx_vlan_stag_hw_parse": "off [fixed]", "rx_vlan_stag_filter": "off [fixed]", "large_receive_offload": "off [fixed]", "tx_scatter_gather": "on", "rx_checksumming": "on [fixed]", "tx_tcp_segmentation": "on", "netns_local": "off [fixed]", "busy_poll": "on [fixed]", "generic_segmentation_offload": "on", "tx_udp_tnl_segmentation": "off [fixed]", "tcp_segmentation_offload": "on", "l2_fwd_offload": "off [fixed]", "rx_vlan_offload": "off [fixed]", "ntuple_filters": "off [fixed]", "tx_vlan_offload": "off [fixed]", "tx_nocache_copy": "off", "udp_fragmentation_offload": "on", "scatter_gather": "on", "tx_sit_segmentation": "off [fixed]", "tx_checksum_fcoe_crc": "off [fixed]", "hw_tc_offload": "off [fixed]", "tx_checksum_ip_generic": "on", "tx_fcoe_segmentation": "off [fixed]", "rx_vlan_filter": "on [fixed]", "receive_hashing": "off [fixed]", "tx_gre_segmentation": "off [fixed]"}, "type": "ether", "pciid": "virtio0", "promisc": false, "mtu": 1500, "device": "eth0", "ipv4_secondaries": [{"broadcast": "10.16.255.255", "netmask": "255.255.0.0", "network": "10.16.0.0", "address": "10.16.0.5"}], "timestamping": ["tx_software", "rx_software", "software"], "ipv4": {"broadcast": "167.99.207.255", "netmask": "255.255.240.0", "network": "167.99.192.0", "address": "167.99.206.93"}, "ipv6": [{"scope": "link", "prefix": "64", "address": "fe80::3082:f3ff:fea6:fe74"}], "active": true, "speed": -1, "hw_timestamp_filters": []}, "ansible_nodename": "skin-deep-test", "ansible_product_name": "Droplet", "ansible_machine": "x86_64", "ansible_system_capabilities": [""], "ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBANvxm3Bvsqu/nhkivTI4JJzI/r8FoOU9K1XhZhJpv73iQyprsGn8xafuSGNZMBJqXK0f7RYX+O+IuvVoa80fpmp1FX8Pr8caUz9cv8In+QiLoYNZ/56nBkvbczytshqukwkqZoaoh93chp17sR+x/iwG1+2J+Gh+nm+wTZpRaAW9AAAAFQDl78ngEy354BocI18O+Kp2YM06cwAAAIAd1aqIUCfQia+VDe7OuML28DkWlWTLzokTDR1zD4SjOIZkznuAuPzYc0vrXIvcP4Tof80NmdWKBsfwblnz/06KLCTUeNn9klWBQD1CtJO1Mq/FImICWQDtZhKip8TSZJgtV3GE2bukh0xnfDkzLz8ebD/RCv3dys/WhD4LQ1XLjwAAAIAIa7m9y+Z0jMUcxkbYKqhaqLD/H1EO8KILKfx8RHbHuzsoDlM/CL4YqGKTb+7XDuQEmSgAwAQk42hPR1A6joGzrxxXpME7D2yw8LqwH49L1WVRugrnd3+VNJJN9p2GBpoOlQ5kri08GjR4ZxGk8axqBOAQJo87XF22HBzerPDpEg==", "ansible_all_ipv4_addresses": ["167.99.206.93", "10.16.0.5"], "ansible_python_version": "2.7.12"}}\n', '')
ok: [production_host]
META: ran handlers

TASK [Abort if environment variable is equal to development] *************************************************************************************************
task path: /Users/sambriggs/Code/web/skin-deep-server-2/trellis/database-push.yml:19
skipping: [production_host] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}

TASK [Check if site folder exists] ***************************************************************************************************************************
task path: /Users/sambriggs/Code/web/skin-deep-server-2/trellis/database-push.yml:24
Using module file /Users/sambriggs/.local/share/virtualenvs/trellis-sM8LJ5lG/lib/python2.7/site-packages/ansible/modules/files/stat.py
<192.168.50.5> ESTABLISH SSH CONNECTION FOR USER: vagrant
<192.168.50.5> SSH: EXEC ssh -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=".vagrant/machines/default/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o ControlPath=/Users/sambriggs/.ansible/cp/1981a43659 192.168.50.5 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<192.168.50.5> ssh_retry: attempt: 0, ssh return code is 255. cmd (['ssh', '-o', 'ForwardAgent=yes', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'IdentityFile=".vagrant/machines/default/virtualbox/private_key"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '-o', 'StrictHostKeyChecking=no', '-o', 'GlobalKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'ControlPath=/Users/sambriggs/.ansible/cp/1981a43659', '192.168.50.5', "/bin/sh -c '/usr/bin/python && sleep 0'"]...), pausing for 0 seconds
<192.168.50.5> SSH: EXEC ssh -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=".vagrant/machines/default/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o ControlPath=/Users/sambriggs/.ansible/cp/1981a43659 192.168.50.5 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
System info:
  Ansible 2.5.3; Darwin
  Trellis version (per changelog): "Verify `wp-cli.phar` checksum"
---------------------------------------------------
SSH Error: data could not be sent to remote host "192.168.50.5". Make sure
this host can be reached over ssh
fatal: [production_host]: UNREACHABLE! => {
    "changed": false,
    "unreachable": true
}
    to retry, use: --limit @/Users/sambriggs/Code/web/skin-deep-server-2/trellis/database-push.retry

PLAY RECAP ***************************************************************************************************************************************************
production_host            : ok=1    changed=0    unreachable=1    failed=0

Please describe your local environment:

Ansible version: 2.5.4 (although above command was run with 2.5.3)

OS name and version: macOS High Sierra 10.13.3

Trellis version: 1.0.0-rc2 master branch (commit 97e267107e9ad1c309473f0ce3e20f890ca18597)

Where did the bug happen? Development or remote servers?

Development server

Has the bug already been solved or discussed on Ansible issues page?

No


Other relevant information:

Executing the SSH command again manually returns:

ssh -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=".vagrant/machines/default/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o ControlPath=/Users/sambriggs/.ansible/cp/1981a43659 192.168.50.5
Warning: Permanently added '192.168.50.5' (ED25519) to the list of known hosts.
Received disconnect from 192.168.50.5 port 22:2: Too many authentication failures
Disconnected from 192.168.50.5 port 22

Adding IdentitiesOnly=yes to the ssh options in ./hosts/development fixes the issue. This is how vagrant ssh achieves its connection, as shown by executing ps aux | grep shh:

/usr/bin/ssh vagrant@127.0.0.1 -p 2200 -o LogLevel=FATAL -o Compression=yes -o DSAAuthentication=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentityFile="/Users/sambriggs/Code/web/skin-deep-server-2/trellis/.vagrant/machines/default/virtualbox/private_key" -o ForwardAgent=yes

Alternatively, Adding _IdentitiesOnly=yes to ~/.ssh/config also fixed my problem.

It seems to me adding IdentitiesOnly=yes is the better option, as it mirrors the behaviour of vagrant, which is what I expected! I did not know about this behaviour of ssh. In fact I have no idea what all those public keys I have are for...

valentinocossar commented 6 years ago

Hi, seems that this problem is related to the ssh-agent. Running ssh-add -L should display more than one ssh key passed to the ssh-agent and so when you trying to connect to the local VM it fails due to the "too many authentication failures" error. Clearing the entries for your ssh-agent with ssh-add -D and re-adding the right key with ssh-add -K ~/.ssh/id_rsa the ssh connection with the local VM should work.

Anyway, I'll update the tool with the right parameters passed to the ssh command to connect to the local VM as suggested. Thank you!

valentinocossar commented 6 years ago

I've improved the README with the latest commit as suggested, so I close the issue as resolved. Let me know if the problem persists. Thank you for the help.

briggySmalls commented 6 years ago

No problem. Thanks for the great tool!