Skip to content

Help in an attempt to create a state #65602

Answered by bogdanr
OutofIdeas12345 asked this question in Q&A
Discussion options

You must be logged in to vote

Something like this should do what you need

install_windows_updates:
  module.run:
    - name: win_update.install
    - categories:
      - Security Updates
      - Critical Updates
    - download: True
    - install: True
    - reboot: True  # Set to False if you do not want the system to reboot automatically

# Optional: Schedule the updates to run at a specific time
schedule_windows_updates:
  schedule.present:
    - function: state.apply
    - job_args:
      - windows_updates
    - minutes: 1440  # Run daily (1440 minutes in a day)
    - splay: 600     # Randomize the run time by up to 10 minutes (600 seconds)
    - persist: True
    - run_on_start: True  # Run the job when the minio…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nicholasmhughes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants