summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-rabbitmq.yml
blob: 58037bce215f755e88016c678a63602662296b4a (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
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
94
95
96
97
98
99
100
101
102
103
104
---
#- hosts: config
#  sudo: yes
#  tasks:
- name: "start supervisor support service"
#  sudo: True
  service:
    name: "supervisor-support-service"
    state: "started"



- name: "stop rabbitmq server via supervisor"
#  sudo: True
  supervisorctl:
    name: "rabbitmq-server"
    state: "stopped"
    server_url: "unix:///tmp/supervisord_support_service.sock"



- name: "-rabbitmq-stop"
#  sudo: True
  include: -rabbitmq-stop.yml



- name: "update hosts"
#  sudo: True
  lineinfile:
    dest: "/etc/hosts"
#    line: "{{ hostvars[item]['contrail_address'] }}\t{{ hostvars[item]['ansible_hostname'] }} {{ hostvars[item]['ansible_hostname'] }}-ctrl"
    line: "{{ contrail_address }}\t{{ inventory_hostname }} {{ inventory_hostname }}-ctrl"
  with_items: groups['opencontrail_config']



- name: "fix up rabbitmq env"
#  sudo: True
  template:
    src: "provision/rabbitmq-env-conf.j2"
    dest: "/etc/rabbitmq/rabbitmq-env.conf"



- name: "fix up rabbitmq config for single node"
#  sudo: True
  template:
    src: "provision/rabbitmq-conf-single.j2"
    dest: "/etc/rabbitmq/rabbitmq.config"
  when: groups['opencontrail_config'][1] is not defined



- name: fix up rabbitmq config for multi nodes
#  sudo: True
  template:
    src: "provision/rabbitmq-conf.j2"
    dest: "/etc/rabbitmq/rabbitmq.config"
  when: groups['opencontrail_config'][1] is defined



- name: "-rabbitmq-stop"
#  sudo: True
  include: -rabbitmq-stop.yml
  
  

- name: "create cookie uuid temporary"
#  sudo: True
  local_action:
    module: "template"
    src: "provision/rabbitmq-cookie.j2"
    dest: "/tmp/tmp-rabbitmq-cookie"
  run_once: yes


- name: "update cookie uuid"
#  sudo: True
  copy:
    src: "/tmp/tmp-rabbitmq-cookie"
    dest: "/var/lib/rabbitmq/.erlang.cookie"
    owner: "rabbitmq"
    group: "rabbitmq"
    mode: 0400



- name: "delete temporary cookie uuid"
#  sudo: True
  local_action:
    module: "file"
    dest: "/tmp/tmp-rabbitmq-cookie"
    state: "absent"
  run_once: yes



- name: "start rabbitmq server"
#  sudo: True
  service:
    name: "rabbitmq-server"
    state: "started"
ltImpl() error { var err C.virError if i := int(C.virEventRunDefaultImplWrapper(&err)); i != 0 { return makeError(&err) } return nil } type EventHandleCallback func(watch int, file int, events EventHandleType) //export eventHandleCallback func eventHandleCallback(watch int, fd int, events int, callbackID int) { callbackFunc := getCallbackId(callbackID) callback, ok := callbackFunc.(EventHandleCallback) if !ok { panic("Incorrect event handle callback data") } callback(watch, fd, (EventHandleType)(events)) } // See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventAddHandle func EventAddHandle(fd int, events EventHandleType, callback EventHandleCallback) (int, error) { callbackID := registerCallbackId(callback) var err C.virError ret := C.virEventAddHandleWrapper((C.int)(fd), (C.int)(events), (C.int)(callbackID), &err) if ret == -1 { return 0, makeError(&err) } return int(ret), nil } // See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventUpdateHandle func EventUpdateHandle(watch int, events EventHandleType) { C.virEventUpdateHandle((C.int)(watch), (C.int)(events)) } // See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRemoveHandle func EventRemoveHandle(watch int) error { var err C.virError ret := C.virEventRemoveHandleWrapper((C.int)(watch), &err) if ret < 0 { return makeError(&err) } return nil } type EventTimeoutCallback func(timer int) //export eventTimeoutCallback func eventTimeoutCallback(timer int, callbackID int) { callbackFunc := getCallbackId(callbackID) callback, ok := callbackFunc.(EventTimeoutCallback) if !ok { panic("Incorrect event timeout callback data") } callback(timer) } // See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventAddTimeout func EventAddTimeout(freq int, callback EventTimeoutCallback) (int, error) { callbackID := registerCallbackId(callback) var err C.virError ret := C.virEventAddTimeoutWrapper((C.int)(freq), (C.int)(callbackID), &err) if ret == -1 { return 0, makeError(&err) } return int(ret), nil } // See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventUpdateTimeout func EventUpdateTimeout(timer int, freq int) { C.virEventUpdateTimeout((C.int)(timer), (C.int)(freq)) } // See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRemoveTimeout func EventRemoveTimeout(timer int) error { var err C.virError ret := C.virEventRemoveTimeoutWrapper((C.int)(timer), &err) if ret < 0 { return makeError(&err) } return nil } type EventHandleCallbackInfo struct { callback uintptr opaque uintptr free uintptr } type EventTimeoutCallbackInfo struct { callback uintptr opaque uintptr free uintptr } func (i *EventHandleCallbackInfo) Invoke(watch int, fd int, event EventHandleType) { C.eventHandleCallbackInvoke(C.int(watch), C.int(fd), C.int(event), C.uintptr_t(i.callback), C.uintptr_t(i.opaque)) } func (i *EventTimeoutCallbackInfo) Invoke(timer int) { C.eventTimeoutCallbackInvoke(C.int(timer), C.uintptr_t(i.callback), C.uintptr_t(i.opaque)) } func (i *EventHandleCallbackInfo) Free() { C.eventHandleCallbackFree(C.uintptr_t(i.free), C.uintptr_t(i.opaque)) } func (i *EventTimeoutCallbackInfo) Free() { C.eventTimeoutCallbackFree(C.uintptr_t(i.free), C.uintptr_t(i.opaque)) } type EventLoop interface { AddHandleFunc(fd int, event EventHandleType, callback *EventHandleCallbackInfo) int UpdateHandleFunc(watch int, event EventHandleType) RemoveHandleFunc(watch int) int AddTimeoutFunc(freq int, callback *EventTimeoutCallbackInfo) int UpdateTimeoutFunc(timer int, freq int) RemoveTimeoutFunc(timer int) int } var eventLoopImpl EventLoop // See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRegisterImpl func EventRegisterImpl(impl EventLoop) { eventLoopImpl = impl C.virEventRegisterImplWrapper() } //export eventAddHandleFunc func eventAddHandleFunc(fd C.int, event C.int, callback uintptr, opaque uintptr, free uintptr) C.int { if eventLoopImpl == nil { panic("Event loop impl is missing") } cbinfo := &EventHandleCallbackInfo{ callback: callback, opaque: opaque, free: free, } return C.int(eventLoopImpl.AddHandleFunc(int(fd), EventHandleType(event), cbinfo)) } //export eventUpdateHandleFunc func eventUpdateHandleFunc(watch C.int, event C.int) { if eventLoopImpl == nil { panic("Event loop impl is missing") } eventLoopImpl.UpdateHandleFunc(int(watch), EventHandleType(event)) } //export eventRemoveHandleFunc func eventRemoveHandleFunc(watch C.int) { if eventLoopImpl == nil { panic("Event loop impl is missing") } eventLoopImpl.RemoveHandleFunc(int(watch)) } //export eventAddTimeoutFunc func eventAddTimeoutFunc(freq C.int, callback uintptr, opaque uintptr, free uintptr) C.int { if eventLoopImpl == nil { panic("Event loop impl is missing") } cbinfo := &EventTimeoutCallbackInfo{ callback: callback, opaque: opaque, free: free, } return C.int(eventLoopImpl.AddTimeoutFunc(int(freq), cbinfo)) } //export eventUpdateTimeoutFunc func eventUpdateTimeoutFunc(timer C.int, freq C.int) { if eventLoopImpl == nil { panic("Event loop impl is missing") } eventLoopImpl.UpdateTimeoutFunc(int(timer), int(freq)) } //export eventRemoveTimeoutFunc func eventRemoveTimeoutFunc(timer C.int) { if eventLoopImpl == nil { panic("Event loop impl is missing") } eventLoopImpl.RemoveTimeoutFunc(int(timer)) }