LoginSignup
4
5

More than 5 years have passed since last update.

ansibleで引っかかったこと

Last updated at Posted at 2016-01-17

備忘録。

bitbucketのprivate repoからcloneできない

前提として以下が必要(httpからcloneしててハマってたので忘れないように書いておく)

  • bitbucketに公開鍵が登録してあること
  • git@bitbucket.org」から始まるURLでcloneすること

(1) taskで以下のようにaccept_hostkeyを加える

- name: clone repo
  git: repo=git@bitbucket.org:celeron1ghz/mogemoge.git dest="/home/agile/mogemoge" accept_hostkey=true

(2) ansible.cfg に以下を追記

[ssh_connection]
ssh_args = -o ForwardAgent=yes

上記の二つの設定で、ansibleを実行しているhostの秘密鍵を使ってgit cloneをしてくれるようになる。
これでprivate repoからcloneはできるようになった。

SSL証明書を入れたnginxの再起動が失敗する

参考:http://qiita.com/kadoppe/items/b17bf60337ebb18f00e8

- name: run nginx
  service: name=nginx state=restarted
  sudo: yes 

こんな感じでnginxを再起動しようとするとエラーで止まる。

これは、証明書にパスワードをつけていると再起動時にパスワードで認証できずにnginxの起動が失敗しているので、単純にパスワードをなくせば良い。

$ cp cert.key cert.key.org
$ openssl rsa -in cert.key.org -out cert.key

このkeyファイルでサーバの証明書ファイルを上書きして解決。

これでplaybookを一発流せばアプリケーションが新しくなるようになった!

4
5
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
4
5