Skip to content

Instantly share code, notes, and snippets.

Created February 7, 2016 07:10
What would you like to do?
Phoenixアプリサーバーのプロビジョニング - ansible/roles/app/tasks/main.yml
- name: Download package
command: aws s3 cp "{{ package_url }}" /tmp/app.tar.gz
AWS_ACCESS_KEY_ID: "{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
- name: Make app directory
file: state=directory path={{ item }}
- "{{ app_home }}"
- "{{ app_home }}/log"
- name: Install app
unarchive: src=/tmp/app.tar.gz dest={{ app_home }}
- name: Put app config
template: src=app.conf dest={{ app_home }}/
- name: Ensure app directory belongs to ubuntu
file: "state=directory path={{ app_home }} owner=ubuntu group=ubuntu recurse=true"
- name: Symlink log directory
file: src={{ app_home }}/log path=/var/log/example_app state=link
- name: Put upstart config
template: src=example_app.conf dest=/etc/init/
- name: Start and enable services
service: name={{ item }} state=started enabled=yes
- example_app
- nginx
- name: Wait for app to start
wait_for: port={{ app_port }} delay=10
- name: Ensure app is running
url: http://localhost:{{ app_port }}/api/public/version
status_code: 200
timeout: 600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment