0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ansibleのget_urlでCRF++とcabochaのtarballを取得する

Last updated at Posted at 2020-01-04

動作したコード

task/main.yml
- name: Download CRF++ from google drive
  get_url:
    url: "https://drive.google.com/uc?export=download&id={{ crf_file_id }}"
    dest: "{{ project_path }}/server/lib/CRF++-0.58.tar.gz"
    mode: u=r,g=r,o=r
- name: Download Cabocha from google drive
  get_url:
    url: "https://drive.google.com/uc?export=download&confirm=ABCD&id={{ cabocha_file_id }}"
    dest: "{{ project_path }}/server/lib/cabocha-0.69.tar.bz2"
    headers: "Cookie:'download_warning_16768239309833604394_0B4y35FiV1wh7SDd1Q1dUQkZQaUU=ABCD;'"
    mode: u=r,g=r,o=r
  # 以下のコードでも動作する
  # shell: |
    # curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id={{ cabocha_file_id }}" > /dev/null
    # CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
    # curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id={{ cabocha_file_id }}" -o "{{ project_path }}/server/lib/cabocha-0.69.tar.bz2"

vars.yml
project_path: /srv/http/myapp
crf_file_id: 0B4y35FiV1wh7QVR6VXJ5dWExSTQ
cabocha_file_id: 0B4y35FiV1wh7SDd1Q1dUQkZQaUU

怪しい箇所

cabochaのcookieのkey名がこれであっているのか怪しい

ファイルNumber_ファイルID => 16768239309833604394_0B4y35FiV1wh7SDd1Q1dUQkZQaUU
という命名規則に見えるが、このkeyの命名が保証されていないのでいつ壊れるのかわからない...

value自体はランダムに設定されているようでしたが、手元で指定してしまってもエラーにはならなかったのでABCDと適当な文字列を入れています(大きな問題はないはず)

※ cabochaのtarballを配布するミラーリングサイト他にないのかなぁ

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?