Description of problem: Since the last updates, cron operations are broken, with the message "[Errno 25] Inappropriate ioctl for device". Version-Release number of selected component (if applicable): ansible 2.1.2.0 Both the target and the local machines are fully up to date (Fedora 24). Kernel on both machines: 4.7.9-200.fc24.x86_64 How reproducible: Always Steps to Reproduce: 1. With the latest Ansible on Fedora 24, run a playbook with a cron section. Actual results: The cron will be updated by Ansible Expected results: A fatal error is thrown. Additional info: On the console, the following can be seen: fatal: [riacho]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "\r\nTraceback (most recent call last):\r\n File \"/tmp/ansible_oUdIn7/ansible_module_cron.py\", line 700, in <module>\r\n main()\r\n File \"/tmp/ansible_oUdIn7/ansible_module_cron.py\", line 575, in main\r\n crontab = CronTab(module, user, cron_file)\r\n File \"/tmp/ansible_oUdIn7/ansible_module_cron.py\", line 233, in __init__\r\n self.read()\r\n File \"/tmp/ansible_oUdIn7/ansible_module_cron.py\", line 251, in read\r\n (rc, out, err) = self.module.run_command(self._read_user_execute(), use_unsafe_shell=True)\r\n File \"/tmp/ansible_oUdIn7/ansible_module_cron.py\", line 480, in _read_user_execute\r\n elif os.getlogin() != self.user:\r\nOSError: [Errno 25] Inappropriate ioctl for device\r\n", "msg": "MODULE FAILURE"} Sample Ansible instructions that will trigger this: - name: Backup emails cron: name="backup emails" user=root special_time=daily job="/usr/bin/rsync -av /var/spool/mail/vhosts/ /mnt/backups/emails/ && touch /mnt/backups/emails/lastbackup" - name: Renew certificates cron: name="Renew certificate for {{item}}" user=root special_time=monthly job="/usr/local/bin/update-letsencrypt-cert.sh {{item}}" with_items: - sub.domain1.tld - sub.domain2.tld Manually ssh'ing into the machine works, sudo'ing to root (sudo -s) works, as well as "sudo crontab -l" and "sudo crontab -e"+changes.
Additional info: this was working fine until at least Sept 22nd.
I cannot duplicate this here. What is 'pipelining' set to in your ansible.cfg ? If it's True, does changing it to false make it work?
It was originally commented out and I changed it to False after seeing a post on Stackoverflow, with no effect. I just changed to True, ran the playbook again, and got the same failure.
Can you run the module by itself with debug and attach that? ansible -vvvv -m cron -a 'name="backup emails" user=root special_time=daily job="/usr/bin/rsync -av /var/spool/mail/vhosts/ /mnt/backups/emails/ && touch /mnt/backups/emails/lastbackup"' hostname
Sure: https://paste.fedoraproject.org/460873/47741270/
Not sure it's relevant, but the host is available behind a bastion host. The ssh_config is as follows: Host riacho Hostname bastion.domain.tld ForwardAgent yes ControlMaster auto ControlPersist yes ControlPath ~/.ssh/socket-%r@%h:%p Compression yes AddressFamily inet
I am pretty sure this is related to your bastion host setup. If you disable the Control* options does it work? If you replace with: Host riacho HostName %h ProxyCommand ssh -q bastion.domain.tld /usr/bin/nc %h 22 Does it work?
Sorry, it seems I was wrong: this host is one of the only ones where I don't have a bastion in front :) In any case, I removed pretty much all custom settings from ~/.ssh/config related to this host, leaving only the "Host" and "Hostname" parts, and I still have the problem. It's worth noting that there are steps happening before this, so, the SSH connection is successful for those steps. Logs for a successful scenario: https://paste.fedoraproject.org/466918/93517214/ Logs for a failure scenario: https://paste.fedoraproject.org/466919/47793520/
I also managed to get the `cron` python script that Ansible copies to the remote host, and ran it manually, getting the same error. Python script: https://paste.fedoraproject.org/466921/93570914/ Manual runs, with the same ioctl issue: https://paste.fedoraproject.org/466922/35952147/
Looks like this is https://github.com/ansible/ansible-modules-core/pull/4777 which should be fixed in 2.1.3 (which should be out very soon) and 2.2.0...
+1, that's indeed the issue. Patching cron.py made it work.
ansible-2.2.0.0-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-e348c4e0e3
ansible-2.2.0.0-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a5f9956e38
ansible-2.2.0.0-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-e348c4e0e3
ansible-2.2.0.0-3.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-3113e71193
ansible-2.2.0.0-3.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-3ccb098630
ansible-2.2.0.0-3.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-3ccb098630
ansible-2.2.0.0-3.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-3113e71193
ansible-2.2.0.0-3.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
ansible-2.2.0.0-3.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.