ansibleã¯ã©ãããtemplateãæ¢ãã®ãï¼
ãã j2 ãä»ãå¿ãã¦ã¯ãtemplateãè¦ã¤ãããªãï¼ãã¨è¨ããã¾ãã
ã©ãããtemplate fileãæ¢ãã¦ããã®ãï¼ã¨èª¿ã¹ã¦ã¿ããã©ããããä¸ã«ãã¾ãè½ã¡ã¦ãªãã®ã§ã¡ã¢ã
ãããªæ§æã® Playbook ã ã¨ãã¦
play_dir âââ hosts âââ roles â  âââ foo â  âââ defaults â  â  âââ main.yml â  âââ tasks â  â  âââ main.yml â  âââ templates â  âââ bar.conf.j2 âââ site.yml âââ templates âââ bar.conf.j2
foo role ã®ä¸ã§ template ãé ç½®ãã task ãããã¨ãã
- template: src: bar.conf.j2 dest: /path/to/bar.conf
# Play $ ansible --version ansible 2.4.3.0 $ cd play_dir $ ansible-playbook -i hosts site.yml
ã¨ã©ã¼ã¡ãã»ã¼ã¸ã« search path ãè¼ã£ã¦ããã®ã ãã©ããã®å ´åã¯ä»¥ä¸ããæ¢ãã¦ããã
play_dir/roles/foo/templates/bar.conf.j2 play_dir/roles/foo/bar.conf.j2 play_dir/roles/foo/tasks/templates/bar.conf.j2 play_dir/roles/foo>/tasks/bar.conf.j2 play_dir/templates/bar.conf.j2 play_dir/bar.conf.j2
ãªããDocument ã«ã®ããææ¡ã¯ããã¦ããã®ã§ãå ¬å¼åãå¾ ã¤ã®ããããã github.com
Ansible 2.3.0 + Ansible Galaxy ã§ãã¡ã¤ã«åã®ä¸é¨ãæ¶ãã
role åã 'nginx' ã ã¨ãã¦ãtemplates/nginx.conf ã¨ãããã¡ã¤ã«ããã£ãå ´åã templates/.conf ã¨ãããã¡ã¤ã«åã«ãªã£ã¦ãã¾ãã github.com
ansible 2.3.1 以éã§ä¿®æ£ããã¦ããã®ã ãã©ãã¡ããã©ãã®ãã¼ã¸ã§ã³ã使ã£ã¦ã¦ã¯ã¾ã£ãã
Kibana 5.X 㧠visualize çµæãã elasticsearch query ãåå¾ããã
kibana ã® visualize æ©è½ã§éè¨ã°ã©ããä½æã§ãããã©ãããã Elasticsearch ããç´æ¥åå¾ãããã Query ã«ç´ããªãããããªããã ãã©ããããã«æã§ããã®ã¯é¢åã ãâ¦
Visualize ç»é¢ä¸é¨ã®ç¢å°ãæ¼ãã¨ãspy mode ã«ãªãã
- Table (æ¤ç´¢çµæã® Table view)
- Request Body
- Response Body
- Statistics (ã¯ã¨ãªã®ã¬ã¹ãã³ã¹ã¿ã¤ã ãªã©)
ãããã表示ã§ããã®ã§ãRequest Body ãè¦ãã°ããã
æ¸ãçµãã£ãå¾ã«æ°ã¥ãããï¼ï¼
åºå ¸: github.com
Ruby 2.4 㧠CGI.unescape ãé«éåããã¦ãã
ä¹ ãã¶ãã« ruby ããããæ©ä¼ããã£ãã®ã§ãåå¿çã«ã
URL encode ãããæååã decode ãããã®ã ãã©ãRuby 2.1 ã® URI.decode
ã ã¨é
ãããï¼
ã¨ããã®ããªãã¨ã解決ã§ããªããã¨èª¿ã¹ã¦ãã¾ããã
ãã³ããã¼ã¯ã³ã¼ã
ä¼¼ããããªãã¨ããã£ã¦ãããã¡ã½ãããè¤æ°ãã£ãã®ã§ãã¨ãããããã³ãã¨ã£ã¦ã¿ãã
require 'benchmark' require 'uri' require 'cgi' encoded = '%7B%22hoge%22%3A%7B%22foo%22%3A%22bar%22%2C%22hoo%22%3A%22baz%22%7D%7D' # => {"hoge":{"foo":"bar","hoo":"baz"}} def manytimes 100000.times { yield } if block_given? end Benchmark.bmbm do |bm| bm.report("URI.decode") { manytimes { URI.decode encoded } } bm.report("URI.decode_www_form_component") { manytimes { URI.decode_www_form_component encoded } } bm.report("CGI.unescape") { manytimes { CGI.unescape encoded } } end
Ruby 2.1
$ ruby --version ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin15.0] $ ruby decode_bench.rb Rehearsal ----------------------------------------------------------------- URI.decode 2.360000 0.020000 2.380000 ( 2.404751) URI.decode_www_form_component 1.270000 0.010000 1.280000 ( 1.467851) CGI.unescape 1.480000 0.020000 1.500000 ( 1.578028) -------------------------------------------------------- total: 5.160000sec user system total real URI.decode 2.570000 0.030000 2.600000 ( 2.729236) URI.decode_www_form_component 1.170000 0.010000 1.180000 ( 1.189314) CGI.unescape 1.510000 0.010000 1.520000 ( 1.577981)
é ãã obsolete ã ããURI.decode ã¯ããã¦ãããæ¹ãããããã ã singleton method URI.decode (Ruby 2.4.0)
URI.decode_www_form_component
ã使ãã®ãããã®ããªï¼
Ruby 2.4
試ãã« Ruby 2.4 ã§ãã³ãã¨ã£ã¦ã¿ãããæãã¬çµæã«ãªã£ãã
$ ruby --version ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15] $ ruby decode_bench.rb Rehearsal ----------------------------------------------------------------- URI.decode 2.290000 0.010000 2.300000 ( 2.334818) URI.decode_www_form_component 1.280000 0.020000 1.300000 ( 1.330829) CGI.unescape 0.120000 0.000000 0.120000 ( 0.133207) -------------------------------------------------------- total: 3.720000sec user system total real URI.decode 2.560000 0.030000 2.590000 ( 2.859363) URI.decode_www_form_component 1.270000 0.010000 1.280000 ( 1.329829) CGI.unescape 0.120000 0.000000 0.120000 ( 0.127875)
CGI.unescape
ã10å以ä¸éããªã£ã¦ããã
Ruby 2.4 ãã CGI ã¢ã¸ã¥ã¼ã«ã®ããã¤ãã®ã¡ã½ããã Cæ¡å¼µã¨ãã¦å®è£ ããããããã
escape/unescape, escapeHTML/unescapeHTML 辺ãã対象ããªï¼
ruby/escape.c at trunk · ruby/ruby · GitHub
ã¨ããããã§
URL decode ãããæ㯠Ruby 2.4 ã«ã㦠CGI.unescape
ã使ãã¨éããï¼ã¨ãããã¨ã§ããã
ããæ¥ããä»æ¥ã¾ã§ã®æ¯é±æ¥æã®æ¥ä»ãåºããã
ã²ãã³ããªã®ã«å°ãã¿ã
ãã¾ã«ä½¿ããã©ãæ¯åå¿ãã¦ã¯èª¿ã¹ã¦ãã®ã§æ¸ãã¦ããã
Python 2.x ã§ä½¿ãæ㯠print ã®ã¨ãããæ¸ãç´ãã¨ããã
$ python --version Python 3.6.0 $ pip list | grep python-dateutil python-dateutil 2.6.0 $ python sunday_list.py 20161226 20170101 20170108 20170115 20170122 20170129 20170205 20170212 20170219 20170226 20170305 20170312 20170319 20170326 20170402 20170409
è¿æ³
æè¿ã¯ qiita ã«æ¸ãã¦ã¿ã¦ãã¾ã
markdown 使ããã®ã§ã¯ãã©ã