Provision dockerbox in Vagrant and setup network

This commit is contained in:
Kris Lamoureux 2020-06-23 21:59:47 -04:00
parent d276c3dc2b
commit c8b7821eb3
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
7 changed files with 51 additions and 11 deletions

2
Vagrantfile vendored
View File

@ -3,7 +3,7 @@
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = "debian/buster64" config.vm.box = "debian/buster64"
config.vm.network :private_network, ip: "192.168.111.222" config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.synced_folder ".", "/vagrant", disabled: true
# Machine Name # Machine Name

11
dev/dockerbox.yml Normal file
View File

@ -0,0 +1,11 @@
- name: Install Docker Box Server
hosts: all
become: true
vars_files:
- host_vars/dockerbox.yml
roles:
- ansible
- base
- docker
- jenkins
- prometheus

View File

@ -0,0 +1,17 @@
# base
manage_network: false
network_type: static
ip_inter: eth1
ip_addr: 192.168.1.2/24
ip_gateway: 192.168.1.1
# docker
docker_user: vagrant
# jenkins
jenkins_version: 2.229
# prometheus
prom_name: prometheus
prom_version: latest
prom_targets: "['127.0.0.1', '127.0.0.1:9100']"

View File

@ -0,0 +1,10 @@
# Ansible managed
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback

View File

@ -3,14 +3,24 @@
name: ["vim", "wget"] name: ["vim", "wget"]
state: present state: present
- name: Install network interfaces file
copy:
src: network-interfaces.cfg
dest: /etc/network/interfaces
owner: root
group: root
mode: '0644'
when: manage_network
- name: Install network interfaces - name: Install network interfaces
template: template:
src: "{{ network_type }}-interface.cfg" src: "{{ network_type }}-interface.cfg"
dest: /etc/network/interfaces dest: "/etc/network/interfaces.d/{{ ip_inter }}"
notify: reboot_host notify: reboot_host
when: manage_network
- name: Install bridge utilities - name: Install bridge utilities
apt: apt:
name: bridge-utils name: bridge-utils
state: present state: present
when: network_type == "bridged" when: network_type == "bridged" and manage_network

View File

@ -1,9 +1,5 @@
# {{ ansible_managed }} # {{ ansible_managed }}
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface # The primary network interface
auto br1 auto br1
iface br1 inet static iface br1 inet static

View File

@ -1,9 +1,5 @@
# {{ ansible_managed }} # {{ ansible_managed }}
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface # The primary network interface
auto {{ ip_inter }} auto {{ ip_inter }}
iface {{ ip_inter }} inet static iface {{ ip_inter }} inet static