{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/50110","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/50110/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/50110/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/50110/events","html_url":"https://github.com/ansible/ansible/issues/50110","id":392344284,"node_id":"MDU6SXNzdWUzOTIzNDQyODQ=","number":50110,"title":"lineinfile/blockinfile only runs once when looping","user":{"login":"DrHashi","id":38114624,"node_id":"MDQ6VXNlcjM4MTE0NjI0","avatar_url":"https://avatars3.githubusercontent.com/u/38114624?v=4","gravatar_id":"","url":"https://api.github.com/users/DrHashi","html_url":"https://github.com/DrHashi","followers_url":"https://api.github.com/users/DrHashi/followers","following_url":"https://api.github.com/users/DrHashi/following{/other_user}","gists_url":"https://api.github.com/users/DrHashi/gists{/gist_id}","starred_url":"https://api.github.com/users/DrHashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DrHashi/subscriptions","organizations_url":"https://api.github.com/users/DrHashi/orgs","repos_url":"https://api.github.com/users/DrHashi/repos","events_url":"https://api.github.com/users/DrHashi/events{/privacy}","received_events_url":"https://api.github.com/users/DrHashi/received_events","type":"User","site_admin":false},"labels":[{"id":947190508,"node_id":"MDU6TGFiZWw5NDcxOTA1MDg=","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.7","name":"affects_2.7","color":"ededed","default":false},{"id":785271699,"node_id":"MDU6TGFiZWw3ODUyNzE2OTk=","url":"https://api.github.com/repos/ansible/ansible/labels/bug","name":"bug","color":"fbca04","default":true},{"id":496359346,"node_id":"MDU6TGFiZWw0OTYzNTkzNDY=","url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":503572087,"node_id":"MDU6TGFiZWw1MDM1NzIwODc=","url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false},{"id":636352796,"node_id":"MDU6TGFiZWw2MzYzNTI3OTY=","url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-12-18T21:31:34Z","updated_at":"2019-01-02T15:01:34Z","closed_at":"2019-01-02T15:01:33Z","author_association":"NONE","body":"##### SUMMARY\r\n<!--- Explain the problem briefly below -->\r\n\r\n##### ISSUE TYPE\r\n- Bug Report\r\n\r\nlineinfile/blockinfile only adds the first variable when looping through a list\r\n\r\n##### COMPONENT NAME\r\nlineinfile and blockinfile\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes -->\r\n```paste below\r\n\r\nansible 2.7.0\r\n  config file = /opt//deploy/ansible.cfg\r\n  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible\r\n  executable location = /usr/local/bin/ansible\r\n  python version = 2.7.6 (default, Nov 13 2018, 12:45:42) [GCC 4.8.4]\r\n```\r\n\r\n##### CONFIGURATION\r\n<!--- Paste verbatim output from \"ansible-config dump --only-changed\" between quotes -->\r\n```\r\nANSIBLE_SSH_ARGS(/opt/deploy/ansible.cfg) = -o ForwardAgent=yes\r\nDEFAULT_ROLES_PATH(/opt/deploy/ansible.cfg) = [u'/opt/deploy/roles']\r\nDEFAULT_TRANSPORT(/opt/deploy/ansible.cfg) = ssh\r\nHOST_KEY_CHECKING(/opt/deploy/ansible.cfg) = False\r\nRETRY_FILES_ENABLED(/opt/deploy/ansible.cfg) = False\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->\r\n\r\nUbuntu 14.04\r\n\r\n##### STEPS TO REPRODUCE\r\n<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->\r\n\r\nrun blockinfile or lineinfile more than once while looping through a list\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n\r\nvars:\r\n  whitelisted_ips:\r\n    - 10.208.225.130\r\n    - 10.208.225.131\r\ntasks:\r\n  - name: whitelisting ips\r\n    lineinfile:\r\n      path: /etc/hosts.allow\r\n      regexp: '^sshd : '\r\n      line: 'sshd : {{ item }}'\r\n      state: present\r\n    loop: \"{{ whitelisted_ips }}\"\r\n\r\nOR\r\n\r\ntasks:\r\n  - name: whitelisting ips\r\n    blockinfile:\r\n      dest: /etc/hosts.allow\r\n      block: |\r\n        sshd : {{ item }}\r\n    loop: \"{{ whitelisted_ips }}\"\r\n\r\n```\r\n\r\n<!--- HINT: You can paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- Describe what you expected to happen when running the steps above -->\r\n\r\nsshd : 10.208.225.130\r\nsshd : 10.208.225.131\r\n\r\nOR\r\n\r\n# BEGIN ANSIBLE MANAGED BLOCK\r\nsshd : 10.208.225.130\r\nsshd : 10.208.225.131\r\n# END ANSIBLE MANAGED BLOCK\r\n\r\n##### ACTUAL RESULTS\r\n<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->\r\n\r\nsshd : 10.208.225.130\r\n\r\nor\r\n\r\n# BEGIN ANSIBLE MANAGED BLOCK\r\nsshd : 10.208.225.130\r\n# END ANSIBLE MANAGED BLOCK\r\n\r\n<!--- Paste verbatim command output between quotes -->\r\n```paste below\r\n\r\n```\r\n"}}
{"actor":{"display_login":"bcoca"}}