Upgrade to Pro — share decks privately, control downloads, hide ads and more …

20130727 Packerの紹介 (Python Developers Festa 201...

ymotongpoo
August 02, 2013

20130727 Packerの紹介 (Python Developers Festa 2013.07)

introducing packer, mentioning installation, usage and extension.

ymotongpoo

August 02, 2013
Tweet

More Decks by ymotongpoo

Other Decks in Technology

Transcript

  1. 9

  2. 10 Packer is a tool for creating identical machine images

    for multiple platforms from a single source configuration. Platform A Platform B Platform C Machine Image A Machine Image B Machine Image C
  3. ઃఆϑΝΠϧ {      "builders":  [{        

     "type":  "amazon-­‐ebs",          "access_key":  "YOUR  KEY  HERE",          "secret_key":  "YOUR  SECRET  KEY  HERE",          "region":  "us-­‐east-­‐1",          "source_ami":  "ami-­‐de0d9eb7",          "instance_type":  "t1.micro",          "ssh_username":  "ubuntu",          "ami_name":  "packer-­‐example  {{.CreateTime}}"      }],      “provisoners”:  [          “type”:  “shell”,          “scripts”:  [              “initial-­‐install.sh”          ]      ],      “post-­‐prosessors”:  [{          “type”:  “compress”,          “format”:  “tar.gz”      }]   }   21
  4. 1BDLFS1MVHJOT •  packerίϚϯυ͸ඪ४Ͱ΋ϓϥάΠϯΛୟ͍ͯ ͍Δ    25 $  ls  

    packer   packer-­‐builder-­‐amazon-­‐ebs   packer-­‐builder-­‐digitalocean   packer-­‐builder-­‐virtualbox   packer-­‐builder-­‐vmware   packer-­‐command-­‐build   packer-­‐command-­‐fix   packer-­‐command-­‐validate   packer-­‐post-­‐processor-­‐vagrant   packer-­‐provisioner-­‐file   packer-­‐provisioner-­‐shell   શ෦ϓϥάΠϯ
  5. 1BDLFS1MVHJOT •  ֦ுΛ௥Ճͨ͠Β$HOME/.packerconfig  ʹ௥ Ճͷ֦ுΛॻ͍͓ͯ͘   –  ઈରύε  or  ૬ରύε

     or  PATH͕௨͍ͬͯΔͱ͜Ζ   –  ඪ४ίϚϯυ΋ಉܗࣜͰϋʔυίʔυ͞Ε͍ͯΔ   27 {      "builders":  {          "custom-­‐cloud":  "packer-­‐builer-­‐custom-­‐cloud"      },      "commands":  {          "spam":  "packer-­‐command-­‐spam",    "egg":  "packer-­‐command-­‐egg"      }   }  
  6. 1BDLFSશମͷίʔυߏ੒ •  ύοέʔδͩͱҎԼͷͭ •  QBDLFSQBDLFS –  1BDLFSͷίΞɾ֦ு։ൃͷͨΊͷύοέʔδ •  QBDLFSQBDLFSQMVHJO – 

    ϓϥάΠϯ֦ுͷJOUFSGBDFͷఆٛͷΈ 29 github.com/mitchellh/packer/packer     github.com/mitchellh/packer/packer/plugin  
  7. #VJMEFSͷ֦ு 30 Packer Plugins type  Builder  interface  {    

         Prepare(...interface{})  error          Run(ui  Ui,  hook  Hook,  cache  Cache)  (Artifact,  error)          Cancel()   }   •  1SFQBSF ઃఆϑΝΠϧͷಡΈࠐΈͱલॲཧ –  ͍͍ͨͯ͸map[string]interface{}  Ͱ౉͞ΕΔ     •  3VO ϚγϯΠϝʔδͷ࡞੒Λߦ͏ –  Artifact  JOUFSGBDFΛ࣮૷ͨ͠TUSVDUʹϚγϯΠϝʔδʢͷϝλσʔλʣ  •  $BODFM $USMDͳͲ͕ԡ͞Εͨ࣌ͷޙॲཧ
  8. $PNNBOEͷ֦ு 31 Packer Plugins type  Command  interface  {    

         Help()  string          Run(env  Environment,  args  []string)  int          Synopsis()  string   }   •  )FMQ packer  COMMAND  -­‐-­‐helpͰग़ྗ͞ΕΔϝοηʔδ •  3VO ࣮ࡍͷίϚϯυͷ࣮ߦ –  ىಈதͷ1BDLFSͷ΄΅͢΂ͯͷ৘ใΛͱΕΔ •  CVJMEFS 6* $BDIF QPTUQSPDFTTPS QSPWJTJPOFS •  4ZOPQTJT packer  -­‐-­‐helpͰग़ྗ͞ΕΔ୹͍ϝοηʔδ   –  50จࣈఔ౓  
  9. 34 Packer is a tool for creating identical machine images

    for multiple platforms from a single source configuration. Platform A Platform B Platform C Machine Image A Machine Image B Machine Image C
  10. 36