forked from apagel/cldemo-docker-macvlan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-demo.yml
141 lines (125 loc) · 4.35 KB
/
run-demo.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
- hosts: network
become: yes
roles:
- copy_interfaces
- copy_quagga_daemons
- restart_switches
- mv_ntp_mgmt_vrf
- hosts: spine
become: yes
tasks:
- name: copy Quagga conf
copy: src=config/{{ansible_hostname}}/Quagga.conf dest=/etc/quagga/
- name: reload networking
command: ifreload -a
- name: reload quagga
service: name=quagga state=restarted
- hosts: leaf
become: yes
tasks:
- name: enable redistribute neighbor
command: systemctl enable rdnbrd.service
- name: start redistribute neighbor
command: systemctl start rdnbrd.service
- name: copy Quagga conf
copy: src=config/{{ansible_hostname}}/Quagga.conf dest=/etc/quagga/
- name: reload networking
command: ifreload -a
- name: reload quagga
service: name=quagga state=restarted
- hosts: servers
user: cumulus
become: yes
become_method: sudo
roles:
- install-docker-ifupdown2
- copy-interfaces-dockerfile-restart
- hosts: server01
user: cumulus
become: yes
become_method: sudo
tasks:
- name: create docker macvlan network
docker_network:
name: server01_eth1
driver: macvlan
driver_options:
parent: eth1
ipam_options:
subnet: 172.16.1.0/24
gateway: 172.16.1.1
iprange: 172.16.1.0/24
- name: build container
command: docker build -t demo_container /home/cumulus/
- name: run container 1
command: docker run --ip=172.16.1.11 --net=server01_eth1 --name=server01-172.16.1.11 -itd demo_container
- name: run container 2
command: docker run --ip=172.16.1.12 --net=server01_eth1 --name=server01-172.16.1.12 -itd demo_container
- name: run container 3
command: docker run --ip=172.16.1.13 --net=server01_eth1 --name=server01-172.16.1.13 -itd demo_container
- hosts: server02
user: cumulus
become: yes
become_method: sudo
tasks:
- name: create docker macvlan network
docker_network:
name: server02_eth2
driver: macvlan
driver_options:
parent: eth2
ipam_options:
subnet: 172.16.1.0/24
gateway: 172.16.1.1
iprange: 172.16.1.0/24
- name: build container
command: docker build -t demo_container /home/cumulus/
- name: run container 1
command: docker run --ip=172.16.1.21 --net=server02_eth2 --name=server02-172.16.1.21 -itd demo_container
- name: run container 2
command: docker run --ip=172.16.1.22 --net=server02_eth2 --name=server02-172.16.1.22 -itd demo_container
- name: run container 3
command: docker run --ip=172.16.1.23 --net=server02_eth2 --name=server02-172.16.1.23 -itd demo_container
- hosts: server03
become: yes
tasks:
- name: create docker macvlan network
docker_network:
name: server03_eth1
driver: macvlan
driver_options:
parent: eth1
ipam_options:
subnet: 172.16.1.0/24
gateway: 172.16.1.1
iprange: 172.16.1.0/24
- name: build container
command: docker build -t demo_container /home/cumulus/
- name: run container 1
command: docker run --ip=172.16.1.31 --net=server03_eth1 --name=server03-172.16.1.31 -itd demo_container
- name: run container 2
command: docker run --ip=172.16.1.32 --net=server03_eth1 --name=server03-172.16.1.32 -itd demo_container
- name: run container 3
command: docker run --ip=172.16.1.33 --net=server03_eth1 --name=server03-172.16.1.33 -itd demo_container
- hosts: server04
become: yes
tasks:
- name: create docker macvlan network
docker_network:
name: server04_eth2
driver: macvlan
driver_options:
parent: eth2
ipam_options:
subnet: 172.16.1.0/24
gateway: 172.16.1.1
iprange: 172.16.1.0/24
- name: build container
command: docker build -t demo_container /home/cumulus/
- name: run container 1
command: docker run --ip=172.16.1.41 --net=server04_eth2 -itd --name=server04-172.16.1.41 demo_container
- name: run container 2
command: docker run --ip=172.16.1.42 --net=server04_eth2 -itd --name=server04-172.16.1.42 demo_container
- name: run container 3
command: docker run --ip=172.16.1.43 --net=server04_eth2 -itd --name=server04-172.16.1.43 demo_container