Posted at

AnsibleでMongodbをインストール

More than 5 years have passed since last update.

ついでにzshもインストールしてます。


- hosts: all
user: ubuntu
vars:
tasks:
- name: zsh install
command: sudo apt-get install zsh
- name: mongo install 1
command: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
- name: mongo install 2
shell:
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
- name: update
command: sudo apt-get update
- name: mongo install 3
command: sudo apt-get install mongodb-org=2.6.4 mongodb-org-server=2.6.4 mongodb-org-shell=2.6.4 mongodb-org-mongos=2.6.4 mongodb-org-tools=2.6.4
- name: mongo install 4
shell: echo "{{ item }} hold" | sudo dpkg --set-selections
with_items:
- mongodb-org
- mongodb-org-server
- mongodb-org-shell
- mongodb-org-mongos
- mongodb-org-tools

name: mongo install 3の箇所が非常に長くて動作してるか不安であったがうまくいった。以下、成功した出力。


ubuntu@aws1:~/aws$ ansible-playbook server_setup_ubuntu14.04.yml

PLAY [all] ********************************************************************

GATHERING FACTS ***************************************************************
ok: [ubuntu@aws6]
ok: [ubuntu@aws3]
ok: [ubuntu@aws5]
ok: [ubuntu@aws2]
ok: [ubuntu@aws4]

TASK: [zsh install] ***********************************************************
changed: [ubuntu@aws4]
changed: [ubuntu@aws2]
changed: [ubuntu@aws3]
changed: [ubuntu@aws5]
changed: [ubuntu@aws6]

TASK: [mongo install 1] *******************************************************
changed: [ubuntu@aws2]
changed: [ubuntu@aws3]
changed: [ubuntu@aws4]
changed: [ubuntu@aws5]
changed: [ubuntu@aws6]

TASK: [mongo install 2] *******************************************************
changed: [ubuntu@aws2]
changed: [ubuntu@aws3]
changed: [ubuntu@aws6]
changed: [ubuntu@aws4]
changed: [ubuntu@aws5]

TASK: [update] ****************************************************************
changed: [ubuntu@aws2]
changed: [ubuntu@aws3]
changed: [ubuntu@aws6]
changed: [ubuntu@aws4]
changed: [ubuntu@aws5]

TASK: [mongo install 3] *******************************************************
changed: [ubuntu@aws2]
changed: [ubuntu@aws6]
changed: [ubuntu@aws5]
changed: [ubuntu@aws3]
changed: [ubuntu@aws4]

TASK: [mongo install 4] *******************************************************
changed: [ubuntu@aws4] => (item=mongodb-org)
changed: [ubuntu@aws3] => (item=mongodb-org)
changed: [ubuntu@aws2] => (item=mongodb-org)
changed: [ubuntu@aws2] => (item=mongodb-org-server)
changed: [ubuntu@aws5] => (item=mongodb-org)
changed: [ubuntu@aws6] => (item=mongodb-org)
changed: [ubuntu@aws4] => (item=mongodb-org-server)
changed: [ubuntu@aws3] => (item=mongodb-org-server)
changed: [ubuntu@aws6] => (item=mongodb-org-server)
changed: [ubuntu@aws5] => (item=mongodb-org-server)
changed: [ubuntu@aws3] => (item=mongodb-org-shell)
changed: [ubuntu@aws2] => (item=mongodb-org-shell)
changed: [ubuntu@aws6] => (item=mongodb-org-shell)
changed: [ubuntu@aws4] => (item=mongodb-org-shell)
changed: [ubuntu@aws6] => (item=mongodb-org-mongos)
changed: [ubuntu@aws3] => (item=mongodb-org-mongos)
changed: [ubuntu@aws4] => (item=mongodb-org-mongos)
changed: [ubuntu@aws5] => (item=mongodb-org-shell)
changed: [ubuntu@aws2] => (item=mongodb-org-mongos)
changed: [ubuntu@aws6] => (item=mongodb-org-tools)
changed: [ubuntu@aws3] => (item=mongodb-org-tools)
changed: [ubuntu@aws4] => (item=mongodb-org-tools)
changed: [ubuntu@aws5] => (item=mongodb-org-mongos)


ssh-rsa hogehogehogehgoehgoeogehoegheogheogheohoegheogheogheogheog: [ubuntu@aws2] => (item=mongodb-org-tools)
changed: [ubuntu@aws5] => (item=mongodb-org-tools)

PLAY RECAP ********************************************************************
ubuntu@aws2 : ok=7 changed=6 unreachable=0 failed=0
ubuntu@aws3 : ok=7 changed=6 unreachable=0 failed=0
ubuntu@aws4 : ok=7 changed=6 unreachable=0 failed=0
ubuntu@aws5 : ok=7 changed=6 unreachable=0 failed=0
ubuntu@aws6 : ok=7 changed=6 unreachable=0 failed=0


aws1からaws2-6(5台)に対して実行したのだが、先にも述べたように非常に時間がかかった。早くする方法か、進行状況を確認する方法を模索中