blob: e97b5413b5e7b2ba57338cd12ed1ffa372156fbe [file] [log] [blame]
---
- hosts: nova-compute-1
remote_user: ubuntu
become: yes
tasks:
- name: Include configuration vars
include_vars: simulate-fabric-vars.yml
- name: Install prerequisites
apt:
name={{ item }}
update_cache=yes
cache_valid_time=3600
become: yes
with_items:
- bridge-utils
- name: Create bridges
when: "ansible_{{ item.name }} is not defined"
command: brctl addbr "{{ item.name }}"
with_items: "{{ simfabric_bridges }}"
- name: Set IP addresses to bridges
when: "ansible_{{ item.0.name }} is not defined"
command: "ip addr add {{ item.1 }} dev {{ item.0.name }}"
with_subelements:
- "{{ simfabric_bridges }}"
- addresses
- name: Start bridges
when: "not ansible_{{ item.name }}.active"
command: "ip link set dev {{ item.name }} up"
with_items: "{{ simfabric_bridges }}"
- name: Create ip links
when: "ansible_{{ item.name }}0 is not defined"
command: "ip link add address {{ item.mac }} type {{ item.name }}"
with_items: "{{ simfabric_links }}"
- name: Start interfaces
when: "not ansible_{{ item }}.active"
command: "ip link set dev {{ item }} up"
with_items: "{{ simfabric_interfaces }}"
- name: Add interfaces to bridges
when: "ansible_{{ item.0.name }}.interfaces is not defined"
command: "brctl addif {{ item.0.name }} {{ item.1 }}"
with_subelements:
- "{{ simfabric_bridges }}"
- interfaces
- name: Configure iptables
iptables: "table={{ item.table }} chain={{ item.chain }} source={{ item.source }} destination={{ item.dest }} jump={{ item.jump }}"
with_items: "{{ simfabric_iptables }}"
- name: Set kernel sysctl values
sysctl:
name="{{ item.name }}"
value="{{ item.value }}"
sysctl_set=yes
state=present
reload=yes
with_items: "{{ simfabric_sysctl }}"