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

add timesync_ntp_custom_settings variable for free-form local configs #54

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jontow
Copy link

@jontow jontow commented Oct 11, 2019

Found this small addition useful in my local installation, thought it might be helpful to others.

@mlichvar
Copy link
Collaborator

The role used to have some variables for adding settings directly to the generated config files, but IIRC they were removed in order to hide the implementation-specific details.

Later was added a variable for selecting the NTP provider, so it may no longer be a goal.

@mcaubet
Copy link

mcaubet commented Aug 12, 2020

I would agree with this change, in fact I was checking how would be possible to add extra options in chrony.conf which should apply a similar change to the one proposed here. We rely on some customized settings and with the current templates we are not able to deploy them. I will create a new merge request for chrony based on this pull request (for keeping coherency in case that this is merged).

@richm
Copy link
Collaborator

richm commented Aug 12, 2020

[citest commit:ab66e75457880e7184a2d7b27d428f566ca7c40e]

tests/tests_ntp.yml Outdated Show resolved Hide resolved
@@ -11,6 +11,8 @@
iburst: yes
minpoll: 4
maxpoll: 6
timesync_ntp_custom_settings:
- "tinker panic 0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test should check if this setting was applied correctly

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to check this specific setting by inspecting runtime state, the closest I can come up with is looking for this line in the generated config file. Is that enough, or are you thinking something more?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to check this specific setting by inspecting runtime state, the closest I can come up with is looking for this line in the generated config file. Is that enough, or are you thinking something more?

I'll defer to @mlichvar about that - but IMO it is better to check the generated config file than to do nothing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a possibility to do that with ntpq, but it would need authentication to be set up. I think it's better to check the generated file.

@richm
Copy link
Collaborator

richm commented Aug 12, 2020

@mlichvar @pcahyna This seems like a good feature - do we have a best practices for specifying provider specific settings?

# List of custom settings passed through to ntp.conf. If not defined,
# setting is ignored. Settings should be one per line (list item).
timesync_ntp_custom_settings:
- "tinker panic 0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How idempotent is this? For example, if the user specifies

timesync_ntp_custom_settings:
  - "tinker panic 0"
  - "a b c"

then sometime later specifies

timesync_ntp_custom_settings:
  - "a    b    c"
  - "tinker panic 0"

Will that generate a change? Does it matter if that generates a change? For example, that will cause the ntp services to restart - is that ok?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to allow the user to perform incremental changes? For example, if the configuration already has

timesync_ntp_custom_settings:
  - "tinker panic 0"
  - "a b c"

and the user wants to remove "a b c" - how to do that? Or the user wants to remove "a b c" and add "b c a"? For the kernel_settings role we had a similar requirement, so we documented it - https://linux-system-roles.github.io/documentation/incremental_settings.html

@richm
Copy link
Collaborator

richm commented Aug 12, 2020

[citest]

@mlichvar
Copy link
Collaborator

I'm not aware of any best practices for injecting configuration snippets like this. I think it would be good to warn the users that there are no guarantees a working config will not stop working with a newer version of the role if the template is changed for instance. We don't want to make any assumption about what is injected in the config.

@richm
Copy link
Collaborator

richm commented Aug 14, 2020

[citest bad]

@richm
Copy link
Collaborator

richm commented May 4, 2021

[citest pending]

@richm
Copy link
Collaborator

richm commented May 4, 2021

[citest bad]

@richm
Copy link
Collaborator

richm commented May 4, 2021

[citest pending]

@richm
Copy link
Collaborator

richm commented Jun 10, 2021

I'll note that #80 did this for chrony settings and that PR includes a test to verify the custom settings - something similar should be done for the custom ntp settings

@richm
Copy link
Collaborator

richm commented Jun 14, 2021

[citest pending]

@richm
Copy link
Collaborator

richm commented Jul 6, 2021

[citest bad]

@richm
Copy link
Collaborator

richm commented Jul 13, 2021

[citest pending]

@richm
Copy link
Collaborator

richm commented Oct 4, 2021

please rebase to latest master branch

@richm
Copy link
Collaborator

richm commented Oct 11, 2021

[citest pending]

1 similar comment
@richm
Copy link
Collaborator

richm commented Oct 11, 2021

[citest pending]

@richm
Copy link
Collaborator

richm commented Oct 18, 2021

@jontow please rebase on top of latest master branch

@richm
Copy link
Collaborator

richm commented Oct 20, 2021

[citest pending]

@richm
Copy link
Collaborator

richm commented Nov 8, 2021

@jontow please rebase on top of latest master branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants