Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

bigip_virtual_server Module

ANSIBLE VERSION

ansible 2.5.0
config file = None
configured module search path = [u'/home/asavinykh/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]

CONFIGURATION

Default

OS / ENVIRONMENT

Control machine: ubuntu linux 16.04LTS

Managed node: BIG-IP 12.1.2 Build 1.0.271 Hotfix HF1

SUMMARY

When creating a virtual server I would like to configure both Client and Server protocol profiles, which are different profiles as shown on the picture:

It is currently impossible to achieve it with the ansible module. This enumeration is used to specify if the profile client or server. But the ansible module always passes PROFILE_CONTEXT_TYPE_ALL as can be seen here, here and here. As a result if you try to pass both client and server profiles you get a error.

STEPS TO REPRODUCE

Run a playbook that has the following yaml fragment:

- name: Add virtual server
bigip_virtual_server:
server: "{{ f5_server }}"
password: "{{ f5_password }}"
user: "{{ f5_user }}"
validate_certs: "no"
state: "{{ f5_state }}"
partition: WWW
name: "{{ item.name }}"
destination: "{{ item.ip }}"
port: 80
pool: "{{ item.pool }}"
all_profiles:
- /Common/Default_WAN_optimized_TCP_Profile
- /Common/Default_LAN_optimized_TCP_Profile
- /Common/Insert_X-Forward_http_profile
- /Common/Default_OneConnect_Profile
- /Common/Default_wan-optimized-compression_profile
default_persistence_profile: /Common/Default_cookie_persistence_profile
fallback_persistence_profile: /Common/Default_source-addr-persistence_profile
delegate_to: localhost
with_items: "{{ servers }}"

Note that both Default_WAN_optimized_TCP_Profile and Default_LAN_optimized_TCP_Profile are TCP protocol profiles.

EXPECTED RESULTS

There should be a way for ansible module to tell apart client and server profile. Ideally profile_context should be part of the module options.

ACTUAL RESULTS

A error is produced:

failed: [xxx.xxx.xxx.xxx -> localhost] (item={u'ip': u'xxx.xxx.xxx.xxx', u'name': u'www.website.com_HTTP_VS_as', u'pool': u'www.website.com_HTTP_pool_as'}) => {"changed": false, "item": {"ip": "xxx.xxx.xxx.xxx", "name": "www.website.com_HTTP_VS_as", "pool": "www.website.com_HTTP_pool_as"}, "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 : 17236119 (0x01070097)\n\tsecondary_error_code : 0\n\terror_string : 01070097:3: Virtual server /WWW/www.website.com_HTTP_VS_as lists duplicate profiles.'"}

Issue 2:
I am using ansible 2.3.0.0 running it within an docker-container

root@880299e5edbc:/# ansible --version
ansible 2.3.0.0
config file =
configured module search path = Default w/o overrides
python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]`

The following task works. Ansible writes the line "hello... " to the /tmp/list of the delegated hosts.

- name: my-task
action: shell echo "hello I am on the delegate host" >> /tmp/list
delegate_to: "{{ item }}"
with_items: "{{ hosts }}"

When writing the same task using loop_vars it doesn't work. Ansible seems not to be able to connect to the delegated hosts, writing "Name or service not known" to the console.

- name: my-task
action: shell echo "hello I am on the delegate host" >> /tmp/list
delegate_to: "{{ myVar }}"
with_items: "{{ hosts }}"
loop_control:
loop_var: myVar