Statistics
| Branch: | Revision:

iof-tools / playbooks / setup-nodes.yaml @ 3e589bae

History | View | Annotate | Download (1.95 KB)

1
---
2
- hosts: nodes
3
  gather_facts: true
4

    
5
  tasks:
6
    - name: Enable NAT
7
      become: true
8
      shell: wget -O - -q https://www.wall2.ilabt.iminds.be/enable-nat.sh | sudo bash
9
      warn: false
10
    - name: set variables 1
11
      set_fact:
12
        home_dir: "{{ ansible_env.HOME }}"
13
        bird_folder: "iof-bird-daemon"
14
    - name: set variables 2
15
      set_fact:
16
        bird_dir: "{{ home_dir }}/{{ bird_folder }}"
17
    - name: install required libraries
18
      become: true
19
      apt:
20
        name: "{{ packages }}"
21
        update_cache: yes
22
      vars:
23
        packages:
24
          - libncurses5-dev
25
          - libreadline-dev
26
          - python3.6
27
          - python3-pip
28
    - name: set python2 as alternative
29
      become: true
30
      command: update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
31
    - name: set python3 as default
32
      become: true
33
      command: update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
34
    - name: install ansible
35
      become: true
36
      pip:
37
        name: ansible
38
    - git:
39
        repo: "https://ans.disi.unitn.it/redmine/iof-bird-daemon.git"
40
        dest: "{{ bird_dir }}"
41
        version: "milani/bird-2.0.1"
42
    - name: run autoreconf
43
      command: autoreconf
44
      args:
45
        chdir: "{{ bird_dir }}"
46
    - name: run configure
47
      command: ./configure
48
      args:
49
        chdir: "{{ bird_dir }}"
50
    - name: compile bird
51
      command: make -j 4
52
      args:
53
        chdir: "{{ bird_dir }}"
54
#
55
    - name: Get Interface Name 
56
      shell: ip addr show | grep "192.168.0" |  sed 's/^.*global //' 
57
      register: command_output
58
    - set_fact:
59
        ifname="{{ command_output.stdout }}"
60
    - name: print result
61
      debug:
62
        var: ifname 
63
    - name: create bridge
64
      become: true
65
      command: brctl addbr br-iof
66
    - name: disable stp
67
      become: true
68
      command: brctl stp br-iof off
69
    - name: add iface to bridge
70
      become: true
71
      command: "brctl addif br-iof {{ ifname }}"