/
playbook.yml
83 lines (70 loc) · 2.12 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Ansible playbook
#
# To provision:
# ansible-playbook -i <inventory> playbook.yml
#
# VERSION 0.1
# ANSIBLE-VERSION 2.3.0
- hosts: vagrant
user: vagrant
become: True
tasks:
- group: name=admin state=present
- user: name=ansible groups=admin shell=/bin/bash password=ansible state=present
- file: path=/etc/sudoers.d mode=0770 owner=root group=root state=directory
- copy: src=files/etc/sudoers dest=/etc/sudoers mode=0440 owner=root group=root
- command: cat /home/vagrant/.ssh/authorized_keys
register: authorized_keys
- authorized_key: user=ansible key="{{ item }}"
with_items: "{{ authorized_keys.stdout_lines }}"
- hosts: app
user: ansible
become: True
tasks:
- name: update apt
apt: update_cache=yes cache_valid_time=3600
- name: install apt packages
apt: name="{{ item }}"
with_items:
- build-essential
- python
- python-dev
- python-setuptools
- python-pip
- python-numpy
- python-opencv
- python-pycurl
- libjpeg-dev
- libfreetype6-dev
- zlib1g-dev
- libwebp-dev
- liblcms2-dev
- name: install pip packages
pip: >
name={{ item.name }}
version={{ item.version }}
use_mirrors=yes
with_items:
- { name: 'Pillow', version: '5.2.0' }
- { name: 'tornado', version: '5.1.0' }
- { name: 'coverage', version: '3.6' }
- { name: 'pep8', version: '1.6.2' }
- { name: 'pyflakes', version: '0.8.1' }
- { name: 'pyandoc', version: '0.0.1' }
- { name: 'sphinx-me', version: '0.2.1' }
- { name: 'twine', version: '1.9.1' }
- hosts: app
user: ansible
become: True
tasks:
- name: copy pilbox init script
copy: src=files/etc/init.d/pilbox dest=/etc/init.d/pilbox mode=0755
notify:
- restart pilbox
- name: install pilbox init script
command: update-rc.d pilbox defaults
- name: running pilbox check
service: name=pilbox state=started enabled=yes
handlers:
- name: restart pilbox
service: name=pilbox state=restarted