5
3

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-containerで登場する概念的なやつの個人的メモ

Posted at

これは何?

ansible-containerの技術メモです。

ansible-container
https://github.com/ansible/ansible-container

概念

  • conductorコンテナ
  • ansibleホストの役割含む
  • container.ymlのベースイメージをもとにする
  • 対象となるコンテナはこのコンテナのファイルシステム内にマウントされる
  • 対象となるコンテナ
  • python不要

コマンド

  • ansible-container init

  • 実行ディレクトリ名がPJ名になる

  • 下記が作られる

    • container.yml
      * 核となるymlで、基本的にこれを編集する
      * docker-compose.ymlと似た役割
    • ansible.cfg
      * conductorでコマンドを実行する際の設定
    • requirements.yml
    • ansible-requirements.txt
      * この二つにはリポジトリから取得する必要のあるモジュールや、実際にansible-containerを実行する際に必要なモジュールを記載する
    • meta.yml
      * メタ情報を記載する。ansible galaxyで使われると思われる
  • ansible-container build

    • container.ymlに基づいてビルド
  • ansible-container run

    • container.ymlに基づいてコンテナを起動
  • ansible-container stop

  • ansible-container restart

  • ansible-container destroy

  • ansible-container deploy

container.yml

  • from : ベースとするコンテナイメージでconductorも作業対象コンテナもこれがベースとなる
  • volume : マウントするボリュームの設定。docker run -vだと思う
  • ports : 開放するポートの設定。docker run -pだと思う
  • command : DockerfileのCMDだと思う
  • depends_on : 依存相手のコンテナを明示する
  • roles : roleを適用。もちろん複数も可
  • environment : DockerfileのENVだと思う
  • expose : docker run –exposeだと思う

参考にさせていただいたもの

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?