{"action":"created","issue":{"url":"https://api.github.com/repos/F5Networks/f5-ansible/issues/44","repository_url":"https://api.github.com/repos/F5Networks/f5-ansible","labels_url":"https://api.github.com/repos/F5Networks/f5-ansible/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/F5Networks/f5-ansible/issues/44/comments","events_url":"https://api.github.com/repos/F5Networks/f5-ansible/issues/44/events","html_url":"https://github.com/F5Networks/f5-ansible/issues/44","id":183149491,"number":44,"title":"bigip_virtual_server fails on subsequent runs based on sort order of iRule list","user":{"login":"dbeckham","id":250375,"avatar_url":"https://avatars.githubusercontent.com/u/250375?v=3","gravatar_id":"","url":"https://api.github.com/users/dbeckham","html_url":"https://github.com/dbeckham","followers_url":"https://api.github.com/users/dbeckham/followers","following_url":"https://api.github.com/users/dbeckham/following{/other_user}","gists_url":"https://api.github.com/users/dbeckham/gists{/gist_id}","starred_url":"https://api.github.com/users/dbeckham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbeckham/subscriptions","organizations_url":"https://api.github.com/users/dbeckham/orgs","repos_url":"https://api.github.com/users/dbeckham/repos","events_url":"https://api.github.com/users/dbeckham/events{/privacy}","received_events_url":"https://api.github.com/users/dbeckham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-14T21:01:50Z","updated_at":"2016-10-14T21:33:20Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nbigip_virtual_server\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.2.0\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### PYTHON VERSION\r\n```\r\nPython 2.7.12\r\n```\r\n\r\n##### F5 BIGIP LTM VERSION\r\n```\r\nSys::Version\r\nMain Package\r\n  Product     BIG-IP\r\n  Version     12.1.1\r\n  Build       0.0.184\r\n  Edition     Final\r\n  Date        Thu Aug 11 17:09:01 PDT 2016\r\n```\r\n\r\n##### CONFIGURATION\r\n```\r\nretry_files_enabled = False\r\nhost_key_checking=False\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\nAlpine 3.4 (Docker Container)\r\n\r\n##### SUMMARY\r\nThe sort order of irules in the `bigip_virtual_server` module can cause the task to fail if the first rule in the list has a lower alphanumeric sort order than the rules that follow it.\r\n\r\n*NOTE: this only happens on subsequent runs; the virtual server is always successfully created on first run.*\r\n\r\nThe error message received:\r\n```\r\nreceived exception: Error on updating Virtual Server : Server raised fault: 'Exception caught in System::urn:iControl:System/Session::submit_transaction()\r\nException: Common::OperationFailed\r\n    primary_error_code   : 16908390 (0x01020066)\r\n    secondary_error_code : 0\r\n    error_string         : 01020066:3: The requested virtual server rule (/Common/myvip /Common/myirule) already exists in partition Common.'\r\n```\r\n\r\n##### STEPS TO REPRODUCE\r\n\r\nCreate three iRules named `zrule`, `myrule`, and `myrule2`. I used the following TCL code in my tests:\r\n```\r\nwhen HTTP_REQUEST {\r\n    HTTP::respond 200 content \"OK\"\r\n}\r\n```\r\n\r\nCreate a task that uses the `bigip_virtual_server` module with the following configuration parameters:\r\n\r\n```\r\n- name: Add virtual server\r\nbigip_virtual_server:\r\n  state: present\r\n  name: myvip\r\n  destination: \"1.1.1.1\"\r\n  port: 80\r\n  pool: mypool\r\n  snat: Automap\r\n  all_profiles:\r\n    - http\r\n    - tcp\r\n  all_rules:\r\n    - myirule\r\n    - myirule2\r\n  password: \"{{ bigip_password }}\"\r\n  server: \"{{ inventory_hostname }}\"\r\n  user: \"{{ bigip_username }}\"\r\n  validate_certs: \"{{ validate_certs }}\"\r\n```\r\n\r\nRun this task once to create the virtual server, and then a second time to verify that there are no errors.\r\n\r\nChange the `all_rules` option to include the `zrule` iRule at the top of the list:\r\n```\r\nall_rules:\r\n  - zrule\r\n  - myrule\r\n  - myrule2\r\n```\r\n\r\nRun the task again, at which point it will fail.\r\n\r\nIf you remove the `zrule` iRule, the task will once again run successfully. The task will also run successfully if you put the `zrule` iRule at the end of the list.\r\n\r\n##### EXPECTED RESULTS\r\nThe sort order of iRules should not cause the `bigip_virtual_server` module to fail.\r\n\r\n##### ACTUAL RESULTS\r\n\r\nThe iRule is successfully created, but fails on every run after that:\r\n\r\n##### Successful Creation\r\n\r\n```\r\nUsing module file /playbooks/library/bigip_virtual_server.py\r\n<lbl11.example.com> ESTABLISH LOCAL CONNECTION FOR USER: root\r\n<lbl11.example.com> EXEC /bin/sh -c '/usr/bin/python && sleep 0'\r\nok: [lbl11.example.com] => {\r\n    \"changed\": false,\r\n    \"invocation\": {\r\n        \"module_args\": {\r\n            \"all_profiles\": [\r\n                \"http\",\r\n                \"tcp\"\r\n            ],\r\n            \"all_rules\": [\r\n                \"myirule\",\r\n                \"myirule2\"\r\n            ],\r\n            \"default_persistence_profile\": null,\r\n            \"description\": null,\r\n            \"destination\": \"1.1.1.1\",\r\n            \"enabled_vlans\": null,\r\n            \"name\": \"myvip\",\r\n            \"partition\": \"Common\",\r\n            \"password\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\",\r\n            \"pool\": \"mypool\",\r\n            \"port\": 80,\r\n            \"route_advertisement_state\": \"disabled\",\r\n            \"server\": \"lbl11.example.com\",\r\n            \"server_port\": 443,\r\n            \"snat\": \"Automap\",\r\n            \"state\": \"present\",\r\n            \"user\": \"ansible\",\r\n            \"validate_certs\": false\r\n        },\r\n        \"module_name\": \"bigip_virtual_server\"\r\n    }\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\nlbl11.example.com     : ok=2    changed=0    unreachable=0    failed=0\r\n```\r\n\r\n##### Second Run that fails:\r\n\r\n```\r\nUsing module file /playbooks/library/bigip_virtual_server.py\r\n<lbl11.example.com> ESTABLISH LOCAL CONNECTION FOR USER: root\r\n<lbl11.example.com> EXEC /bin/sh -c '/usr/bin/python && sleep 0'\r\nfatal: [lbl11.example.com]: FAILED! => {\r\n    \"changed\": false,\r\n    \"failed\": true,\r\n    \"invocation\": {\r\n        \"module_args\": {\r\n            \"all_profiles\": [\r\n                \"http\",\r\n                \"tcp\"\r\n            ],\r\n            \"all_rules\": [\r\n                \"zrule\",\r\n                \"myirule\",\r\n                \"myirule2\"\r\n            ],\r\n            \"default_persistence_profile\": null,\r\n            \"description\": null,\r\n            \"destination\": \"1.1.1.1\",\r\n            \"enabled_vlans\": null,\r\n            \"name\": \"myvip\",\r\n            \"partition\": \"Common\",\r\n            \"password\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\",\r\n            \"pool\": \"mypool\",\r\n            \"port\": 80,\r\n            \"route_advertisement_state\": \"disabled\",\r\n            \"server\": \"lbl11.example.com\",\r\n            \"server_port\": 443,\r\n            \"snat\": \"Automap\",\r\n            \"state\": \"present\",\r\n            \"user\": \"ansible\",\r\n            \"validate_certs\": false\r\n        },\r\n        \"module_name\": \"bigip_virtual_server\"\r\n    },\r\n    \"msg\": \"received exception: Error on updating Virtual Server : Server raised fault: 'Exception caught in System::urn:iControl:System/Session::submit_transaction()\\nException: Common::OperationFailed\\n\\tprimary_error_code   : 16908390 (0x01020066)\\n\\tsecondary_error_code : 0\\n\\terror_string         : 01020066:3: The requested virtual server rule (/Common/myvip /Common/myirule) already exists in partition Common.'\"\r\n}\r\n        to retry, use: --limit @/playbooks/bigip_testing.retry\r\n\r\nPLAY RECAP *********************************************************************\r\nlbl11.example.com     : ok=1    changed=0    unreachable=0    failed=1\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/F5Networks/f5-ansible/issues/comments/253925013","html_url":"https://github.com/F5Networks/f5-ansible/issues/44#issuecomment-253925013","issue_url":"https://api.github.com/repos/F5Networks/f5-ansible/issues/44","id":253925013,"user":{"login":"caphrim007","id":46956,"avatar_url":"https://avatars.githubusercontent.com/u/46956?v=3","gravatar_id":"","url":"https://api.github.com/users/caphrim007","html_url":"https://github.com/caphrim007","followers_url":"https://api.github.com/users/caphrim007/followers","following_url":"https://api.github.com/users/caphrim007/following{/other_user}","gists_url":"https://api.github.com/users/caphrim007/gists{/gist_id}","starred_url":"https://api.github.com/users/caphrim007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caphrim007/subscriptions","organizations_url":"https://api.github.com/users/caphrim007/orgs","repos_url":"https://api.github.com/users/caphrim007/repos","events_url":"https://api.github.com/users/caphrim007/events{/privacy}","received_events_url":"https://api.github.com/users/caphrim007/received_events","type":"User","site_admin":false},"created_at":"2016-10-14T21:33:20Z","updated_at":"2016-10-14T21:33:20Z","body":"Long story short, you wan5 the order you list them in in yaml to be the order they're listed in the bigip. Right?"}}
{"actor":{"display_login":"caphrim007"}}