F5Networks / f5-ansible-bigip

Declarative Ansible collection for managing F5 BIG-IP/BIG-IQ.
37 stars 17 forks source link

bigip_do_deploy - the dryRun Controls property doesn't seem to return any extra details #54

Closed rnotley closed 1 year ago

rnotley commented 1 year ago
COMPONENT NAME

bigip_do_deploy

Environment

ANSIBLE VERSION
ansible [core 2.14.1]
  config file = None
  configured module search path = ['/home/rnot/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/rnot/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/rnot/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/rnot/.local/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
BIGIP VERSION
Sys::Version
Main Package
  Product     BIG-IP
  Version     15.1.7
  Build       0.0.6
  Edition     Final
  Date        Thu Jul 28 01:41:23 PDT 2022
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

I would like to send a DO configuration with dryRun set to true to determine if the DO configuration would cause any changes or not.

STEPS TO REPRODUCE

Example from here:

{
    "schemaVersion": "1.23.0",
    "class": "Device",
    "async": true,
    "label": "my BIG-IP declaration for declarative onboarding",
    "controls": {
        "trace": true,
        "traceResponse": true,
        "dryRun": true
    },
    "Common": {
        "class": "Tenant",
        "mySystem": {
            "class": "System",
            "hostname": "bigip.example.com",
            "cliInactivityTimeout": 1200,
            "consoleInactivityTimeout": 1200,
            "autoPhonehome": false
        }
    }
}

Ansible tasks:

- name: Deploy DO configuration
  f5networks.f5_bigip.bigip_do_deploy:
    content: "{{ lookup('ansible.builtin.template', 'do.json.j2', template_vars=do_config | default({})) }}"
  register: f5bigip_do_task
  tags: f5bigip

- name: Get DO task status
  f5networks.f5_bigip.bigip_do_deploy:
    task_id: "{{ f5bigip_do_task.task_id }}"
  register: f5bigip_do_details
  tags: f5bigip
EXPECTED RESULTS

When dryRun is set to true (the default is false) BIG-IP Declarative Onboarding sends the declaration through all validation checks but does not attempt to deploy the configuration on the target device. The response contains information on what would have been deployed (a diff between the existing configuration and what the declaration would deploy). This can be useful for testing and debugging declarations.

ACTUAL RESULTS

Results seem to be the same whether or not dryRun is true or false.

wojtek0806 commented 1 year ago

Can you clarify what are you trying to get ansible to return? Is it everything under: "traces": { "desired": vs "traces": { "current": {

rnotley commented 1 year ago

@wojtek0806 Ideally, I would want the dryRun task result to include a boolean true/false if the DO deploy would change any configuration. So probably just "traces": { "diff" is enough, but I don't know how accurate that content is. If it's not accurate, then having both "desired" and "current" and then doing the diff myself in ansible, but that sounds like a lot of work.

wojtek0806 commented 1 year ago

@rnotley added the option to devel, check the tomorrow's build, this will go live in next version release which will be 2.0.0

rnotley commented 1 year ago

Thank you, I tested this and it works great.