community.network.ce_ntp – Manages core NTP configuration on HUAWEI CloudEngine switches.
Note
This plugin is part of the community.network collection (version 3.0.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.network
.
To use it in a playbook, specify: community.network.ce_ntp
.
Parameters
Parameter |
Comments |
---|---|
Makes given NTP server or peer the preferred NTP server or peer for the device. Choices:
|
|
Authentication key identifier to use with given NTP server or peer. |
|
Network address of NTP peer. |
|
Network address of NTP server. |
|
Local source interface from which NTP messages are sent. Must be fully qualified interface name, i.e. |
|
Manage the state of the resource. Choices:
|
|
Makes the device communicate with the given NTP server or peer over a specific vpn. Default: “_public_” |
Notes
Note
This module requires the netconf system service be enabled on the remote device being managed.
Recommended connection is
netconf
.This module also works with
local
connections for legacy playbooks.
Examples
- name: NTP test
hosts: cloudengine
connection: local
gather_facts: no
vars:
cli:
host: "{{ inventory_hostname }}"
port: "{{ ansible_ssh_port }}"
username: "{{ username }}"
password: "{{ password }}"
transport: cli
tasks:
- name: "Set NTP Server with parameters"
community.network.ce_ntp:
server: 192.8.2.6
vpn_name: js
source_int: vlanif4001
is_preferred: enable
key_id: 32
provider: "{{ cli }}"
- name: "Set NTP Peer with parameters"
community.network.ce_ntp:
peer: 192.8.2.6
vpn_name: js
source_int: vlanif4001
is_preferred: enable
key_id: 32
provider: "{{ cli }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
check to see if a change was made on the device Returned: always Sample: true |
|
k/v pairs of ntp info after module execution Returned: always Sample: {“is_preferred”: “enable”, “key_id”: “48”, “server”: “2.2.2.2”, “source_int”: “vlanif4002”, “vpn_name”: “js”} |
|
k/v pairs of existing ntp server/peer Returned: always Sample: {“is_preferred”: “disable”, “key_id”: “32”, “server”: “2.2.2.2”, “source_int”: “vlanif4002”, “vpn_name”: “js”} |
|
k/v pairs of parameters passed into module Returned: always Sample: {“is_preferred”: “enable”, “key_id”: “48”, “server”: “2.2.2.2”, “source_int”: “vlanif4002”, “state”: “present”, “vpn_name”: “js”} |
|
command sent to the device Returned: always Sample: [“ntp server 2.2.2.2 authentication-keyid 48 source-interface vlanif4002 vpn-instance js preferred”] |
Authors
Zhijin Zhou (@QijunPan)