aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml
blob: eb6301b2b080785ef319daab0631b39a1bc3c066 (plain)
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
---
#- hosts: webui
#  sudo: yes
#  tasks:

- name: "enable supervisor webui"
  file:
    path: "/etc/init/supervisor-webui.override"
    state: "absent"

- name: "redis-setup"
  include: -redis-setup.yml

- name: "node-common"
  include: -node-common.yml

- name: "set first cassandra host address"
  set_fact:
    cassandra_addrs: "'{{ hostvars[item.1]['contrail_address'] }}'"
  with_indexed_items: groups['opencontrail_database']
  when: item.0 == 0

- name: "set second or more cassandra host addresses"
  set_fact:
    cassandra_addrs: "{{ cassandra_addrs }}, '{{ hostvars[item.1]['contrail_address'] }}'"
  with_indexed_items: groups['opencontrail_database']
  when: item.0 > 0

- name: "modify webui global js"
  lineinfile:
    dest: "/etc/contrail/config.global.js"
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
  with_items:
    - { regexp: "^\\s*config.networkManager.ip", line: "config.networkManager.ip = '{{ contrail_haproxy_address }}';" }
    - { regexp: "^\\s*config.imageManager.ip", line: "config.imageManager.ip = '{{ contrail_keystone_address }}';" }
    - { regexp: "^\\s*config.computeManager.ip", line: "config.computeManager.ip = '{{ contrail_keystone_address }}';" }
    - { regexp: "^\\s*config.identityManager.ip", line: "config.identityManager.ip = '{{ contrail_keystone_address }}';" }
    - { regexp: "^\\s*config.storageManager.ip", line: "config.storageManager.ip = '{{ contrail_keystone_address }}';" }
    - { regexp: "^\\s*config.cnfg.server_ip", line: "config.cnfg.server_ip = '{{ contrail_haproxy_address }}';" }
    - { regexp: "^\\s*config.analytics.server_ip", line: "config.analytics.server_ip = '{{ contrail_haproxy_address }}';" }
    - { regexp: "^\\s*config.cassandra.server_ips", line: "config.cassandra.server_ips = [{{ cassandra_addrs }}];" }

- name: "modify webui userauth js"
  lineinfile:
    dest: "/etc/contrail/contrail-webui-userauth.js"
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
  with_items:
    - { regexp: "^\\s*auth.admin_user", line: "auth.admin_user = '{{ contrail_admin_user }}';" }
    - { regexp: "^\\s*auth.admin_password", line: "auth.admin_password = '{{ contrail_admin_password }}';" }
    - { regexp: "^\\s*auth.admin_tenant_name", line: "auth.admin_tenant_name = 'admin';" }

- name: "create symbolic link from nodejs to node"
  file:
    src: "/usr/bin/node"
    dest: "/usr/bin/nodejs"
    state: "link"

- name: "restart supervisor webui"
  service:
    name: "supervisor-webui"
    state: "restarted"