Can’t reach a server?

What’s happening here? I can reach the server over ssh, but ansible can’t? I’m testing a provisioning play. I can ssh into the box with “ssh root@box” but the command “ansible-playbook -vvv -u root -k —limit box yum.yml” says “msg”: “SSH Error:data could not be sent to remote host \”box\”. Make sure this host can be reached over ssh”.

Odd. :slight_smile:

What’s happening and how to fix this?

Mike

Mike,

If you are provisioning a VM, usually you require another play to connect to the host. Can you share the playbook/role?

(Doing this on my phone is cumbersome.) :slight_smile:

Hers the playbook:

[meggle1@dvlnx108 playbooks]$ cat yum.yml

$Id$

$Log$

use the package manager (yum/apt-get) to update all installed packages

:!ansible-playbook -u root -k --limit dvlnx115 --syntax-check %

:!ansible-playbook -u root -k --limit dvlnx115 %

:!ansible-playbook -vvv -u root -k --limit dvlnx115 %

Mike,

You should use the yum/apt modules instead of shell/command do what you are trying to do. Also what version of ansible are you using? You should also use the OS conditionals to run the tasks depending on the OS. https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#commonly-used-facts https://docs.ansible.com/ansible/latest/modules/yum_module.html https://docs.ansible.com/ansible/latest/modules/apt_module.html. you can also use https://docs.ansible.com/ansible/latest/modules/package_module.html for generic package management. If you are using at least ansible 2.7 use the reboot https://docs.ansible.com/ansible/latest/modules/reboot_module.html since it auto connects back.

I first used “package” and ansible complained of a missing interpreter line. That’s why I switched to “command”.

I’m going between two CentIS boxes.

All this doesn’t explain why I can get into the box over ssh, but ansible cant get into the box.

Mike

can you go into more details about missing interpreter line? what ansible version are you using? in what part is ansible unable to connect? I’m assuming after the shutdown -r part?

Do you have the host your connecting Ansible to configured in inventory? If you just pass the host as a limit but it's not in inventory Ansible won't know what you mean, try "-i "target-host, --limit "target-host" to simulate an inventory file or use an inventory file and put the host in question inside (assuming you haven't already just a guess)

I changed the yum to an uptime. The connection issue is in the handler.

Here’s the interpreter message:

[meggle1@dvlnx108 playbooks]$ ansible-playbook -vvv -u root -k --limit dvlnx115 y.yml

ansible-playbook 2.4.2.0

config file = /home/meggle1/src/ansible/ansible.cfg

configured module search path = [u’/home/meggle1/src/ansible/playbooks’]

ansible python module location = /usr/lib/python2.7/site-packages/ansible

executable location = /usr/bin/ansible-playbook

python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

Using /home/meggle1/src/ansible/ansible.cfg as config file

SSH password:

Parsed /home/meggle1/src/ansible/newinventory inventory source with ini plugin

PLAYBOOK: y.yml *********************************************************************************************************************************************

1 plays in y.yml

PLAY [all] **************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************

Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py

ESTABLISH SSH CONNECTION FOR USER: root

SSH: EXEC sshpass -d13 ssh -o ConnectTimeout=5 -o ServerAliveInterval=10 -o ServerAliveCountMax=720 -o StrictHostKeyChecking=ask -o User=root -o ConnectTimeout=10 dvlnx115 ‘/bin/sh -c ‘"’"’/usr/bin/python && sleep 0’“'”‘’

(0, ‘\n{“invocation”: {“module_args”: {“filter”: “*”, “gather_subset”: [“all”], “fact_path”: “/etc/ansible/facts.d”, “gather_timeout”: 10}}, “ansible_facts”: {“ansible_product_serial”: “VMware-42 12 36 76 5b 94 86 03-e1 82 dc f3 6e e3 b4 ab”, “ansible_form_factor”: “Other”, “ansible_distribution_file_parsed”: true, “ansible_fips”: false, “ansible_service_mgr”: “systemd”, “ansible_user_id”: “root”, “ansible_selinux_python_present”: true, “ansible_userspace_bits”: “64”, “ansible_ssh_host_key_rsa_public”: “AAAAB3NzaC1yc2EAAAADAQABAAABAQC+4PWY9xn7bJxcYd/uWpEmx2RM4ikwPdYW5zXVWFpNKdkjDg8Fz6zEtXbaccVZIfuWM6aJpvgIILRfoI9rjCiCp60oxQh3luE9K3liCqZD4ue6uc8P2KPT7AHq3AQzyFHV01hBpBNWXYFAVG6YrK8cRWxPqc1V7oFpHXwmzQpy5Mq5PdHF6WFbCX2VgvQETkSYrnGJ5ffTZv1j9KmHaurfbPGtd39L78DU60vrRlJgybMc0bNuipJreFibCbiYGwEYZipXp9yWiWVDItlhfBnrADDNEQgaU1UNrHaITNpJ6cz0N1t/QdGcysOv2GBuVGL6bff7JIvNLZdDjFAGJnxz”, “gather_subset”: [“all”], “ansible_real_user_id”: 0, “ansible_architecture”: “x86_64”, “ansible_local”: {}, “ansible_distribution_version”: “7.6.1810”, “ansible_domain”: “firstcash.com”, “ansible_distribution_file_path”: “/etc/redhat-release”, “ansible_user_shell”: “/bin/bash”, “ansible_date_time”: {“weekday_number”: “1”, “iso8601_basic_short”: “20190819T091701”, “tz”: “CDT”, “weeknumber”: “33”, “hour”: “09”, “year”: “2019”, “minute”: “17”, “tz_offset”: “-0500”, “month”: “08”, “epoch”: “1566224221”, “iso8601_micro”: “2019-08-19T14:17:01.672768Z”, “weekday”: “Monday”, “time”: “09:17:01”, “date”: “2019-08-19”, “iso8601”: “2019-08-19T14:17:01Z”, “day”: “19”, “iso8601_basic”: “20190819T091701672648”, “second”: “01”}, “ansible_ssh_host_key_ed25519_public”: “AAAAC3NzaC1lZDI1NTE5AAAAIEN2FHch8bOc4L0p+r9e5aVVlhJkkWZtxWxaraxNLfVe”, “ansible_processor_cores”: 2, “ansible_virtualization_role”: “guest”, “ansible_distribution_file_variety”: “RedHat”, “ansible_env”: {“LANG”: “en_US.UTF-8”, “SHELL”: “/bin/bash”, “XDG_RUNTIME_DIR”: “/run/user/0”, “SHLVL”: “2”, “SSH_CLIENT”: “10.50.118.247 37170 22”, “LESSOPEN”: “||/usr/bin/lesspipe.sh %s”, “PATH”: “/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin”, “PWD”: “/root”, “SELINUX_ROLE_REQUESTED”: “”, “SELINUX_USE_CURRENT_RANGE”: “”, “LOGNAME”: “root”, “USER”: “root”, “MAIL”: “/var/mail/root”, “HOME”: “/root”, “SELINUX_LEVEL_REQUESTED”: “”, “XDG_SESSION_ID”: “1”, “_”: “/usr/bin/python”, “SSH_CONNECTION”: “10.50.118.247 37170 10.50.118.245 22”}, “ansible_effective_group_id”: 0, “ansible_bios_version”: “6.00”, “ansible_processor”: [“0”, “GenuineIntel”, “Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz”, “1”, “GenuineIntel”, “Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz”, “2”, “GenuineIntel”, “Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz”, “3”, “GenuineIntel”, “Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz”], “ansible_virtualization_type”: “VMware”, “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”, “rx_udp_tunnel_port_offload”: “off [fixed]”, “tx_tcp6_segmentation”: “on”, “tx_gso_robust”: “off [fixed]”, “tx_ipip_segmentation”: “off [fixed]”, “tx_tcp_mangleid_segmentation”: “on”, “tx_checksumming”: “on”, “vlan_challenged”: “on [fixed]”, “loopback”: “on [fixed]”, “fcoe_mtu”: “off [fixed]”, “scatter_gather”: “on”, “tx_checksum_sctp”: “on [fixed]”, “tx_vlan_stag_hw_insert”: “off [fixed]”, “rx_vlan_stag_hw_parse”: “off [fixed]”, “tx_gso_partial”: “off [fixed]”, “rx_gro_hw”: “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_gre_csum_segmentation”: “off [fixed]”, “tx_nocache_copy”: “off [fixed]”, “tx_udp_tnl_csum_segmentation”: “off [fixed]”, “udp_fragmentation_offload”: “on”, “tx_sctp_segmentation”: “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]”, “tx_vlan_offload”: “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”: 3789, “ansible_ssh_host_key_ecdsa_public”: “AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJu+faA7+4FvAk/7NM6LMiVmQT4VZywj6yPNPeuFh2bIMk4av+JfbhgFvQyP79gWVnspOxadHBZOpCaEe8G2kDc=”, “ansible_device_links”: {“masters”: {“sda2”: [“dm-0”, “dm-1”]}, “labels”: {}, “ids”: {“sr0”: [“ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001”], “sda2”: [“lvm-pv-uuid-2kUJsQ-G7BV-MbNW-BrZW-WL0f-mjrL-2ZkLq0”], “dm-0”: [“dm-name-centos-root”, “dm-uuid-LVM-pvPziInAe11HFpC2H3WAcqx4LVHE2KjyS28LXugumw14mfP87MkO28uru0rbGvzC”], “dm-1”: [“dm-name-centos-swap”, “dm-uuid-LVM-pvPziInAe11HFpC2H3WAcqx4LVHE2KjyHwjjedjNjoG0fzlK58hdWGwz6V6BuN2z”]}, “uuids”: {“sda1”: [“ac6a9318-a9b8-411c-9a1b-000804f1ad82”], “dm-0”: [“10f7278c-1721-4553-a9ee-d8a4ffdb96d7”], “dm-1”: [“17cf1614-d822-41af-bbd2-589464afc51c”]}}, “ansible_default_ipv4”: {“macaddress”: “00:50:56:92:fd:33”, “network”: “10.50.118.0”, “mtu”: 1500, “broadcast”: “10.50.118.255”, “alias”: “ens160”, “netmask”: “255.255.255.0”, “address”: “10.50.118.245”, “interface”: “ens160”, “type”: “ether”, “gateway”: “10.50.118.1”}, “ansible_swapfree_mb”: 1639, “ansible_default_ipv6”: {}, “ansible_distribution_release”: “Core”, “ansible_system_vendor”: “VMware, Inc.”, “ansible_apparmor”: {“status”: “disabled”}, “ansible_cmdline”: {“LANG”: “en_US.UTF-8”, “BOOT_IMAGE”: “/vmlinuz-3.10.0-957.27.2.el7.x86_64”, “quiet”: true, “rhgb”: true, “rd.lvm.lv”: “centos/swap”, “crashkernel”: “auto”, “ro”: true, “root”: “/dev/mapper/centos-root”}, “ansible_effective_user_id”: 0, “ansible_user_gid”: 0, “ansible_selinux”: {“status”: “enabled”, “policyvers”: 31, “type”: “targeted”, “mode”: “enforcing”, “config_mode”: “enforcing”}, “ansible_product_version”: “None”, “ansible_os_family”: “RedHat”, “ansible_userspace_architecture”: “x86_64”, “ansible_product_uuid”: “42123676-5B94-8603-E182-DCF36EE3B4AB”, “ansible_system”: “Linux”, “ansible_pkg_mgr”: “yum”, “ansible_memfree_mb”: 3464, “ansible_devices”: {“fd0”: {“scheduler_mode”: “deadline”, “rotational”: “1”, “vendor”: null, “sectors”: “8”, “links”: {“masters”: , “labels”: , “ids”: , “uuids”: }, “sas_device_handle”: null, “sas_address”: null, “virtual”: 1, “host”: “”, “sectorsize”: “512”, “removable”: “1”, “support_discard”: “0”, “model”: null, “partitions”: {}, “holders”: , “size”: “4.00 KB”}, “sr0”: {“scheduler_mode”: “deadline”, “rotational”: “1”, “vendor”: “NECVMWar”, “sectors”: “2097151”, “links”: {“masters”: , “labels”: , “ids”: [“ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001”], “uuids”: }, “sas_device_handle”: null, “sas_address”: null, “virtual”: 1, “host”: “IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)”, “sectorsize”: “512”, “removable”: “1”, “support_discard”: “0”, “model”: “VMware IDE CDR10”, “partitions”: {}, “holders”: , “size”: “1024.00 MB”}, “sda”: {“scheduler_mode”: “deadline”, “rotational”: “1”, “vendor”: “VMware”, “sectors”: “33554432”, “links”: {“masters”: , “labels”: , “ids”: , “uuids”: }, “sas_device_handle”: null, “sas_address”: null, “virtual”: 1, “host”: “SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)”, “sectorsize”: “512”, “removable”: “0”, “support_discard”: “0”, “model”: “Virtual disk”, “partitions”: {“sda2”: {“sectorsize”: 512, “uuid”: null, “links”: {“masters”: [“dm-0”, “dm-1”], “labels”: , “ids”: [“lvm-pv-uuid-2kUJsQ-G7BV-MbNW-BrZW-WL0f-mjrL-2ZkLq0”], “uuids”: }, “sectors”: “31455232”, “start”: “2099200”, “holders”: [“centos-root”, “centos-swap”], “size”: “15.00 GB”}, “sda1”: {“sectorsize”: 512, “uuid”: “ac6a9318-a9b8-411c-9a1b-000804f1ad82”, “links”: {“masters”: , “labels”: , “ids”: , “uuids”: [“ac6a9318-a9b8-411c-9a1b-000804f1ad82”]}, “sectors”: “2097152”, “start”: “2048”, “holders”: , “size”: “1.00 GB”}}, “holders”: , “size”: “16.00 GB”}, “dm-0”: {“scheduler_mode”: “”, “rotational”: “1”, “vendor”: null, “sectors”: “28090368”, “links”: {“masters”: , “labels”: , “ids”: [“dm-name-centos-root”, “dm-uuid-LVM-pvPziInAe11HFpC2H3WAcqx4LVHE2KjyS28LXugumw14mfP87MkO28uru0rbGvzC”], “uuids”: [“10f7278c-1721-4553-a9ee-d8a4ffdb96d7”]}, “sas_device_handle”: null, “sas_address”: null, “virtual”: 1, “host”: “”, “sectorsize”: “512”, “removable”: “0”, “support_discard”: “0”, “model”: null, “partitions”: {}, “holders”: , “size”: “13.39 GB”}, “dm-1”: {“scheduler_mode”: “”, “rotational”: “1”, “vendor”: null, “sectors”: “3358720”, “links”: {“masters”: , “labels”: , “ids”: [“dm-name-centos-swap”, “dm-uuid-LVM-pvPziInAe11HFpC2H3WAcqx4LVHE2KjyHwjjedjNjoG0fzlK58hdWGwz6V6BuN2z”], “uuids”: [“17cf1614-d822-41af-bbd2-589464afc51c”]}, “sas_device_handle”: null, “sas_address”: null, “virtual”: 1, “host”: “”, “sectorsize”: “512”, “removable”: “0”, “support_discard”: “0”, “model”: null, “partitions”: {}, “holders”: , “size”: “1.60 GB”}}, “ansible_user_uid”: 0, “ansible_lvm”: {“pvs”: {“/dev/sda2”: {“free_g”: “0”, “size_g”: “15.00”, “vg”: “centos”}}, “lvs”: {“root”: {“size_g”: “13.39”, “vg”: “centos”}, “swap”: {“size_g”: “1.60”, “vg”: “centos”}}, “vgs”: {“centos”: {“free_g”: “0”, “size_g”: “15.00”, “num_lvs”: “2”, “num_pvs”: “1”}}}, “ansible_distribution”: “CentOS”, “ansible_user_dir”: “/root”, “ansible_dns”: {“nameservers”: [“10.50.117.39”, “10.50.116.123”], “search”: [“firstcash.com”, “casham.com”]}, “ansible_distribution_major_version”: “7”, “module_setup”: true, “ansible_processor_count”: 2, “ansible_hostname”: “dvnlx115”, “ansible_processor_vcpus”: 4, “ansible_swaptotal_mb”: 1639, “ansible_lsb”: {}, “ansible_real_group_id”: 0, “ansible_bios_date”: “09/21/2015”, “ansible_ens160”: {“macaddress”: “00:50:56:92:fd:33”, “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”, “rx_fcs”: “off [fixed]”, “tx_lockless”: “off [fixed]”, “tx_tcp_ecn_segmentation”: “off [fixed]”, “rx_udp_tunnel_port_offload”: “off [fixed]”, “tx_tcp6_segmentation”: “on”, “tx_gso_robust”: “off [fixed]”, “tx_ipip_segmentation”: “off [fixed]”, “tx_tcp_mangleid_segmentation”: “off”, “tx_checksumming”: “on”, “vlan_challenged”: “off [fixed]”, “loopback”: “off [fixed]”, “fcoe_mtu”: “off [fixed]”, “scatter_gather”: “on”, “tx_checksum_sctp”: “off [fixed]”, “tx_vlan_stag_hw_insert”: “off [fixed]”, “rx_vlan_stag_hw_parse”: “off [fixed]”, “tx_gso_partial”: “off [fixed]”, “rx_gro_hw”: “off [fixed]”, “rx_vlan_stag_filter”: “off [fixed]”, “large_receive_offload”: “on”, “tx_scatter_gather”: “on”, “rx_checksumming”: “on”, “tx_tcp_segmentation”: “on”, “netns_local”: “off [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”: “on”, “ntuple_filters”: “off [fixed]”, “tx_gre_csum_segmentation”: “off [fixed]”, “tx_nocache_copy”: “off”, “tx_udp_tnl_csum_segmentation”: “off [fixed]”, “udp_fragmentation_offload”: “off [fixed]”, “tx_sctp_segmentation”: “off [fixed]”, “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]”, “tx_vlan_offload”: “on”, “receive_hashing”: “on”, “tx_gre_segmentation”: “off [fixed]”}, “type”: “ether”, “pciid”: “0000:03:00.0”, “module”: “vmxnet3”, “mtu”: 1500, “device”: “ens160”, “promisc”: false, “timestamping”: [“rx_software”, “software”], “ipv4”: {“broadcast”: “10.50.118.255”, “netmask”: “255.255.255.0”, “network”: “10.50.118.0”, “address”: “10.50.118.245”}, “ipv6”: [{“scope”: “link”, “prefix”: “64”, “address”: “fe80::250:56ff:fe92:fd33”}], “active”: true, “speed”: 10000, “hw_timestamp_filters”: }, “ansible_all_ipv6_addresses”: [“fe80::250:56ff:fe92:fd33”], “ansible_interfaces”: [“lo”, “ens160”], “ansible_uptime_seconds”: 250, “ansible_machine_id”: “3d3d3f08c37e439b8250e72612412f52”, “ansible_kernel”: “3.10.0-957.27.2.el7.x86_64”, “ansible_user_gecos”: “root”, “ansible_system_capabilities_enforced”: “True”, “ansible_python”: {“executable”: “/usr/bin/python”, “version”: {“micro”: 5, “major”: 2, “releaselevel”: “final”, “serial”: 0, “minor”: 7}, “type”: “CPython”, “has_sslcontext”: true, “version_info”: [2, 7, 5, “final”, 0]}, “ansible_processor_threads_per_core”: 1, “ansible_fqdn”: “dvnlx115.firstcash.com”, “ansible_mounts”: [{“block_used”: 478520, “uuid”: “10f7278c-1721-4553-a9ee-d8a4ffdb96d7”, “size_total”: 14371782656, “block_total”: 3508736, “mount”: “/”, “block_available”: 3030216, “size_available”: 12411764736, “fstype”: “xfs”, “inode_total”: 7022592, “options”: “rw,seclabel,relatime,attr2,inode64,noquota”, “device”: “/dev/mapper/centos-root”, “inode_used”: 70872, “block_size”: 4096, “inode_available”:6951720}, {“block_used”: 46446, “uuid”: “ac6a9318-a9b8-411c-9a1b-000804f1ad82”, “size_total”: 1063256064, “block_total”: 259584, “mount”: “/boot”, “block_available”: 213138, “size_available”: 873013248, “fstype”: “xfs”, “inode_total”: 524288, “options”: “rw,seclabel,relatime,attr2,inode64,noquota”, “device”: “/dev/sda1”, “inode_used”: 336, “block_size”: 4096, “inode_available”: 523952}], “ansible_memory_mb”: {“real”: {“total”: 3789, “used”: 325, “free”: 3464}, “swap”: {“cached”: 0, “total”: 1639, “free”: 1639, “used”: 0}, “nocache”: {“used”: 209, “free”: 3580}}, “ansible_nodename”: “dvnlx115.firstcash.com”, “ansible_product_name”: “VMware Virtual Platform”, “ansible_machine”: “x86_64”, “ansible_system_capabilities”: [“cap_chown”, “cap_dac_override”, “cap_dac_read_search”, “cap_fowner”, “cap_fsetid”, “cap_kill”, “cap_setgid”, “cap_setuid”, “cap_setpcap”, “cap_linux_immutable”, “cap_net_bind_service”, “cap_net_broadcast”, “cap_net_admin”, “cap_net_raw”, “cap_ipc_lock”, “cap_ipc_owner”, “cap_sys_module”, “cap_sys_rawio”, “cap_sys_chroot”, “cap_sys_ptrace”, “cap_sys_pacct”, “cap_sys_admin”, “cap_sys_boot”, “cap_sys_nice”, “cap_sys_resource”, “cap_sys_time”, “cap_sys_tty_config”, “cap_mknod”, “cap_lease”, “cap_audit_write”, “cap_audit_control”, “cap_setfcap”, “cap_mac_override”, “cap_mac_admin”, “cap_syslog”, “35”, “36+ep”], “ansible_all_ipv4_addresses”: [“10.50.118.245”], “ansible_python_version”: “2.7.5”}}\n’, ‘’)

ok: [dvlnx115]

META: ran handlers

TASK [update all packages] **********************************************************************************************************************************

task path: /home/meggle1/src/ansible/playbooks/y.yml:13

Using module file /home/meggle1/src/ansible/playbooks/yum.retry

fatal: [dvlnx115]: FAILED! => {

“msg”: “module (yum) is missing interpreter line”

}

…ignoring

META: ran handlers

META: ran handlers

PLAY RECAP **************************************************************************************************************************************************

dvlnx115 : ok=2 changed=0 unreachable=0 failed=0

Mike

Before we go more into dept, I suggest you upgrade ansible versions to either 2.7 or 2.8. Ansible version 2.4 is EOL. It would be harder to troubleshoot this.

Hi!

[root@dvlnx108 ~]# rpm -qi ansible

Name : ansible

Version : 2.4.2.0

Release : 2.el7

Architecture: noarch

Install Date: Mon 29 Jul 2019 02:24:00 PM CDT

Group : Development/Libraries

Size : 40059005

License : GPLv3+

Signature : RSA/SHA256, Mon 29 Jan 2018 03:51:53 PM CST, Key ID 24c6a8a7f4a80eb5

Source RPM : ansible-2.4.2.0-2.el7.src.rpm

Build Date : Mon 29 Jan 2018 02:16:59 PM CST

Build Host : x86_64_01.bsys.centos.org

Relocations : (not relocatable)

Packager : CentOS BuildSystem <http://bugs.centos.org>

Vendor : CentOS

URL : http://ansible.com

Summary : SSH-based configuration management, deployment, and task execution system

Description :

Ansible is a radically simple model-driven configuration management,

multi-node deployment, and remote task execution system. Ansible works

over SSH and does not require any software or daemons to be installed

on remote nodes. Extension modules can be written in any language and

are transferred to managed machines automatically.

This is the latest RPM available in the CentOS repository. Is there a latest RPM available?

Mike

Found the ROM on the ansible site. Installing now.

Mike

Please look at https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html. You can install the RPM from ansible’s site or make sure your centos installation is updated to latest and have access to the correct repository EX. EPEL.

[meggle1@dvlnx108 playbooks]$ rpm -qi ansible

Name : ansible

Version : 2.8.4

Release : 1.el7.ans

Architecture: noarch

Install Date: Mon 19 Aug 2019 09:49:52 AM CDT

Group : Development/Libraries

Size : 87766638

License : GPLv3+

Signature : RSA/SHA1, Thu 15 Aug 2019 06:22:15 PM CDT, Key ID b84e339c442667a9

Source RPM : ansible-2.8.4-1.el7.ans.src.rpm

Build Date : Thu 15 Aug 2019 06:21:07 PM CDT

Build Host : jenkins-jnlp-agent-dp4wx

Relocations : (not relocatable)

URL : https://www.ansible.com

Summary : SSH-based application deployment, configuration management, and IT orchestration platform

Description :

Ansible is a radically simple model-driven configuration management,

multi-node deployment, and orchestration engine. Ansible works

over SSH and does not require any software or daemons to be installed

on remote nodes. Extension modules can be written in any language and

are transferred to managed machines automatically.

[meggle1@dvlnx108 playbooks]$ cat y.yml

$Id$

$Log$

use the package manager (yum/apt-get) to update all installed packages

:!ansible-playbook -u root -k --limit dvlnx115 --syntax-check %

:!ansible-playbook -u root -k --limit dvlnx115 %

:!ansible-playbook -vvv -u root -k --limit dvlnx115 %

what OS and version are you running on the controller and the target node?

Here’s what I’m working with:

[meggle1@dvlnx108 playbooks]$ cat /etc/os-release

NAME=“CentOS Linux”

VERSION=“7 (Core)”

ID=“centos”

ID_LIKE=“rhel fedora”

VERSION_ID=“7”

PRETTY_NAME=“CentOS Linux 7 (Core)”

ANSI_COLOR=“0;31”

CPE_NAME=“cpe:/o:centos:centos:7”

HOME_URL=“https://www.centos.org/

BUG_REPORT_URL=“https://bugs.centos.org/

CENTOS_MANTISBT_PROJECT=“CentOS-7”

CENTOS_MANTISBT_PROJECT_VERSION=“7”

REDHAT_SUPPORT_PRODUCT=“centos”

REDHAT_SUPPORT_PRODUCT_VERSION=“7”

[meggle1@dvlnx108 playbooks]$ ssh root@dvlnx115 cat /etc/os-release

root@dvlnx115’s password:

NAME=“CentOS Linux”

VERSION=“7 (Core)”

ID=“centos”

ID_LIKE=“rhel fedora”

VERSION_ID=“7”

PRETTY_NAME=“CentOS Linux 7 (Core)”

ANSI_COLOR=“0;31”

CPE_NAME=“cpe:/o:centos:centos:7”

HOME_URL=“https://www.centos.org/

BUG_REPORT_URL=“https://bugs.centos.org/

CENTOS_MANTISBT_PROJECT=“CentOS-7”

CENTOS_MANTISBT_PROJECT_VERSION=“7”

REDHAT_SUPPORT_PRODUCT=“centos”

REDHAT_SUPPORT_PRODUCT_VERSION=“7”

Mike

Curious about this:

Using module file /home/meggle1/src/ansible/playbooks/yum.retry

Can you remove/rename that file?

The “*.retry” file is a list of hosts that the playbook didn’t succeed for so you can “retry” the ansible command using “–limit file.retry” to only touch those hosts that previously failed.

Here’s the output after removin the “yum.retry” file:

[meggle1@dvlnx108 playbooks]$ ansible-playbook -u root -k --limit dvlnx115 yum.yml
SSH password:

PLAY [all] **************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************
ok: [dvlnx115]

TASK [checking for yum…] **********************************************************************************************************************************
ok: [dvlnx115]

TASK [update all packages (yum)] ****************************************************************************************************************************
[WARNING]: Consider using the yum module rather than running ‘yum’. If you need to use command because yum is insufficient you can add ‘warn: false’ to
this command task or set ‘command_warnings=False’ in ansible.cfg to get rid of this message.

changed: [dvlnx115]

TASK [update all packages (apt-get)] ************************************************************************************************************************
skipping: [dvlnx115]

RUNNING HANDLER [restart server] ****************************************************************************************************************************
fatal: [dvlnx115]: UNREACHABLE! => {“changed”: false, “msg”: “Data could not be sent to remote host "dvlnx115". Make sure this host can be reached over ssh: Connection to dvlnx115 closed by remote host.\r\n”, “unreachable”: true}

PLAY RECAP **************************************************************************************************************************************************
dvlnx115 : ok=3 changed=1 unreachable=1 failed=0 skipped=1 rescued=0 ignored=0

Puzzling to me is that if ansible is using separate ssh commands, the ssh succeeds gathering facts and checking for yum, but fails on that last part.

like I mentioned before, that task is failing because it does the reboot then tries to continue working but, can’t reach at all. I suggest you look at the links provided more and replace your tasks with those suggestions.

Mea cupla. You’re right. Duh. Of course ansible can’t reach the server because the server is booting.
I’ll look at the other links.

Thanks.

Mike