{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4029","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4029/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4029/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/4029/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/4029","id":162042774,"number":4029,"title":"Error with module apt autoremove","user":{"login":"galindro","id":4622097,"avatar_url":"https://avatars.githubusercontent.com/u/4622097?v=3","gravatar_id":"","url":"https://api.github.com/users/galindro","html_url":"https://github.com/galindro","followers_url":"https://api.github.com/users/galindro/followers","following_url":"https://api.github.com/users/galindro/following{/other_user}","gists_url":"https://api.github.com/users/galindro/gists{/gist_id}","starred_url":"https://api.github.com/users/galindro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galindro/subscriptions","organizations_url":"https://api.github.com/users/galindro/orgs","repos_url":"https://api.github.com/users/galindro/repos","events_url":"https://api.github.com/users/galindro/events{/privacy}","received_events_url":"https://api.github.com/users/galindro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-23T23:04:14Z","updated_at":"2016-06-23T23:04:14Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\napt autoremove\r\n\r\n##### ANSIBLE VERSION\r\n``` bash\r\nansible 2.1.0.0\r\n  config file = /home/galindro/git_repos/devops/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\n``` bash\r\n$ cat ansible.cfg\r\n\r\n[defaults]\r\nhost_key_checking = False\r\n\r\n[ssh_connection]\r\npipelining=False\r\nssh_args = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=30m -o ControlPath=\"~/.ansible/tmp/ansible-ssh-%h-%p-%r\"\r\n```\r\nI'm NOT using any ANSIBLE_* environment variable\r\n\r\n##### OS / ENVIRONMENT\r\n```\r\nNo LSB modules are available.\r\nDistributor ID:\tDebian\r\nDescription:\tDebian GNU/Linux 8.5 (jessie)\r\nRelease:\t8.5\r\nCodename:\tjessie\r\n```\r\n\r\n##### SUMMARY\r\nI'm used the apt module with autoremove option and this error was showed when I run the task:\r\n```\r\nTASK [common : autoremove unused packages] *************************************\r\nfatal: [172.30.2.214]: FAILED! => {\"changed\": false, \"failed\": true, \"module_stderr\": \"\", \"module_stdout\": \"Traceback (most recent call last):\\r\\n  File \\\"/tmp/ansible_RpjDPt/ansible_module_apt.py\\\", line 842, in <module>\\r\\n    main()\\r\\n  File \\\"/tmp/ansible_RpjDPt/ansible_module_apt.py\\\", line 802, in main\\r\\n    for package in packages:\\r\\nTypeError: 'NoneType' object is not iterable\\r\\n\", \"msg\": \"MODULE FAILURE\", \"parsed\": false}\r\n```\r\n\r\n##### STEPS TO REPRODUCE\r\nCreate this task:\r\n``` yaml\r\n- name: autoremove unused packages\r\n  apt:\r\n    autoremove: yes\r\n  sudo: yes\r\n  tags:\r\n    - infra\r\n```\r\n\r\nPut that task inside a simple role\r\n\r\nCreate a playbook:\r\n``` yaml\r\n- hosts: all\r\n  role:\r\n     - myrolename\r\n  environment:\r\n    TMOUT: 600\r\n```\r\n\r\nRun the playbook\r\n```\r\nansible-playbook -i ec2.py -v -b myplay.yml\r\n```\r\n\r\nP.S.: my host is an instance running on amazon ec2\r\n\r\n##### EXPECTED RESULTS\r\nThis error:\r\n``` bash\r\nTASK [myrolename : autoremove unused packages] *************************************\r\nfatal: [172.30.2.214]: FAILED! => {\"changed\": false, \"failed\": true, \"module_stderr\": \"\", \"module_stdout\": \"Traceback (most recent call last):\\r\\n  File \\\"/tmp/ansible_RpjDPt/ansible_module_apt.py\\\", line 842, in <module>\\r\\n    main()\\r\\n  File \\\"/tmp/ansible_RpjDPt/ansible_module_apt.py\\\", line 802, in main\\r\\n    for package in packages:\\r\\nTypeError: 'NoneType' object is not iterable\\r\\n\", \"msg\": \"MODULE FAILURE\", \"parsed\": false}\r\n```\r\n##### ACTUAL RESULTS\r\nRunning with -vvvv:\r\n```\r\nTASK [myrolename : autoremove unused packages] *************************************\r\ntask path: /home/galindro/git_repos/devops/roles/myrolename/tasks/debian.yml:52\r\n<172.30.2.214> ESTABLISH SSH CONNECTION FOR USER: ubuntu\r\n<172.30.2.214> SSH: EXEC ssh -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=30m -o 'ControlPath=~/.ansible/tmp/ansible-ssh-%h-%p-%r' -o StrictHostKeyChecking=no -o Port=40 -o 'IdentityFile=\"sbkey_20150204_app.pem\"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 172.30.2.214 '/bin/sh -c '\"'\"'( umask 77 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1466722720.22-229804017504254 `\" && echo ansible-tmp-1466722720.22-229804017504254=\"` echo $HOME/.ansible/tmp/ansible-tmp-1466722720.22-229804017504254 `\" ) && sleep 0'\"'\"''\r\n<172.30.2.214> PUT /tmp/tmpBiapsW TO /home/ubuntu/.ansible/tmp/ansible-tmp-1466722720.22-229804017504254/apt\r\n<172.30.2.214> SSH: EXEC sftp -b - -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=30m -o 'ControlPath=~/.ansible/tmp/ansible-ssh-%h-%p-%r' -o StrictHostKeyChecking=no -o Port=40 -o 'IdentityFile=\"sbkey_20150204_app.pem\"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 '[172.30.2.214]'\r\n<172.30.2.214> ESTABLISH SSH CONNECTION FOR USER: ubuntu\r\n<172.30.2.214> SSH: EXEC ssh -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=30m -o 'ControlPath=~/.ansible/tmp/ansible-ssh-%h-%p-%r' -o StrictHostKeyChecking=no -o Port=40 -o 'IdentityFile=\"sbkey_20150204_app.pem\"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -tt 172.30.2.214 '/bin/sh -c '\"'\"'sudo -H -S -n -u root /bin/sh -c '\"'\"'\"'\"'\"'\"'\"'\"'echo BECOME-SUCCESS-yhgovfdopoujnzwegznjpbbaoqcpcnyd; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 TMOUT=600 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1466722720.22-229804017504254/apt; rm -rf \"/home/ubuntu/.ansible/tmp/ansible-tmp-1466722720.22-229804017504254/\" > /dev/null 2>&1'\"'\"'\"'\"'\"'\"'\"'\"' && sleep 0'\"'\"''\r\nfatal: [172.30.2.214]: FAILED! => {\"changed\": false, \"failed\": true, \"invocation\": {\"module_name\": \"apt\"}, \"module_stderr\": \"OpenSSH_6.7p1 Debian-5+deb8u2, OpenSSL 1.0.1t  3 May 2016\\r\\ndebug1: Reading configuration data /home/galindro/.ssh/config\\r\\ndebug1: Reading configuration data /etc/ssh/ssh_config\\r\\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\\r\\ndebug1: auto-mux: Trying existing master\\r\\ndebug2: fd 3 setting O_NONBLOCK\\r\\ndebug2: mux_client_hello_exchange: master version 4\\r\\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\\r\\ndebug3: mux_client_request_session: entering\\r\\ndebug3: mux_client_request_alive: entering\\r\\ndebug3: mux_client_request_alive: done pid = 32546\\r\\ndebug3: mux_client_request_session: session request sent\\r\\ndebug1: mux_client_request_session: master session id: 2\\r\\ndebug3: mux_client_read_packet: read header failed: Broken pipe\\r\\ndebug2: Received exit status from master 0\\r\\nShared connection to 172.30.2.214 closed.\\r\\n\", \"module_stdout\": \"Traceback (most recent call last):\\r\\n  File \\\"/tmp/ansible_uvVsjU/ansible_module_apt.py\\\", line 842, in <module>\\r\\n    main()\\r\\n  File \\\"/tmp/ansible_uvVsjU/ansible_module_apt.py\\\", line 802, in main\\r\\n    for package in packages:\\r\\nTypeError: 'NoneType' object is not iterable\\r\\n\", \"msg\": \"MODULE FAILURE\", \"parsed\": false}\r\n```\r\n"}}
{"actor":{"display_login":"galindro"}}