Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

The lineinfile module.

ANSIBLE VERSION

ansible 2.4.0.0
config file = /home/abologna/src/upstream/libvirt-jenkins-ci/guests/ansible.cfg
configured module search path = [u'/home/abologna/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.13 (default, Sep 5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]

CONFIGURATION

Running ansible-config dump --only-changed produces no output.

OS / ENVIRONMENT

Running Ansible on Fedora 26, fully updated, to manage CentOS 6.9, also fully updated.

SUMMARY

The /etc/rc.local file of a CentOS 6 machine can't be modified using the lineinfile module if backup: true is specified in the playbook. If backups are not enabled, the playbook will run successfully.

This only reproduces with Ansible 2.4: the same playbook can be used successfully, with backups enabled, with Ansible 2.3.2.0 on RHEL 7.4.

STEPS TO REPRODUCE

---
- hosts: all
tasks:
- lineinfile:
path: /etc/rc.local
line: 'true'
state: present
create: yes
backup: yes

EXPECTED RESULTS

The /etc/rc.local file is updated and a backup is created.

ACTUAL RESULTS

$ ansible-playbook -vvv -i inventory site.yml
ansible-playbook 2.4.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/abologna/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.13 (default, Sep 5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
Using /etc/ansible/ansible.cfg as config file
Parsed /tmp/inventory inventory source with ini plugin

PLAYBOOK: site.yml **************************************************************************************************************************************************************************************************
1 plays in site.yml

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

TASK [Gathering Facts] **********************************************************************************************************************************************************************************************
Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 centos-6 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<centos-6> (0, '/root\n', '')
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 centos-6 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125 `" && echo ansible-tmp-1508502404.31-262124572198125="` echo /root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125 `" ) && sleep 0'"'"''
<centos-6> (0, 'ansible-tmp-1508502404.31-262124572198125=/root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125\n', '')
<centos-6> PUT /tmp/tmpXHqgGE TO /root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125/setup.py
<centos-6> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 '[centos-6]'
<centos-6> (0, 'sftp> put /tmp/tmpXHqgGE /root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125/setup.py\n', '')
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 centos-6 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125/ /root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125/setup.py && sleep 0'"'"''
<centos-6> (0, '', '')
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 -tt centos-6 '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125/setup.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1508502404.31-262124572198125/" > /dev/null 2>&1 && sleep 0'"'"''
<centos-6> (0, '\r\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_product_version": "pc-i440fx-2.9", "ansible_fips": false, "ansible_service_mgr": "service", "ansible_user_id": "root", "ansible_selinux_python_present": true, "ansible_userspace_bits": "64", "ansible_all_ipv4_addresses": ["192.168.124.97"], "gather_subset": ["all"], "ansible_system_capabilities": [], "ansible_local": {}, "ansible_distribution_version": "6.9", "ansible_domain": "", "ansible_distribution_file_path": "/etc/redhat-release", "ansible_user_shell": "/bin/bash", "ansible_virtualization_type": "kvm", "ansible_real_user_id": 0, "ansible_processor_cores": 1, "ansible_virtualization_role": "guest", "ansible_distribution_file_variety": "RedHat", "ansible_dns": {"nameservers": ["192.168.124.1"]}, "ansible_processor_vcpus": 2, "ansible_bios_version": "1.10.2-1.fc26", "ansible_processor": ["0", "GenuineIntel", "Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz", "1", "GenuineIntel", "Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz"], "ansible_date_time": {"weekday_number": "5", "iso8601_basic_short": "20171020T122644", "tz": "UTC", "weeknumber": "42", "hour": "12", "year": "2017", "minute": "26", "tz_offset": "+0000", "month": "10", "epoch": "1508502404", "iso8601_micro": "2017-10-20T12:26:44.746527Z", "weekday": "Friday", "time": "12:26:44", "date": "2017-10-20", "iso8601": "2017-10-20T12:26:44Z", "day": "20", "iso8601_basic": "20171020T122644746423", "second": "44"}, "ansible_lo": {"features": {"tx_checksum_ipv4": "off [fixed]", "generic_receive_offload": "on", "tx_checksum_ipv6": "off [fixed]", "tx_scatter_gather_fraglist": "on [fixed]", "tx_checksum_unneeded": "off [fixed]", "highdma": "on [fixed]", "tx_lockless": "on [fixed]", "tx_tcp_ecn_segmentation": "on", "tx_gso_robust": "off [fixed]", "tx_checksumming": "on", "vlan_challenged": "on [fixed]", "loopback": "on [fixed]", "fcoe_mtu": "off [fixed]", "tx_checksum_sctp": "off [fixed]", "large_receive_offload": "off [fixed]", "tx_scatter_gather": "on [fixed]", "rx_checksumming": "on [fixed]", "tx_tcp_segmentation": "on", "netns_local": "on [fixed]", "generic_segmentation_offload": "on", "tx_udp_tnl_segmentation": "off [fixed]", "tcp_segmentation_offload": "on", "rx_vlan_offload": "off [fixed]", "ntuple_filters": "off [fixed]", "tx_vlan_offload": "off [fixed]", "tx_tcp6_segmentation": "on", "udp_fragmentation_offload": "on", "scatter_gather": "on", "tx_checksum_fcoe_crc": "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": 1876, "ansible_architecture": "x86_64", "ansible_device_links": {"masters": {}, "labels": {}, "ids": {}, "uuids": {"vda1": ["84144754-cadd-4f6b-8357-8370c0f219c7"], "vda2": ["3b542549-e535-40aa-8034-dcc0453c0d73"]}}, "ansible_default_ipv4": {"macaddress": "52:54:00:8c:bd:b1", "network": "192.168.124.0", "mtu": 1500, "broadcast": "192.168.124.255", "alias": "eth0", "netmask": "255.255.255.0", "address": "192.168.124.97", "interface": "eth0", "type": "ether", "gateway": "192.168.124.1"}, "ansible_swapfree_mb": 255, "ansible_default_ipv6": {}, "ansible_distribution_release": "Final", "ansible_system_vendor": "QEMU", "ansible_apparmor": {"status": "disabled"}, "ansible_cmdline": {"LANG": "en_US.UTF-8", "rd_NO_LUKS": true, "rd_NO_LVM": true, "console": "ttyS0", "ro": true, "KEYBOARDTYPE": "pc", "rd_NO_MD": true, "KEYTABLE": "us", "crashkernel": "129M@48M", "SYSFONT": "latarcyrheb-sun16", "root": "UUID=3b542549-e535-40aa-8034-dcc0453c0d73", "rd_NO_DM": true}, "ansible_effective_user_id": 0, "ansible_mounts": [{"block_used": 551802, "uuid": "N/A", "size_total": 15453913088, "block_total": 3772928, "mount": "/", "block_available": 3221126, "size_available": 13193732096, "fstype": "ext4", "inode_total": 966656, "options": "rw", "device": "/dev/vda2", "inode_used": 40028, "block_size": 4096, "inode_available": 926628}], "ansible_selinux": {"status": "enabled", "policyvers": 24, "type": "targeted", "mode": "enforcing", "config_mode": "enforcing"}, "ansible_distribution_file_parsed": true, "ansible_os_family": "RedHat", "ansible_userspace_architecture": "x86_64", "ansible_product_uuid": "A056E78E-1CA7-EC43-81FE-9B845948BBC7", "ansible_system": "Linux", "ansible_pkg_mgr": "yum", "ansible_memfree_mb": 1668, "ansible_devices": {"ram14": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram15": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram12": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram13": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram10": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram11": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram8": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram9": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram4": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram5": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram6": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram7": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram0": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram1": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram2": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "ram3": {"scheduler_mode": "", "rotational": "1", "vendor": null, "sectors": "32768", "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": "16.00 MB"}, "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"}, "vda": {"scheduler_mode": "cfq", "rotational": "1", "vendor": "6900", "sectors": "31457280", "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": {"vda1": {"sectorsize": 512, "uuid": "84144754-cadd-4f6b-8357-8370c0f219c7", "links": {"masters": [], "labels": [], "ids": [], "uuids": ["84144754-cadd-4f6b-8357-8370c0f219c7"]}, "sectors": "524288", "start": "2048", "holders": [], "size": "256.00 MB"}, "vda2": {"sectorsize": 512, "uuid": "3b542549-e535-40aa-8034-dcc0453c0d73", "links": {"masters": [], "labels": [], "ids": [], "uuids": ["3b542549-e535-40aa-8034-dcc0453c0d73"]}, "sectors": "30930944", "start": "526336", "holders": [], "size": "14.75 GB"}}, "holders": [], "size": "15.00 GB"}}, "ansible_user_uid": 0, "ansible_lvm": {"pvs": {}, "lvs": {}, "vgs": {}}, "ansible_distribution": "CentOS", "ansible_user_dir": "/root", "ansible_env": {"LESSOPEN": "||/usr/bin/lesspipe.sh %s", "SSH_CLIENT": "192.168.124.1 47454 22", "SELINUX_USE_CURRENT_RANGE": "", "LOGNAME": "root", "USER": "root", "HOME": "/root", "PATH": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin", "LANG": "en_US.UTF-8", "TERM": "xterm-256color", "SHELL": "/bin/bash", "SHLVL": "2", "G_BROKEN_FILENAMES": "1", "XMODIFIERS": "@im=ibus", "SELINUX_ROLE_REQUESTED": "", "_": "/usr/bin/python", "LS_COLORS": "rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lz=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.bz=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.rar=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:", "SSH_TTY": "/dev/pts/1", "SELINUX_LEVEL_REQUESTED": "", "PWD": "/root", "CVS_RSH": "ssh", "MAIL": "/var/mail/root", "SSH_CONNECTION": "192.168.124.1 47454 192.168.124.97 22"}, "ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBANu0fMaLOkbQa8L7AMS1gulQL1ry3EdxGnTNxhwVD35QINZOV25JzehbfM9wKt5iqngSCdj6IrUsFLl177sKi3E2Ve6wIAEvpTylGY0Vy48WxAq8dJI4nqj7yqKGPB4X1x8FlQ8qAdAEQeYqUlhVNOSCAplOtaJrRkTQhxR1ecLBAAAAFQCMZHv9KOErP3bVVBkSwX+NRANUNwAAAIBP4ZbbUianSctoZ2jsrXJ4kyEyh1Aeexa6LyFhKCj3nG91fcEYncLvn7prZkG3+3MofbaLhe1MJbIOGOg589gR9lQqY7akq5TtgaaiigHQbhI6orit/ET9oBKg99NECeN9YWr6BHpo+XM+4X9UkBlsPPno2axFSHUZ07x3j7rfowAAAIA13+NMcUHaBQF9aHZZGIUJX2UbS72LPK6mRWTx42+wTWZ0YoFJcL7pER2Wqj3jbBzXkuCt38pzElTvHqiwre6V5PDaqA9FsnJE6vi/B2oZT01+wYt392L2UGBpVLMBNkfNZk7AMRYPS+dUkcmTvVSXPyCOYAKXKAH9zrKTLgLYYw==", "module_setup": true, "ansible_processor_count": 2, "ansible_hostname": "libvirt-centos-6", "ansible_effective_group_id": 0, "ansible_swaptotal_mb": 255, "ansible_lsb": {}, "ansible_real_group_id": 0, "ansible_bios_date": "04/01/2014", "ansible_all_ipv6_addresses": ["fe80::5054:ff:fe8c:bdb1"], "ansible_eth0": {"macaddress": "52:54:00:8c:bd:b1", "features": {"tx_checksum_ipv4": "off [fixed]", "generic_receive_offload": "on", "tx_checksum_ipv6": "off [fixed]", "tx_scatter_gather_fraglist": "off [fixed]", "tx_checksum_unneeded": "off [fixed]", "highdma": "on [fixed]", "tx_lockless": "off [fixed]", "tx_tcp_ecn_segmentation": "on", "tx_gso_robust": "off [fixed]", "tx_checksumming": "on", "vlan_challenged": "off [fixed]", "loopback": "off [fixed]", "fcoe_mtu": "off [fixed]", "tx_checksum_sctp": "off [fixed]", "large_receive_offload": "off [fixed]", "tx_scatter_gather": "on", "rx_checksumming": "on [fixed]", "tx_tcp_segmentation": "on", "netns_local": "off [fixed]", "generic_segmentation_offload": "on", "tx_udp_tnl_segmentation": "off [fixed]", "tcp_segmentation_offload": "on", "rx_vlan_offload": "off [fixed]", "ntuple_filters": "off [fixed]", "tx_vlan_offload": "off [fixed]", "tx_tcp6_segmentation": "on", "udp_fragmentation_offload": "on", "scatter_gather": "on", "tx_checksum_fcoe_crc": "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]"}, "pciid": "virtio0", "module": "virtio_net", "mtu": 1500, "device": "eth0", "promisc": false, "timestamping": ["rx_software", "software"], "ipv4": {"broadcast": "192.168.124.255", "netmask": "255.255.255.0", "network": "192.168.124.0", "address": "192.168.124.97"}, "ipv6": [{"scope": "link", "prefix": "64", "address": "fe80::5054:ff:fe8c:bdb1"}], "active": true, "type": "ether", "hw_timestamp_filters": []}, "ansible_interfaces": ["lo", "eth0"], "ansible_uptime_seconds": 916, "ansible_machine_id": "f2b602101b0b773d51021b670000000a", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAABIwAAAQEA05EALIg/xKJhBoEO2b2GJUsOfH3NHlIH/sH5Iu7R4NqKna1D7Mqcc/o0X4vGK4TlkJpPoXMWj0uPTTqmxrjEe8ZYOy45i9yRoFL80MirjBOTlypa/FwJF2C0W03Fla4SFsSiJ3VNsDXWvm0b6Jr4lZn3EswFEP1h1vtfMEkrwTupO2jbjKiXFjF8FEOVCPlSFM4kMr97lkXUh1id/ejHsFbguy+Uc1x77TqIkUyLjWuBEsZbYMSY/0oOrDpQghoh04zucUQ1FKJnHyz/9gQPUhWtA4DFndXwMpoNhN6+ojdmJmrRfiuNZAkJUrS091YBW8rVPZl122r8jmYu1fHOMw==", "ansible_user_gecos": "root", "ansible_system_capabilities_enforced": "False", "ansible_python": {"executable": "/usr/bin/python", "version": {"micro": 6, "major": 2, "releaselevel": "final", "serial": 0, "minor": 6}, "type": "CPython", "has_sslcontext": false, "version_info": [2, 6, 6, "final", 0]}, "ansible_processor_threads_per_core": 1, "ansible_fqdn": "libvirt-centos-6", "ansible_user_gid": 0, "ansible_memory_mb": {"real": {"total": 1876, "used": 208, "free": 1668}, "swap": {"cached": 0, "total": 255, "free": 255, "used": 0}, "nocache": {"used": 128, "free": 1748}}, "ansible_python_version": "2.6.6", "ansible_product_name": "Standard PC (i440FX + PIIX, 1996)", "ansible_machine": "x86_64", "ansible_distribution_major_version": "6", "ansible_kernel": "2.6.32-696.13.2.el6.x86_64", "ansible_nodename": "libvirt-centos-6"}}\r\n', 'Shared connection to centos-6 closed.\r\n')
ok: [centos-6]
META: ran handlers

TASK [lineinfile] ***************************************************************************************************************************************************************************************************
task path: /tmp/site.yml:4
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/lineinfile.py
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 centos-6 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<centos-6> (0, '/root\n', '')
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 centos-6 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560 `" && echo ansible-tmp-1508502405.07-256227856306560="` echo /root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560 `" ) && sleep 0'"'"''
<centos-6> (0, 'ansible-tmp-1508502405.07-256227856306560=/root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560\n', '')
<centos-6> PUT /tmp/tmp3SsL5Q TO /root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560/lineinfile.py
<centos-6> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 '[centos-6]'
<centos-6> (0, 'sftp> put /tmp/tmp3SsL5Q /root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560/lineinfile.py\n', '')
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 centos-6 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560/ /root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560/lineinfile.py && sleep 0'"'"''
<centos-6> (0, '', '')
<centos-6> ESTABLISH SSH CONNECTION FOR USER: None
<centos-6> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/abologna/.ansible/cp/9cfa56e763 -tt centos-6 '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560/lineinfile.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1508502405.07-256227856306560/" > /dev/null 2>&1 && sleep 0'"'"''
<centos-6> (0, '\r\n{"exception": "Traceback (most recent call last):\\n File \\"/tmp/ansible_VjChDH/ansible_modlib.zip/ansible/module_utils/basic.py\\", line 1282, in set_attributes_if_different\\n raise Exception(\\"Error while setting attributes: %s\\" % (out + err))\\nException: Error while setting attributes: /usr/bin/chattr: Clearing extent flag not supported on /etc/rc.local.7472.2017-10-20@12:26:45~\\n\\n", "group": "root", "uid": 0, "mode": "0755", "failed": true, "state": "file", "gid": 0, "secontext": "system_u:object_r:etc_t:s0", "details": "Error while setting attributes: /usr/bin/chattr: Clearing extent flag not supported on /etc/rc.local.7472.2017-10-20@12:26:45~\\n", "invocation": {"module_args": {"directory_mode": null, "force": null, "remote_src": null, "backrefs": false, "insertafter": null, "path": "/etc/rc.local", "owner": null, "follow": false, "validate": null, "group": null, "insertbefore": null, "unsafe_writes": null, "create": true, "setype": null, "content": null, "serole": null, "state": "present", "selevel": null, "regexp": null, "line": "true", "src": null, "seuser": null, "delimiter": null, "mode": null, "attributes": null, "backup": true}}, "owner": "root", "path": "/etc/rc.local.7472.2017-10-20@12:26:45~", "size": 220, "msg": "chattr failed"}\r\n', 'Shared connection to centos-6 closed.\r\n')
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_VjChDH/ansible_modlib.zip/ansible/module_utils/basic.py", line 1282, in set_attributes_if_different
raise Exception("Error while setting attributes: %s" % (out + err))
Exception: Error while setting attributes: /usr/bin/chattr: Clearing extent flag not supported on /etc/rc.local.7472.2017-10-20@12:26:45~

fatal: [centos-6]: FAILED! => {
"changed": false,
"details": "Error while setting attributes: /usr/bin/chattr: Clearing extent flag not supported on /etc/rc.local.7472.2017-10-20@12:26:45~\n",
"failed": true,
"gid": 0,
"group": "root",
"invocation": {
"module_args": {
"attributes": null,
"backrefs": false,
"backup": true,
"content": null,
"create": true,
"delimiter": null,
"directory_mode": null,
"follow": false,
"force": null,
"group": null,
"insertafter": null,
"insertbefore": null,
"line": "true",
"mode": null,
"owner": null,
"path": "/etc/rc.local",
"regexp": null,
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "present",
"unsafe_writes": null,
"validate": null
}
},
"mode": "0755",
"msg": "chattr failed",
"owner": "root",
"path": "/etc/rc.local.7472.2017-10-20@12:26:45~",
"secontext": "system_u:object_r:etc_t:s0",
"size": 220,
"state": "file",
"uid": 0
}
to retry, use: --limit @/tmp/site.retry

PLAY RECAP **********************************************************************************************************************************************************************************************************
centos-6 : ok=1 changed=0 unreachable=0 failed=1

Issue 2:
SUMMARY

Tasks will sporadically fail due to the error message FAILED! => {"msg": "Timeout (12s) waiting for privilege escalation prompt: "}. It's hard to reproduce consistently, and retries of playbooks that fail usually succeed.

I've seen various reports of this error and various fixes, but I'm still encountering it fairly regularly.

ISSUE TYPE

Bug Report

COMPONENT NAME

Ansible SSH connections

ANSIBLE VERSION

ansible 2.4.2.0
config file = /Users/rafe/workspace/platform/ansible/ansible.cfg
configured module search path = ['/Users/rafe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/rafe/workspace/platform/ansible/.venv/lib/python3.6/site-packages/ansible
executable location = /Users/rafe/workspace/platform/ansible/.venv/bin/ansible
python version = 3.6.3 (default, Nov 2 2017, 09:26:55) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.38)]

CONFIGURATION

ANSIBLE_PIPELINING(/Users/rafe/workspace/platform/ansible/ansible.cfg) = False
ANSIBLE_SSH_ARGS(/Users/rafe/workspace/platform/ansible/ansible.cfg) = -F .ssh/config -o ControlMaster=auto -o ControlPersist=30m -o ControlPath=.ssh/ansible-control-path-%r@%h:%p
DEFAULT_HOST_LIST(/Users/rafe/workspace/platform/ansible/ansible.cfg) = ['/Users/rafe/workspace/platform/ansible/hosts/ec2.py']
DEFAULT_VAULT_PASSWORD_FILE(/Users/rafe/workspace/platform/ansible/ansible.cfg) = /Users/rafe/workspace/platform/ansible/.vault-pass
HOST_KEY_CHECKING(/Users/rafe/workspace/platform/ansible/ansible.cfg) = False
RETRY_FILES_SAVE_PATH(/Users/rafe/workspace/platform/ansible/ansible.cfg) = /Users/rafe/.ansible/retry-files

OS / ENVIRONMENT

macOS 10.12.6 managing Canonical Ubuntu 16.04.03 LTS

DEPENDENCY PROBLEMS

(none)

STEPS TO REPRODUCE

As mentioned above, this is not consistently reproducible. Following is an excerpt from a role that installs docker. It often fails on the install docker task.

- name: install prereq packages
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common

- name: add docker GPG key
apt_key:
url: "https://download.docker.com/linux/ubuntu/gpg"
id: "9DC858229FC7DD38854AE2D88D81803C0EBFCD88"
state: present

- name: get lsb_release -cs
command: lsb_release -cs
register: lsb_release
changed_when: lsb_release.rc > 0

- name: add docker apt repository
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ lsb_release.stdout }} stable"

- name: install docker
apt:
name: docker-ce
state: present
update_cache: yes

EXPECTED RESULTS

Install docker

ACTUAL RESULTS

Failed with `FAILED! => {"msg": "Timeout (12s) waiting for privilege escalation prompt: "}`