-
Notifications
You must be signed in to change notification settings - Fork 0
/
compute1.yml
68 lines (50 loc) · 2.1 KB
/
compute1.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
---
- name: "nova compute node playbook"
hosts: compute
remote_user: root
gather_facts: yes
tasks:
- name: "Install kvm hypervisor"
yum: name={{ item }} state=present
with_items:
- qemu-kvm
- libvirt
- virt-install
- bridge-utils
- network-manager-applet.x86_64
- name: "start and enable libvirtd"
service: name=libvirtd state=started enabled=yes
- name: "Install epelrepo"
yum: name=epel-release state=present
- name: "Install openstack-ocata repo"
yum: name=centos-release-openstack-ocata state=present
- lineinfile: path=/etc/yum.repos.d/CentOS-OpenStack-ocata.repo regexp='^enabled=1' line='enabled=0'
- name: "Install Openstack nova compute package"
yum: name=openstack-nova-compute enablerepo=centos-openstack-ocata,epel state=present
- name: "Backup Original nova configuation"
copy: remote_src=True src=/etc/nova/nova.conf dest=/etc/nova/nova.conf.org
- name: "copy nova configuation"
copy: src=nova-compute.conf dest=/etc/nova/nova.conf mode=640 owner=root group=nova
- name: "replace ansible_host in nova conf"
replace: dest=/etc/nova/nova.conf regexp='10.0.0.30' replace={{ ansible_host }} backup=yes
- name: "Reboot"
command: /sbin/shutdown -r +1
async: 0
poll: 0
ignore_errors: true
- name: Waiting for shutdown
local_action: wait_for host={{ ansible_host }} port=22 state=stopped
- name: Waiting for restart
local_action: wait_for host={{ ansible_host }} port=22 state=started
- name: "start and enble nova compute service"
service: name=openstack-nova-compute state=started enabled=yes
- name: "discover compute node"
shell: nova-manage cell_v2 discover_hosts
become: true
become_method: su
become_user: nova
become_flags: '-s /bin/bash'
- name: "compute service list"
shell: source ~/keystonerc && openstack compute service list
register: compute
- debug: var=compute