diff options
author | Milo Casagrande <milo@ubuntu.com> | 2014-03-27 10:00:46 +0100 |
---|---|---|
committer | Milo Casagrande <milo@ubuntu.com> | 2014-03-27 10:00:46 +0100 |
commit | 7e99b70f0526b89ee7642cf7e4d000db58b80a6c (patch) | |
tree | 876f95da1e946ea1b810b15ca35855c139d37628 | |
parent | d729a950ce28f684850bde51609ed180a2462f6a (diff) |
Completed ansible playbook.
* We now have a usable ansible playbook.
* Corrected filename, server file permission.
-rw-r--r-- | ansible/group_vars/all | 9 | ||||
-rw-r--r-- | ansible/hosts | 1 | ||||
-rw-r--r-- | ansible/roles/common/README (renamed from ansible/common/README) | 0 | ||||
-rw-r--r-- | ansible/roles/common/files/sysctl.conf (renamed from ansible/common/files/sysctl.conf) | 0 | ||||
-rw-r--r-- | ansible/roles/common/handlers/main.yml (renamed from ansible/common/handlers/main.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/handlers/reload-apache.yml (renamed from ansible/common/handlers/reload-apache.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/handlers/restart-apache.yml (renamed from ansible/common/handlers/restart-apache.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/handlers/started-apache.yml (renamed from ansible/common/handlers/started-apache.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/handlers/stop-apache.yml (renamed from ansible/common/handlers/stop-apache.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/tasks/host-nickname.yml (renamed from ansible/common/tasks/host-nickname.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/tasks/main.yml (renamed from ansible/common/tasks/main.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/tasks/net-sysctl.yml (renamed from ansible/common/tasks/net-sysctl.yml) | 0 | ||||
-rw-r--r-- | ansible/roles/common/templates/base-bashrc (renamed from ansible/common/templates/base-bashrc) | 0 | ||||
-rw-r--r-- | ansible/roles/common/templates/host-nickname.sh (renamed from ansible/common/templates/host-nickname.sh) | 0 | ||||
-rw-r--r-- | ansible/roles/install-app/tasks/main.yml | 27 | ||||
-rw-r--r-- | ansible/roles/install-deps/tasks/install-mongodb.yml (renamed from ansible/roles/install-mongo/tasks/main.yml) | 5 | ||||
-rw-r--r-- | ansible/roles/install-deps/tasks/main.yml (renamed from ansible/roles/install-deps-os/tasks/main.yml) | 15 | ||||
-rw-r--r-- | ansible/roles/upstart-conf/handlers/main.yml | 13 | ||||
-rw-r--r-- | ansible/roles/upstart-conf/tasks/main.yml | 8 | ||||
-rw-r--r-- | ansible/roles/upstart-conf/templates/kernel-ci-backend.conf | 16 | ||||
-rw-r--r-- | ansible/site.yml | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | app/server.py | 1 | ||||
-rw-r--r-- | requirements.txt (renamed from reuirements.txt) | 0 |
23 files changed, 88 insertions, 13 deletions
diff --git a/ansible/group_vars/all b/ansible/group_vars/all index c60ac6e..123bdd2 100644 --- a/ansible/group_vars/all +++ b/ansible/group_vars/all @@ -1,4 +1,9 @@ ansible_ssh_user: ubuntu -checkout_dir: /home/{{ ansible_ssh_user }} +checkout_dir: /home/ubuntu install_base: /srv -hostname: kernel-ci.backend.linaro.org +nickname: kernel-ci-backend +upstart_service: kernel-ci-backend +hostname: backend.kernel-ci.linaro.org +apache_user: www-data +app_user: www-data +git_head: HEAD diff --git a/ansible/hosts b/ansible/hosts index a4a29bb..31fe70d 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -1 +1,2 @@ [all] +backend.kernel-ci.linaro.org diff --git a/ansible/common/README b/ansible/roles/common/README index 07a0b26..07a0b26 100644 --- a/ansible/common/README +++ b/ansible/roles/common/README diff --git a/ansible/common/files/sysctl.conf b/ansible/roles/common/files/sysctl.conf index c9ee851..c9ee851 100644 --- a/ansible/common/files/sysctl.conf +++ b/ansible/roles/common/files/sysctl.conf diff --git a/ansible/common/handlers/main.yml b/ansible/roles/common/handlers/main.yml index 9862b0a..9862b0a 100644 --- a/ansible/common/handlers/main.yml +++ b/ansible/roles/common/handlers/main.yml diff --git a/ansible/common/handlers/reload-apache.yml b/ansible/roles/common/handlers/reload-apache.yml index 630dcb2..630dcb2 100644 --- a/ansible/common/handlers/reload-apache.yml +++ b/ansible/roles/common/handlers/reload-apache.yml diff --git a/ansible/common/handlers/restart-apache.yml b/ansible/roles/common/handlers/restart-apache.yml index 34acdc4..34acdc4 100644 --- a/ansible/common/handlers/restart-apache.yml +++ b/ansible/roles/common/handlers/restart-apache.yml diff --git a/ansible/common/handlers/started-apache.yml b/ansible/roles/common/handlers/started-apache.yml index f45ee21..f45ee21 100644 --- a/ansible/common/handlers/started-apache.yml +++ b/ansible/roles/common/handlers/started-apache.yml diff --git a/ansible/common/handlers/stop-apache.yml b/ansible/roles/common/handlers/stop-apache.yml index 6bf18e8..6bf18e8 100644 --- a/ansible/common/handlers/stop-apache.yml +++ b/ansible/roles/common/handlers/stop-apache.yml diff --git a/ansible/common/tasks/host-nickname.yml b/ansible/roles/common/tasks/host-nickname.yml index b9f676c..b9f676c 100644 --- a/ansible/common/tasks/host-nickname.yml +++ b/ansible/roles/common/tasks/host-nickname.yml diff --git a/ansible/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index 9049e2a..9049e2a 100644 --- a/ansible/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml diff --git a/ansible/common/tasks/net-sysctl.yml b/ansible/roles/common/tasks/net-sysctl.yml index eb84890..eb84890 100644 --- a/ansible/common/tasks/net-sysctl.yml +++ b/ansible/roles/common/tasks/net-sysctl.yml diff --git a/ansible/common/templates/base-bashrc b/ansible/roles/common/templates/base-bashrc index de88aa8..de88aa8 100644 --- a/ansible/common/templates/base-bashrc +++ b/ansible/roles/common/templates/base-bashrc diff --git a/ansible/common/templates/host-nickname.sh b/ansible/roles/common/templates/host-nickname.sh index bf6177e..bf6177e 100644 --- a/ansible/common/templates/host-nickname.sh +++ b/ansible/roles/common/templates/host-nickname.sh diff --git a/ansible/roles/install-app/tasks/main.yml b/ansible/roles/install-app/tasks/main.yml new file mode 100644 index 0000000..55eeb9a --- /dev/null +++ b/ansible/roles/install-app/tasks/main.yml @@ -0,0 +1,27 @@ +--- + +- name: Checkout kernel-ci-backend code + git: repo=http://git.linaro.org/git/infrastructure/kernel-ci-backend.git + dest={{ install_base }}/{{ hostname }} + version={{ git_head }} + update=yes + notify: restart-kernel-ci-backend + tags: + - install + - app + +- name: Fix cloned repo permissions + file: path={{ install_base }}/{{ hostname }} + state=directory + recurse=yes + owner={{ app_user }} + group={{ app_user }} + tags: + - install + - app + +- name: Install pip requirements + pip: requirements={{ install_base }}/{{ hostname }}/requirements.txt + tags: + - install + - app diff --git a/ansible/roles/install-mongo/tasks/main.yml b/ansible/roles/install-deps/tasks/install-mongodb.yml index 49dac52..fd805c3 100644 --- a/ansible/roles/install-mongo/tasks/main.yml +++ b/ansible/roles/install-deps/tasks/install-mongodb.yml @@ -6,6 +6,7 @@ url=hkp://keyserver.ubuntu.com:80 tags: - install + - mongodb - name: Add MongoDB repository apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' @@ -13,9 +14,11 @@ update_cache=yes tags: - install + - mongodb - name: Install MongoDB apt: name=mongodb-10gen state=latest tags: - - install
\ No newline at end of file + - install + - mongodb diff --git a/ansible/roles/install-deps-os/tasks/main.yml b/ansible/roles/install-deps/tasks/main.yml index d6141be..0da16b5 100644 --- a/ansible/roles/install-deps-os/tasks/main.yml +++ b/ansible/roles/install-deps/tasks/main.yml @@ -4,16 +4,15 @@ state=latest with_items: - build-essential - - python2.7-dev + - git + - python-jinja + - python-mock + - python-paramiko - python-pip - python-simplejson + - python-yaml + - python2.7-dev tags: - install -- name: Install OS depencencies to run tests - apt: name={{ item }} - state=latest - with_items: - - python-mock - tags: - - tests +- include: install-mongodb.yml diff --git a/ansible/roles/upstart-conf/handlers/main.yml b/ansible/roles/upstart-conf/handlers/main.yml new file mode 100644 index 0000000..79a5cb8 --- /dev/null +++ b/ansible/roles/upstart-conf/handlers/main.yml @@ -0,0 +1,13 @@ +--- + +- name: start-kernel-ci-backend + service: name={{ upstart_service }} + state=started + +- name: restart-kernel-ci-backend + service: name={{ upstart_service }} + state=restarted + +- name: stop-kernel-ci-backend + service: name={{ upstart_service }} + state=stopped diff --git a/ansible/roles/upstart-conf/tasks/main.yml b/ansible/roles/upstart-conf/tasks/main.yml new file mode 100644 index 0000000..ca0fb71 --- /dev/null +++ b/ansible/roles/upstart-conf/tasks/main.yml @@ -0,0 +1,8 @@ +--- + +- name: Install Upstart conf + template: src=kernel-ci-backend.conf + dest=/etc/init/{{ upstart_service }}.conf + mode=0644 + owner=root + group=root diff --git a/ansible/roles/upstart-conf/templates/kernel-ci-backend.conf b/ansible/roles/upstart-conf/templates/kernel-ci-backend.conf new file mode 100644 index 0000000..d5f911f --- /dev/null +++ b/ansible/roles/upstart-conf/templates/kernel-ci-backend.conf @@ -0,0 +1,16 @@ +# Managed by ansible, do not edit. +author "Milo Casagrande <milo.casagrande@linaro.org>" +description "Configuration to run tornado-base app at startup." + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn +respawn limit 10 5 + +limit nofile 4096 65536 + +setuid {{ app_user }} +setgid {{ app_user }} + +exec {{ install_base }}/{{ hostname }}/app/server.py diff --git a/ansible/site.yml b/ansible/site.yml index abfc31b..ac5ae5f 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -3,6 +3,8 @@ sudo: yes gather_facts: no roles: - - install-deps-os - - install-mongo + - common + - install-deps + - upstart-conf + - install-app
\ No newline at end of file diff --git a/app/server.py b/app/server.py index b3928bf..685695b 100644..100755 --- a/app/server.py +++ b/app/server.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Copyright (C) 2014 Linaro Ltd. # # This program is free software: you can redistribute it and/or modify diff --git a/reuirements.txt b/requirements.txt index 7b6257c..7b6257c 100644 --- a/reuirements.txt +++ b/requirements.txt |