Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Latest commit

 

History

History

ansible

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ISUCON用 ansible

必要

  • Ansible
    • initを実行するためには、community.general.git_configcommunity.general.github_deploy_keyprometheus.prometheus.node_exporterのモジュールが必要。ansible-galaxy collection install community.generalansible-galaxy collection install prometheus.prometheusでインストールできる。
  • Python3系
    • Ansibleを動かすのに必要。

使い方

競技用のリポジトリを用意する

source ./bin/init.sh {ディレクトリ名} {サーバーの数}

で必要なディレクトリ構成ができる。

.
├── Makefile
├── s1
│   └── etc
│       ├── mysql
│       │   └── .gitkeep
│       ├── nginx
│       │   └── .gitkeep
│       └── systemd
│           └── system
│               └── .gitkeep
├── s2
│   └── etc
│       ├── mysql
│       │   └── .gitkeep
│       ├── nginx
│       │   └── .gitkeep
│       └── systemd
│           └── system
│               └── .gitkeep
└── s3
    └── etc
        ├── mysql
        │   └── .gitkeep
        ├── nginx
        │   └── .gitkeep
        └── systemd
            └── system
                └── .gitkeep

GitHubに上げておく。

vaultのパスワードを配置する

./vault.txtを置き、パスワードを書く。

変数を設定する

通常

vault

ansible-vault edit group_vars/all/vault.yml

実行

初期化

  • ツールのインストール
  • Gitの設定
  • GitHubリポジトリのセットアップ(コミット・プッシュはしない)
ansible-playbook 0_init.yml

デプロイ

  • git pull
  • DB、nginx、アプリの再起動
  • ログローテーション

デフォルトブランチ

ansible-playbook 1_deploy.yml

ブランチを指定

ansible-playbook 1_deploy.yml -e "deploy_branch={ブランチ名}"