-
Notifications
You must be signed in to change notification settings - Fork 15
/
tendrl-api.yml
70 lines (59 loc) · 1.71 KB
/
tendrl-api.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
---
- name: Install tendrl-api
yum:
name=tendrl-api
state=latest
- name: Configure tendrl-api etcd.yml host
replace:
dest: /etc/tendrl/etcd.yml
regexp: "^ +:host:.*"
replace: " :host: '{{ etcd_ip_address }}'"
notify:
- restart tendrl-api
- name: Configure tendrl-api etcd.yml user_name
replace:
dest: /etc/tendrl/etcd.yml
regexp: "^ +:user_name:.*"
replace: " :user_name: ''"
notify:
- restart tendrl-api
- name: Configure tendrl-api etcd.yml password
replace:
dest: /etc/tendrl/etcd.yml
regexp: "^ +:password:.*"
replace: " :password: ''"
notify:
- restart tendrl-api
# based on description from:
# https://github.com/Tendrl/api/blob/master/docs/users.adoc#create-admin-user
- name: Create Tendrl admin user
shell: RACK_ENV=production rake etcd:load_admin
args:
chdir: /usr/share/tendrl-api
register: rake_result
changed_when:
- "'User named admin already exists.' not in rake_result.stdout"
failed_when:
- "rake_result.rc != 0"
# Extracting and storing default password is based on requirements from
# tendrl.atlassian.net jira TEN-257
- name: Extract tendrl admin password
shell: echo "{{rake_result.stdout_lines[3] | regex_replace('^.*\"Password:\s*(.*)\".*$','\1')}}"
register: admin_password
when: rake_result.changed
# - debug:
# msg: "Tendrl Admin password: {{ admin_password }}"
- name: Store tendrl admin password to local /root/password file
copy:
content="{{ admin_password.stdout }}\n"
dest=/root/password
mode=600
when: admin_password.changed
- name: Enable tendrl-api service
service:
name=tendrl-api
enabled=yes
- name: Start tendrl-api service
service:
name=tendrl-api
state=started