ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Puppet을 이용한 배포
    기타 2014. 8. 1. 09:00
    반응형
    puppet을 통한 배포 프로세스

    단일머신에서 puppet apply를 통한 배포
    현재 머신에서 지정된 manifest를 이용해서 puppet을 실행.

    master/agent 구조의 배포
    puppet agent가 서비스 형태로 실행되거나 cron으로 실행되고 있는 상태.
    에이전트가 직접 매니페스트 파일을 가져와서 컴파일후 실행하는 것이 아니라, 마스터에서 컴파일된 catalog를 가져와서 실행함.
    (catalog는 puppet manifest가 컴파일된 문서.)

    Puppet 컴파일 구조.




    Puppet Master/agent 구조





    로컬머신에서 puppet을 이용해서 설정하기 테스트
    puppet apply manifest파일
    ex) puppet apply test.pp
    test.pp 파일 내용
        file {'testfile':
          path    => '/tmp/testfile',
          ensure  => present,
          mode    => 0640,
          content => "I'm a test file.",
        }


    파일이 생성된 것 확인
    ll -h /tmp/testfile


    마스터/에이전트 테스트


    [마스터에서 하는 부분]

    배포에 필요한 디렉토리 구조 생성.
    mkdir -p /etc/puppet/environments/production/manifests
    mkdir -p /etc/puppet/environments/production/modules

    다음 파일 생성
    vi /etc/puppet/environments/production/manifests/site.pp

    파일내용
    node 'puppet-node01.example.com' {
      file {'testfile':
          path    => '/tmp/testfile',
          ensure  => present,
          mode    => 0640,
          content => "I'm a test file.",
        }
    }


    [에이전트에서 하는 부분]
    sudo puppet agent —test

    에이전트에 파일이 생성된것 확인
    ll -h /tmp/testfile



    puppet을 이용해서 postgresql 설치해보기

    [마스터에서 하는 부분]
    puppet forge에서 미리 정의되어 있는 postgresql 모듈 다운로드
    puppet module install puppetlabs-postgresql --version 3.4.1  -i /etc/puppet/modules/

    아래 파일 편집
    vi /etc/puppet/environments/production/manifests/postgres.pp

    파일내용
    node 'puppet-node01.example.com' {
    class { 'postgresql::server':
      ip_mask_deny_postgres_user => '0.0.0.0/32',
      ip_mask_allow_all_users    => '0.0.0.0/0',
      listen_addresses           => '*',
      ipv4acls                   => ['hostssl all johndoe 192.168.0.0/24 cert'],
      manage_firewall            => true,
      postgres_password          => 'TPSrep0rt!',
    }
    }


    [에이전트에서 하는 부분]
    에이전트의 /etc/puppet/puppet.conf파일의 [main]영역에 다음 옵션 추가
    pluginsync=true 

    에이전트 실행
    sudo puppet agent —test

    postgresql에 접속해서 설치됐는지 확인
    psql -h localhost -U postgres


    참고 


    반응형

    '기타' 카테고리의 다른 글

    chef cookbook 구조  (0) 2015.03.26
    Ansible 설치 & 기본사용하기  (0) 2014.08.29
    Puppet 설치 및 실행  (0) 2014.07.31
    vagrant 설치 및 실행  (0) 2014.07.24
    Chef Cookbook을 node에 지정해서 node에서 cookbook을 실행하기  (0) 2014.04.14

    댓글

Designed by Tistory.