31.3. 부트 로더 RHEL 시스템 역할을 사용하여 부트 로더 메뉴의 시간 초과 설정


부트로더 RHEL 시스템 역할을 사용하여 자동화된 방식으로 GRUB 부트 로더 메뉴의 타임아웃을 구성할 수 있습니다. 일정 시간을 업데이트하여 개입하고 다양한 용도로 기본이 아닌 부팅 항목을 선택할 수 있습니다.

사전 요구 사항

프로세스

  1. 다음 콘텐츠를 사용하여 플레이북 파일(예: ~/playbook.yml )을 생성합니다.

    ---
    - name: Configuration and management of the GRUB boot loader
      hosts: managed-node-01.example.com
      tasks:
        - name: Update the boot loader timeout
          ansible.builtin.include_role:
            name: rhel-system-roles.bootloader
          vars:
            bootloader_timeout: 10

    예제 플레이북에 지정된 설정은 다음과 같습니다.

    bootloader_timeout: 10
    기본 항목을 부팅하기 전에 GRUB 부트 로더 메뉴가 표시되는 기간을 제어하는 정수를 입력합니다.

    플레이북에 사용되는 모든 변수에 대한 자세한 내용은 제어 노드의 /usr/share/ansible/roles/rhel-system-roles.bootloader/README.md 파일을 참조하십시오.

  2. 플레이북 구문을 확인합니다.

    $ ansible-playbook --syntax-check ~/playbook.yml

    이 명령은 구문만 검증하고 잘못되었지만 유효한 구성으로부터 보호하지 않습니다.

  3. Playbook을 실행합니다.

    $ ansible-playbook ~/playbook.yml

검증

  1. 관리 노드를 원격으로 다시 시작합니다.

    # ansible managed-node-01.example.com -m ansible.builtin.reboot
    managed-node-01.example.com | CHANGED => {
        "changed": true,
        "elapsed": 21,
        "rebooted": true
    }
  2. 관리 노드에서 GRUB 부팅 메뉴 화면을 확인합니다.

    GRUB2 부트 로더 메뉴 시간 초과
    강조 표시된 항목은 10s에서 자동으로 실행됩니다.

    GRUB 이전에 이 부팅 메뉴가 표시되는 기간 동안 기본 항목이 자동으로 사용됩니다.

    • 대체: 관리 노드의 /boot/grub2/grub.cfg 파일에서 "timeout" 설정에 대해 원격으로 쿼리할 수 있습니다.

      # ansible managed-node-01.example.com -m ansible.builtin.command -a "grep 'timeout' /boot/grub2/grub.cfg"
      managed-node-01.example.com | CHANGED | rc=0 >>
      if [ x$feature_timeout_style = xy ] ; then
        set timeout_style=menu
        set timeout=10
      # Fallback normal timeout code in case the timeout_style feature is
        set timeout=10
      if [ x$feature_timeout_style = xy ] ; then
          set timeout_style=menu
          set timeout=10
          set orig_timeout_style=${timeout_style}
          set orig_timeout=${timeout}
            # timeout_style=menu + timeout=0 avoids the countdown code keypress check
            set timeout_style=menu
            set timeout=10
            set timeout_style=hidden
            set timeout=10
      if [ x$feature_timeout_style = xy ]; then
        if [ "${menu_show_once_timeout}" ]; then
          set timeout_style=menu
          set timeout=10
          unset menu_show_once_timeout
          save_env menu_show_once_timeout

추가 리소스

  • /usr/share/ansible/roles/rhel-system-roles.bootloader/README.md file
  • /usr/share/doc/rhel-system-roles/bootloader/ directory
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.