-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathmain.yml
More file actions
93 lines (79 loc) · 1.91 KB
/
main.yml
File metadata and controls
93 lines (79 loc) · 1.91 KB
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
84
85
86
87
88
89
90
91
92
93
---
- name: "Build hosts file"
become: true
lineinfile:
dest: /etc/hosts
regexp: ".*{{ fqdn }}$"
line: "127.0.1.1 {{ fqdn }}"
state: present
- name: Set Hostname with hostname command
become: true
hostname:
name: "{{ fqdn }}"
- name: "ensure a home for {{ app_name }}"
become: true
file:
path: "{{ app_home }}"
owner: "{{ ansible_ssh_user }}"
group: "{{ ansible_ssh_user }}"
state: directory
recurse: yes
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3500
become: true
- name: install ssl system requirements
become: true
apt:
name: "{{ item }}"
state: present
with_items: "{{ ssl_requirements }}"
when: app_use_ssl
tags:
- packages
- name: install system packages
become: true
apt:
name: "{{ item }}"
state: present
with_items: "{{ system_packages }}"
tags:
- packages
- name: Create a virtualenv with latest pip.
pip:
name: pip
virtualenv: "{{ app_home }}"
extra_args: '--upgrade'
- name: "pip+git install {{ app_name }} into virtualenv."
pip:
name: 'git+https://github.com/ceph/shaman@{{ branch }}#egg=shaman'
virtualenv: "{{ app_home }}"
state: forcereinstall
editable: yes
notify: restart app
- name: create the prod config file
template:
src: prod.py.j2
dest: "{{ app_home }}/src/{{ app_name }}/prod.py"
- name: create the prod api credentials file
template:
src: prod_api_creds.py.j2
dest: "{{ app_home }}/src/{{ app_name }}/prod_api_creds.py"
when: api_key is defined and api_user is defined
- name: install python requirements in virtualenv
pip:
requirements: "{{ app_home }}/src/{{ app_name }}/requirements.txt"
state: present
virtualenv: "{{ app_home }}"
notify:
- restart app
- import_tasks: postgresql.yml
tags:
- postgres
- import_tasks: systemd.yml
tags:
- systemd
- import_tasks: nginx.yml
tags:
- nginx