Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmware_vmkernel: incorrectly handles idempotence for Repl and Repl_NFC services #362

Closed
mmcgilly opened this issue Aug 25, 2020 · 3 comments · Fixed by #364
Closed

vmware_vmkernel: incorrectly handles idempotence for Repl and Repl_NFC services #362

mmcgilly opened this issue Aug 25, 2020 · 3 comments · Fixed by #364
Labels
affects_2.10 bug This issue/PR relates to a bug module module needs_triage Needs a first human triage before being processed. python3

Comments

@mmcgilly
Copy link
Contributor


name: 🐛 Bug report
about: Create a report to help us improve

SUMMARY

vmware_vmkernel incorrectly handles Repl and Repl_NFC services

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Module: vmware_vmkernel

ANSIBLE VERSION
ansible 2.9.1
  config file = None
  configured module search path = ['/ansible/playbooks/library']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.5 (default, Oct 17 2019, 12:25:15) [GCC 8.3.0]
CONFIGURATION
DEFAULT_MODULE_PATH(env: ANSIBLE_LIBRARY) = ['/ansible/playbooks/library']
DEFAULT_MODULE_UTILS_PATH(env: ANSIBLE_MODULE_UTILS) = ['/ansible/playbooks/library/module_utils']
OS / ENVIRONMENT

VMware vCenter 6.7
ESXi 6.7

STEPS TO REPRODUCE

Playbook that enables replication and replication_nfc.
Run playbook and it will configure VMK correctly.
Running again will also show changed even when services are correctly configured,

- name: Make VMK port with Replication services enabled
    vmware_vmkernel:
      hostname: "{{ vcenter_server }}"
      username: "{{ vc_service_account }}"
      password: "{{ vc_service_account_password }}"
      esxi_hostname: "{{ inventory_hostname }}"
      validate_certs: False
      dvswitch_name: "{{ dvs_name }}"
      portgroup_name: "{{ replication_pg  }}"
      network:
        type: 'static'
        ip_address: "{{ vmk_rep_ip }}"
        subnet_mask: "{{ vmk_rep_subnetmask }}"
      enable_replication: True
      enable_replication_nfc: True
      mtu: 9000
      state: present
    delegate_to: localhost
EXPECTED RESULTS

When Repl and Repl_NFC services are enabled the playbook is idempotent.

ACTUAL RESULTS

Even execution of the playbook shows changed for VMkernel Adapter services would be updated

TASK [esxi-makevmk : Make VMK port with Replication services enabled] *********************************************************************
changed: [esxi-host.company.com -> localhost] => {"changed": true, "device": "vmk5", "ipv4": "static", "ipv4_gw": "No override", "ipv4_ip": "192.168.8.17", "ipv4_sm": "255.255.255.0", "msg": "VMkernel Adapter services would be updated", "mtu": 9000, "portgroup": "replication_pg", "services": "Repl, Repl_NFC", "services_previous": "Repl, Repl_NFC", "switch": "dvswitch", "tcpip_stack": "default"}

@ansibullbot
Copy link

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@ansibullbot ansibullbot added affects_2.10 bug This issue/PR relates to a bug module module needs_triage Needs a first human triage before being processed. python3 labels Aug 25, 2020
@mmcgilly
Copy link
Contributor Author

Issue appears to be with the following code block

if (self.enable_replication and self.vnic.device not in service_type_vmks['vSphereReplication']) or \
                    (not **self.enable_provisioning** and self.vnic.device in service_type_vmks['vSphereReplication']):
                changed_services = changed_service_rep = True

            if (self.enable_replication_nfc and self.vnic.device not in service_type_vmks['vSphereReplicationNFC']) or \
                    (not **self.enable_provisioning** and self.vnic.device in service_type_vmks['vSphereReplicationNFC']):
                changed_services = changed_service_rep_nfc = True

Should be

if (self.enable_replication and self.vnic.device not in service_type_vmks['vSphereReplication']) or \
                    (not self.enable_replication and self.vnic.device in service_type_vmks['vSphereReplication']):
                changed_services = changed_service_rep = True

            if (self.enable_replication_nfc and self.vnic.device not in service_type_vmks['vSphereReplicationNFC']) or \
                    (not self.enable_replication_nfc and self.vnic.device in service_type_vmks['vSphereReplicationNFC']):
                changed_services = changed_service_rep_nfc = True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.10 bug This issue/PR relates to a bug module module needs_triage Needs a first human triage before being processed. python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants