{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3173","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3173/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3173/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3173/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3173","id":137947142,"number":3173,"title":"Error on ec2_group module ```Invalid rule parameter '['```","user":{"login":"rochacbruno","id":458654,"avatar_url":"https://avatars.githubusercontent.com/u/458654?v=3","gravatar_id":"","url":"https://api.github.com/users/rochacbruno","html_url":"https://github.com/rochacbruno","followers_url":"https://api.github.com/users/rochacbruno/followers","following_url":"https://api.github.com/users/rochacbruno/following{/other_user}","gists_url":"https://api.github.com/users/rochacbruno/gists{/gist_id}","starred_url":"https://api.github.com/users/rochacbruno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rochacbruno/subscriptions","organizations_url":"https://api.github.com/users/rochacbruno/orgs","repos_url":"https://api.github.com/users/rochacbruno/repos","events_url":"https://api.github.com/users/rochacbruno/events{/privacy}","received_events_url":"https://api.github.com/users/rochacbruno/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-02T18:02:20Z","updated_at":"2016-03-03T10:15:58Z","closed_at":null,"body":"##### Issue Type:\r\n - Bug Report\r\n\r\n##### Ansible Version:\r\n\r\nLatest from github development\r\n\r\n```\r\ngit clone git://github.com/ansible/ansible.git --recursive\r\ncd ./ansible\r\ngit submodule update --init --recursive\r\npython setup.py install\r\n\r\nansible --version\r\nansible 2.1.0\r\n```\r\n\r\n> NOTE: using version from February 3 the bug did not happen\r\n\r\n```\r\ngit clone git://github.com/ansible/ansible.git --recursive\r\ncd ./ansible\r\n\r\n# CHECKOUT VERSION FROM FEBRUARY, 3\r\ngit checkout 699a854bf30784cd7514f4c1b6f8bd742868f7eb\r\ngit submodule update --init --recursive\r\npython setup.py install\r\n\r\nansible --version\r\nansible 2.1.0\r\n```\r\n\r\n\r\n##### Ansible Configuration:\r\n\r\n```\r\nhost_key_checking = False\r\n```\r\n\r\n##### Environment:\r\n\r\nUbuntu 14.04, Python 2.7\r\n\r\n##### Summary:\r\n\r\nSecurity groups is created but error occurred on \"rules\" steps\r\n\r\n##### Steps To Reproduce:\r\n\r\nConsider the playbook\r\n\r\n```\r\n---\r\n- hosts: localhost\r\n  connection: local\r\n  gather_facts: False\r\n  vars:\r\n    ansible_ssh_user: ubuntu\r\n    group_name: TEST-ANSIBLE\r\n    aws_region: us-east-1\r\n  tasks:\r\n    - name: Create security groups\r\n      ec2_group:\r\n        name: \"{{group_name}}\"\r\n        description: an example EC2 group\r\n        vpc_id: vpc-xxxxxxxxx\r\n        region: \"{{aws_region}}\"\r\n        aws_access_key: \"{{aws_access_key}}\"\r\n        aws_secret_key: \"{{aws_secret_key}}\"\r\n        purge_rules: true\r\n        purge_rules_egress: true\r\n        rules:\r\n          - proto: tcp\r\n            from_port: 80\r\n            to_port: 80\r\n            cidr_ip: 0.0.0.0/0\r\n          - proto: tcp\r\n            from_port: 22\r\n            to_port: 22\r\n            cidr_ip: 10.0.0.0/8\r\n          - proto: tcp\r\n            from_port: 443\r\n            to_port: 443\r\n            group_id: API\r\n          - proto: tcp\r\n            from_port: 3306\r\n            to_port: 3306\r\n            group_id: RECSYS-BACKEND\r\n          - proto: udp\r\n            from_port: 10050\r\n            to_port: 10050\r\n            cidr_ip: 10.0.0.0/8\r\n          - proto: udp\r\n            from_port: 10051\r\n            to_port: 10051\r\n            group_id: API\r\n          - proto: icmp\r\n            from_port: 8 # icmp type, -1 = any type\r\n            to_port:  -1 # icmp subtype, -1 = any subtype\r\n            cidr_ip: 10.0.0.0/8\r\n          - proto: all\r\n            group_name: example\r\n            group_desc: other example EC2 group\r\n        rules_egress:\r\n          - proto: tcp\r\n            from_port: 80\r\n            to_port: 80\r\n            cidr_ip: 0.0.0.0/0\r\n      register: created_group\r\n    - name: Tag group\r\n      ec2_tag:\r\n        region: \"{{aws_region}}\"\r\n        aws_access_key: \"{{aws_access_key}}\"\r\n        aws_secret_key: \"{{aws_secret_key}}\"\r\n        resource: \"{{created_group.group_id}}\"\r\n        state: present\r\n        tags:\r\n          Name: \"{{group_name}}\"\r\n```\r\n\r\n\r\n##### Expected Results:\r\n\r\n> Success: Security created with specified rules\r\n\r\n```\r\n(recsys)rochacbruno@vaioubuntu:~/www/recsys/recsys_env/playbooks$ ansible-playbook staging_0_security_groups.yml -i hosts -vvvv\r\nUsing /home/rochacbruno/www/recsys/recsys_env/playbooks/ansible.cfg as config file\r\nLoaded callback default of type stdout, v2.0\r\n1 plays in staging_0_security_groups.yml\r\n ______\r\n< PLAY >\r\n ------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\n _______________________________\r\n< TASK [Create security groups] >\r\n -------------------------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\ntask path: /home/rochacbruno/www/recsys/recsys_env/playbooks/staging_0_security_groups.yml:10\r\nESTABLISH LOCAL CONNECTION FOR USER: rochacbruno\r\n127.0.0.1 EXEC /bin/sh -c '( umask 22 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1456859824.15-112093465669107 `\" && echo \"` echo $HOME/.ansible/tmp/ansible-tmp-1456859824.15-112093465669107 `\" )'\r\n127.0.0.1 PUT /tmp/tmpSLWSFT TO /home/rochacbruno/.ansible/tmp/ansible-tmp-1456859824.15-112093465669107/ec2_group\r\n127.0.0.1 EXEC /bin/sh -c 'LANG=C LC_ALL=C LC_MESSAGES=C /home/rochacbruno/.virtualenvs/recsys/bin/python /home/rochacbruno/.ansible/tmp/ansible-tmp-1456859824.15-112093465669107/ec2_group; rm -rf \"/home/rochacbruno/.ansible/tmp/ansible-tmp-1456859824.15-112093465669107/\" > /dev/null 2>&1'\r\nchanged: [localhost] => {\"changed\": true, \"group_id\": \"sg-xxxxxxx\", \"invocation\": {\"module_args\": {\"aws_access_key\": \"xxxxxxxxxxx\", \"aws_secret_key\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\", \"description\": \"an example EC2 group\", \"ec2_url\": null, \"name\": \"TEST-ANSIBLE\", \"profile\": null, \"purge_rules\": true, \"purge_rules_egress\": true, \"region\": \"us-east-1\", \"rules\": [{\"cidr_ip\": \"0.0.0.0/0\", \"from_port\": 80, \"proto\": \"tcp\", \"to_port\": 80}], \"rules_egress\": null, \"security_token\": null, \"state\": \"present\", \"validate_certs\": true, \"vpc_id\": \"vpc-xxxxxxxx\"}, \"module_name\": \"ec2_group\"}}\r\n __________________\r\n< TASK [Tag group] >\r\n ------------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\ntask path: /home/rochacbruno/www/recsys/recsys_env/playbooks/staging_0_security_groups.yml:58\r\nESTABLISH LOCAL CONNECTION FOR USER: rochacbruno\r\n127.0.0.1 EXEC /bin/sh -c '( umask 22 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1456859827.42-226866896793854 `\" && echo \"` echo $HOME/.ansible/tmp/ansible-tmp-1456859827.42-226866896793854 `\" )'\r\n127.0.0.1 PUT /tmp/tmpdkifdn TO /home/rochacbruno/.ansible/tmp/ansible-tmp-1456859827.42-226866896793854/ec2_tag\r\n127.0.0.1 EXEC /bin/sh -c 'LANG=C LC_ALL=C LC_MESSAGES=C /home/rochacbruno/.virtualenvs/recsys/bin/python /home/rochacbruno/.ansible/tmp/ansible-tmp-1456859827.42-226866896793854/ec2_tag; rm -rf \"/home/rochacbruno/.ansible/tmp/ansible-tmp-1456859827.42-226866896793854/\" > /dev/null 2>&1'\r\nchanged: [localhost] => {\"changed\": true, \"invocation\": {\"module_args\": {\"aws_access_key\": \"xxxxxxxxxxxxxxxxx\", \"aws_secret_key\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\", \"ec2_url\": null, \"profile\": null, \"region\": \"us-east-1\", \"resource\": \"sg-xxxxxxxxx\", \"security_token\": null, \"state\": \"present\", \"tags\": {\"Name\": \"TEST-ANSIBLE\"}, \"validate_certs\": true}, \"module_name\": \"ec2_tag\"}, \"msg\": \"Tags {'Name': 'TEST-ANSIBLE'} created for resource sg-xxxxxxxx.\"}\r\n ____________\r\n< PLAY RECAP >\r\n ------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\nlocalhost                  : ok=2    changed=2    unreachable=0    failed=0  \r\n```\r\n\r\n##### Actual Results:\r\n\r\n> Error: ```Invalid rule parameter '['```\r\n\r\n\r\n```\r\n(recsys)rochacbruno@vaioubuntu:~/www/recsys/recsys_env/playbooks$ ansible-playbook staging_0_security_groups.yml -i hosts -vvvv\r\nUsing /home/rochacbruno/www/recsys/recsys_env/playbooks/ansible.cfg as config file\r\nLoaded callback default of type stdout, v2.0\r\n _________________________________________\r\n< PLAYBOOK: staging_0_security_groups.yml >\r\n -----------------------------------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\n1 plays in staging_0_security_groups.yml\r\n __________________\r\n< PLAY [localhost] >\r\n ------------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\n _______________________________\r\n< TASK [Create security groups] >\r\n -------------------------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\ntask path: /home/rochacbruno/www/recsys/recsys_env/playbooks/staging_0_security_groups.yml:10\r\nESTABLISH LOCAL CONNECTION FOR USER: rochacbruno\r\n127.0.0.1 EXEC /bin/sh -c '( umask 22 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1456859535.19-86505490953685 `\" && echo \"` echo $HOME/.ansible/tmp/ansible-tmp-1456859535.19-86505490953685 `\" )'\r\n127.0.0.1 PUT /tmp/tmpCGo79f TO /home/rochacbruno/.ansible/tmp/ansible-tmp-1456859535.19-86505490953685/ec2_group\r\n127.0.0.1 EXEC /bin/sh -c 'LANG=C LC_ALL=C LC_MESSAGES=C /home/rochacbruno/.virtualenvs/recsys/bin/python /home/rochacbruno/.ansible/tmp/ansible-tmp-1456859535.19-86505490953685/ec2_group; rm -rf \"/home/rochacbruno/.ansible/tmp/ansible-tmp-1456859535.19-86505490953685/\" > /dev/null 2>&1'\r\nfatal: [localhost]: FAILED! => {\"changed\": false, \"failed\": true, \"invocation\": {\"module_args\": {\"aws_access_key\": \"xxxxxxxxxxxxxxxxxxx\", \"aws_secret_key\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\", \"description\": \"an example EC2 group\", \"ec2_url\": null, \"name\": \"TEST-ANSIBLE\", \"profile\": null, \"purge_rules\": true, \"purge_rules_egress\": true, \"region\": \"us-east-1\", \"rules\": \"[{'to_port': 80, 'from_port': 80, 'cidr_ip': '0.0.0.0/0', 'proto': 'tcp'}]\", \"rules_egress\": null, \"security_token\": null, \"state\": \"present\", \"validate_certs\": true, \"vpc_id\": \"vpc-xxxxxxx\"}, \"module_name\": \"ec2_group\"}, \"msg\": \"Invalid rule parameter '['\"}\r\n ____________________\r\n< NO MORE HOSTS LEFT >\r\n --------------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\n\tto retry, use: --limit @staging_0_security_groups.retry\r\n ____________\r\n< PLAY RECAP >\r\n ------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\nlocalhost                  : ok=0    changed=0    unreachable=0    failed=1   \r\n\r\n```\r\n\r\n\r\n> NOTE: using version from February 3 the bug did not happen\r\n\r\n```\r\ngit clone git://github.com/ansible/ansible.git --recursive\r\ncd ./ansible\r\n\r\n# CHECKOUT VERSION FROM FEBRUARY, 3\r\ngit checkout 699a854bf30784cd7514f4c1b6f8bd742868f7eb\r\ngit submodule update --init --recursive\r\npython setup.py install\r\n\r\nansible --version\r\nansible 2.1.0\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/191693586","html_url":"https://github.com/ansible/ansible-modules-core/issues/3173#issuecomment-191693586","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3173","id":191693586,"user":{"login":"njsaunders","id":1478320,"avatar_url":"https://avatars.githubusercontent.com/u/1478320?v=3","gravatar_id":"","url":"https://api.github.com/users/njsaunders","html_url":"https://github.com/njsaunders","followers_url":"https://api.github.com/users/njsaunders/followers","following_url":"https://api.github.com/users/njsaunders/following{/other_user}","gists_url":"https://api.github.com/users/njsaunders/gists{/gist_id}","starred_url":"https://api.github.com/users/njsaunders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njsaunders/subscriptions","organizations_url":"https://api.github.com/users/njsaunders/orgs","repos_url":"https://api.github.com/users/njsaunders/repos","events_url":"https://api.github.com/users/njsaunders/events{/privacy}","received_events_url":"https://api.github.com/users/njsaunders/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T10:15:58Z","updated_at":"2016-03-03T10:15:58Z","body":"Duplicate of https://github.com/ansible/ansible-modules-core/issues/3109\r\nPR for fix here: https://github.com/ansible/ansible-modules-core/pull/3117"}}