barometer: move to opnfv puppet repo
[apex.git] / lib / ansible / playbooks / deploy_dependencies.yml
1 ---
2 - hosts: localhost
3   tasks:
4     - yum:
5         name: "{{ item }}"
6         state: present
7       with_items:
8         - python-lxml
9         - libvirt-python
10     - sysctl:
11         name: net.ipv4.ip_forward
12         state: present
13         value: 1
14         sysctl_set: yes
15     - systemd:
16         name: dhcpd
17         state: stopped
18         enabled: no
19       ignore_errors: yes
20     - systemd:
21         name: libvirtd
22         state: started
23         enabled: yes
24     - systemd:
25         name: openvswitch
26         state: started
27         enabled: yes
28     - virt_net:
29         command: define
30         name: default
31         xml: '{{ lookup("template", "virsh_network_default.xml.j2") }}'
32         state: active
33         autostart: yes
34     - openvswitch_bridge:
35         bridge: 'br-{{ item }}'
36         state: present
37       with_items: '{{ virsh_enabled_networks }}'
38     - virt_net:
39         state: present
40         name: '{{ item }}'
41         xml: '{{ lookup("template", "virsh_network_ovs.xml.j2") }}'
42       with_items: '{{ virsh_enabled_networks }}'
43     - virt_net:
44         state: active
45         name: '{{ item }}'
46         autostart: yes
47       with_items: '{{ virsh_enabled_networks }}'
48     - virt_pool:
49         name: default
50         autostart: yes
51         state: present
52         xml: '{{ lookup("template", "virsh_pool.xml.j2") }}'
53     - virt_pool:
54         name: default
55         autostart: yes
56         state: active
57     - lineinfile:
58         path: /etc/modprobe.d/kvm_intel.conf
59         line: 'options kvm-intel nested=1'
60         create: yes
61       when: ansible_architecture == "x86_64"
62     - modprobe:
63         name: "{{ item }}"
64         state: present
65       with_items:
66         - kvm
67         - kvm_intel
68       when: ansible_architecture == "x86_64"
69     - name: Generate SSH key for root if missing
70       shell: test -e ~/.ssh/id_rsa || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
71     - name: Check that /u/l/python3.4/site-packages/virtualbmc/vbmc.py exists
72       stat:
73         path: /usr/lib/python3.4/site-packages/virtualbmc/vbmc.py
74       register: vbmc_py
75     - name: Manually patch vmbc to work with python3.x
76       lineinfile:
77         line: "                conn.defineXML(ET.tostring(tree, encoding='unicode'))"
78         regexp: "tostring"
79         path: /usr/lib/python3.4/site-packages/virtualbmc/vbmc.py
80       when: vbmc_py.stat.exists == True
81     - name: Add ssh retry to Ansible config
82       ini_file:
83         path: /etc/ansible/ansible.cfg
84         section: ssh_connection
85         option: retries
86         value: 5