Ensures v4/v6 iptables filters are loaded
[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     - shell: cat /sys/module/kvm_intel/parameters/nested || true
58       register: nested_result
59       when: ansible_architecture == "x86_64"
60     - name: reload kvm_intel
61       block:
62         - lineinfile:
63             path: /etc/modprobe.d/kvm_intel.conf
64             line: 'options kvm-intel nested=1'
65             create: yes
66         - modprobe:
67             name: kvm_intel
68             state: absent
69         - modprobe:
70             name: kvm_intel
71             state: present
72       when:
73         - ansible_architecture == "x86_64"
74         - "'Y' not in nested_result.stdout"
75     - modprobe:
76         name: ip6_tables
77         state: present
78     - modprobe:
79         name: ip_tables
80         state: present
81     - name: Generate SSH key for root if missing
82       shell: test -e ~/.ssh/id_rsa || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
83     - name: Check that /u/l/python3.4/site-packages/virtualbmc/vbmc.py exists
84       stat:
85         path: /usr/lib/python3.4/site-packages/virtualbmc/vbmc.py
86       register: vbmc_py
87     - name: Manually patch vmbc to work with python3.x
88       lineinfile:
89         line: "                conn.defineXML(ET.tostring(tree, encoding='unicode'))"
90         regexp: "tostring"
91         path: /usr/lib/python3.4/site-packages/virtualbmc/vbmc.py
92       when: vbmc_py.stat.exists == True
93     - name: Add ssh retry to Ansible config
94       ini_file:
95         path: /etc/ansible/ansible.cfg
96         section: ssh_connection
97         option: retries
98         value: 5