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

implement a detect_virt grain #387

Merged
merged 1 commit into from
Jul 17, 2024
Merged

implement a detect_virt grain #387

merged 1 commit into from
Jul 17, 2024

Commits on Jul 17, 2024

  1. implement a detect_virt grain

    This is useful for things we may not want or be able to run when operating in a docker container.
    
    Specific example is systemd-timesyncd, which refuses to start in a container:
    
    ```
    [Unit]
    Description=Network Time Synchronization
    Documentation=man:systemd-timesyncd.service(8)
    ConditionCapability=CAP_SYS_TIME
    ConditionVirtualization=!container
    DefaultDependencies=no
    ...
    ```
    
    Note the `ConditionVirtualization` blocking.
    
    Useful state might be something like:
    
    ```
    systemd-timesyncd:
      pkg:
        - installed
      service:
        - enable: True
        {% if grains["detect_virt"] not in ["docker"] %}
        - running
        {% endif %}
    ```
    
    Which would _enable_ the service but not fail when it fails to start.
    ewdurbin committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    23cc831 View commit details
    Browse the repository at this point in the history