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

Task invoking 'ucs_service_profile_association' module wrongly returns 'ok' in check mode when the service profile does not exist #120

Open
ecantin opened this issue Oct 10, 2019 · 0 comments

Comments

@ecantin
Copy link

ecantin commented Oct 10, 2019

SUMMARY

It is expected that a task returns 'ok' when there is nothing to do.
With state 'present', 'ucs_service_profile_association' module unexpectedly returns 'changed: true' + 'failed: false', displayed as 'ok' instead of 'changed' by ansible-playbook in several initial condition cases, including the 2 main ones:

  1. Check mode + existing server, not associated, and to be associated to an inexisting target service profile: 'ok' instead of 'changed'.
  2. Check mode + existing server, associated to a service profile different of the inexisting target service profile: 'ok' instead of 'changed'.
  3. Run mode + existing server, associated to a service profile different of the inexisting target service profile: 'ok' instead of 'failed'.
ISSUE TYPE
  • Bug Report
COMPONENT NAME

ucs_service_profile_association

ANSIBLE VERSION
$ ansible --version
ansible 2.7.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, May  3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
CONFIGURATION
ucs_service_profile_association.py: extracted from GitHub on 2018-12-18.

$ ansible-config dump --only-changed | cat
DEFAULT_ASK_VAULT_PASS(/home/ansible/.tmp/hw/ansible.cfg) = True
DEFAULT_HOST_LIST(/home/ansible/.tmp/hw/ansible.cfg) = [u'/home/ansible/.tmp/hw/inventory']
DEFAULT_LOG_PATH(/home/ansible/.tmp/hw/ansible.cfg) = /home/ansible/log/ansible.log
DEFAULT_ROLES_PATH(/home/ansible/.tmp/hw/ansible.cfg) = [u'/home/ansible/.tmp/hw/roles', u'/home/ansible/.tmp/hw/roles/community']
DEFAULT_STDOUT_CALLBACK(/home/ansible/.tmp/hw/ansible.cfg) = yaml
PERSISTENT_COMMAND_TIMEOUT(/home/ansible/.tmp/hw/ansible.cfg) = 60
OS / ENVIRONMENT

$ uname -a; cat /etc/redhat-release
Linux cnode01 3.10.0-693.21.1.el7.x86_64 #1 SMP Fri Feb 23 18:54:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux Server release 7.4 (Maipo)

STEPS TO REPRODUCE

Execute a playbook with a task invoking 'ucs_service_profile_association' module with 'present' state, with one of the following initial condition:

  1. Check mode + existing server, not associated, and to be associated to an inexisting service profile;
  2. Check mode + existing server, associated to a service profile different of the target service profile specified in the playbook;
  3. Run mode + existing server, associated to a service profile different of the inexisting target service profile.
- name: UCS / Tasks using XML API
  hosts: ucs
  gather_facts: no
  vars:
    ansible_connection: local
    login: &login
      hostname: "{{ ansible_host }}"
      username: "{{ ucsUsername }}"
      password: "{{ ucsPassword }}"
    ucsOrg: "ORG99"
    ucsOrgDn: "org-root/org-{{ ucsOrg }}"
    ucsSptName: "SPT99"
    ucsSptDn: "{{ ucsOrgDn }}/ls-{{ ucsSptName }}"
    ucsSpName: "SP99"
    ucsAssociatedServer: "sys/rack-unit-01"

    - name: "Organization / SP association '{{ ucsOrgDn }}/ls-{{ ucsSpName }}' <=> '{{ ucsAssociatedServer }}'"
      ucs_service_profile_association:
        org_dn: "{{ ucsOrgDn }}"
        service_profile_name: "{{ ucsSpName }}"
        server_dn: "{{ ucsAssociatedServer }}"
        server_assignment: server
        state: present
        <<: *login
EXPECTED RESULTS
  1. 'changed' is displayed.
  2. 'changed' is displayed.
  3. 'failed' is displayed.
ACTUAL RESULTS
  1. 'ok' is displayed.
  2. 'ok' is displayed.
  3. 'ok' is displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant