노드 선언에서 할 일은 include 함수로 base 모듈을 참조하는 일이 전부입니다. 모듈별로 작성한 기능을 노드 선언에서 참조하는 형태로 구현함으로써 코드를 효율적으로 유지 보수할 수 있습니다.

    # /home/administrator/code/environments/production/manifests/site.pp
    # 노드 선언
    node 'vm01.linuxmastery.kr' {
      include base
    }
    
    node 'vm02.linuxmastery.kr' {
      include base
    }
    
    node default {
      notify { 'default_message':
        message => "===== default =====\n",
      }
    }

    퍼팻 에이전트가 실행 중인 가상 게스트로 돌아가 정상적으로 동작하는지 테스트합니다. base::include, base::vim 클래스를 거쳐 base 클래스에 작성했던 코드가 실행되는 것을 확인할 수 있습니다. vim 명령을 실행해서 vim이 정상적으로 설치되었는지 확인합니다.

    administrator@vm01:~$ sudo /opt/puppetlabs/bin/puppet agent --test
    Info: Using configured environment 'production'
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    Info: Retrieving locales
    Info: Loading facts
    Info: Caching catalog for vm01.linuxmastery.kr
    Info: Applying configuration version '1581090135'
    Notice: ===== base::install =====
    Notice: /Stage[main]/Base::Install/Notify[===== base::install =====]/message: defined 'message' as '===== base::install ====='
    Notice: ===== base::vim =====
    Notice: /Stage[main]/Base::Vim/Notify[===== base::vim =====]/message: defined 'message' as '===== base::vim ====='
    Notice: ===== base =====
    Notice: /Stage[main]/Base/Notify[===== base =====]/message: defined 'message' as '===== base ====='
    Notice: Applied catalog in 0.37 seconds
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.