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_host_ntp does not configure NTP servers on ESXi hosts #1987

Open
perkons opened this issue Jan 29, 2024 · 0 comments
Open

vmware_host_ntp does not configure NTP servers on ESXi hosts #1987

perkons opened this issue Jan 29, 2024 · 0 comments

Comments

@perkons
Copy link

perkons commented Jan 29, 2024

SUMMARY

When running the task "Configure NTP servers for an ESXi Host" it does mostly not configure the NTP servers on the ESXi host. Sometimes it does work, sometimes not. When running on multiple hosts on some it does change the servers, on some not. It is unpredictable. It shows changed. It shows the correct defined ntp servers "ntp_servers", the changes "ntp_servers_changed" and "ntp_servers_previous".

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.vmware.vmware_host_ntp

ANSIBLE VERSION
ansible [core 2.15.5]
  config file = /home/user/.ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.ansible-python-venv/lib/python3.11/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user/.ansible-python-venv/bin/ansible
  python version = 3.11.5 (main, Aug 24 2023, 12:23:19) [GCC 12.3.0] (/home/user/.ansible-python-venv/bin/python)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
$ ansible-galaxy collection list community.vmware

# /home/user/.ansible-python-venv/lib/python3.11/site-packages/ansible_collections
Collection       Version
---------------- -------
community.vmware 3.10.0 

# /home/user/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.vmware 4.1.0  
$ ansible-config dump | grep COLLECTIONS_PATHS
COLLECTIONS_PATHS(default) = ['/home/user/.ansible/collections', '/usr/share/ansible/collections']
$ 
CONFIGURATION
CONFIG_FILE() = /home/user/.ansible.cfg
DEFAULT_HASH_BEHAVIOUR(/home/user/.ansible.cfg) = merge
DEFAULT_HOST_LIST(/home/user/.ansible.cfg) = ['/home/user/git/ansible/library/netbox/netbox.py']
DEFAULT_VAULT_PASSWORD_FILE(/home/user/.ansible.cfg) = /home/user/.ansible_vault.txt
EDITOR(env: EDITOR) = vim
HOST_KEY_CHECKING(/home/user/.ansible.cfg) = True
PAGER(env: PAGER) = less
RETRY_FILES_ENABLED(/home/user/.ansible.cfg) = False
OS / ENVIRONMENT
  • VMware ESXi, 7.0.3, 20842708

  • VMware ESXi, 8.0.2, 22380479

STEPS TO REPRODUCE

Create a playbook ntp_esxi.yml with the content:

---
- hosts: "localhost"
  gather_facts: false
 
  tasks:
    - community.vmware.vmware_host_ntp: &module_settings
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        validate_certs: "{{ vcenter_validate_certs }}"
        esxi_hostname: "esxi1.domain.name"
        ntp_servers: 
          - 0.de.pool.ntp.org
          - 1.de.pool.ntp.org
          - 2.de.pool.ntp.org
          - 3.de.pool.ntp.org
      delegate_to: localhost

    - debug: var=_module_output
 
    - community.vmware.vmware_host_ntp:
        <<: *module_settings

    - debug: var=_module_output

and run

ansible-playbook ntp_esxi.yml
EXPECTED RESULTS

NTP servers set on the ESXi host

ACTUAL RESULTS

NTP server changes not done most of the times on the ESXi host

$ ansible-playbook ntp_esxi.yml

PLAY [localhost] **************************************************************************************************************

TASK [community.vmware.vmware_host_ntp] ***************************************************************************************
changed: [localhost]

TASK [debug] ******************************************************************************************************************
ok: [localhost] => {
    "_module_output": {
        "changed": true,
        "failed": false,
        "host_ntp_status": {
            "esxi1.domain.name": {
                "changed": true,
                "ntp_servers": [
                    "0.de.pool.ntp.org",
                    "1.de.pool.ntp.org",
                    "2.de.pool.ntp.org",
                    "3.de.pool.ntp.org"
                ],
                "ntp_servers_changed": [
                    "3.de.pool.ntp.org"
                ],
                "ntp_servers_previous": [
                    "0.de.pool.ntp.org",
                    "1.de.pool.ntp.org",
                    "2.de.pool.ntp.org"
                ]
            }
        }
    }
}

TASK [community.vmware.vmware_host_ntp] ***************************************************************************************
changed: [localhost]

TASK [debug] ******************************************************************************************************************
ok: [localhost] => {
    "_module_output": {
        "changed": true,
        "failed": false,
        "host_ntp_status": {
            "esxi1.domain.name": {
                "changed": true,
                "ntp_servers": [
                    "0.de.pool.ntp.org",
                    "1.de.pool.ntp.org",
                    "2.de.pool.ntp.org",
                    "3.de.pool.ntp.org"
                ],
                "ntp_servers_changed": [
                    "3.de.pool.ntp.org"
                ],
                "ntp_servers_previous": [
                    "0.de.pool.ntp.org",
                    "1.de.pool.ntp.org",
                    "2.de.pool.ntp.org"
                ]
            }
        }
    }
}

PLAY RECAP ********************************************************************************************************************
localhost                  : ok=4    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

$

as you can see it does run the change 2 times but it should have changed it in the first run.

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