Skip to content

Commit

Permalink
Make master installation work in a Vagrant test environment
Browse files Browse the repository at this point in the history
* Ensure python is installed
* Ensure firewalld and it's python client libraries are present
* Add a Vagrantfile to deploy a jenkins-master

Signed-off-by: Roman Mohr <[email protected]>
  • Loading branch information
rmohr committed Jul 26, 2017
1 parent 74f837d commit 7ecf75c
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
group_vars/all/main.yml
hosts
hosts.*
.vagrant
42 changes: 42 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
Vagrant.configure(2) do |config|
config.vm.box = "fedora26"
config.vm.box_url = "http://mirror.de.leaseweb.net/fedora/linux/releases/26/CloudImages/x86_64/images/Fedora-Cloud-Base-Vagrant-26-1.5.x86_64.vagrant-libvirt.box"

if Vagrant.has_plugin?("vagrant-cachier") then
config.cache.scope = :machine
config.cache.auto_detect = false
config.cache.enable :dnf
config.cache.synced_folder_opts = {
type: :nfs,
mount_options: ['rw', 'vers=4', 'tcp']
}
end

config.vm.provider :libvirt do |domain|
domain.cpus = 2
domain.nested = true # enable nested virtualization
domain.cpu_mode = "host-model"
end

config.ssh.insert_key = false

config.vm.provision "ansible" do |ansible|
ansible.verbose = "v"
ansible.playbook = "ci.yaml"
end

config.vm.define "jenkins-master" do |master|
master.vm.hostname = "master"
master.vm.network "private_network", ip: "192.168.201.2"
master.vm.provider :libvirt do |domain|
domain.memory = 3000
end

master.vm.provision "shell", inline: <<-SHELL
echo "hallo"
SHELL
end
end
9 changes: 9 additions & 0 deletions ci.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
---
- hosts: all
sudo: yes
gather_facts: False

tasks:
- name: install python 2
raw: dnf install -y python2
- hosts: jenkins-master
sudo: yes
roles:
- jenkins-deps
- jenkins-master
- hosts: jenkins-slaves
sudo: yes
roles:
- jenkins-deps
- jenkins-slave
2 changes: 2 additions & 0 deletions jenkins-deps/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
name: '{{ item }}'
state: latest
with_items:
- python-firewall
- libselinux-python
- vagrant
- vagrant-libvirt
- git
Expand Down
7 changes: 6 additions & 1 deletion jenkins-master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
with_items:
- java
- jenkins
- firewalld
- name: Enable Firewalld
systemd:
name: firewalld
enabled: yes
- name: Enable Jenkins
systemd:
name: jenkins
Expand Down Expand Up @@ -58,7 +63,7 @@
until: >
'status' in jenkins_service_status and
jenkins_service_status['status'] == 200
- name: Delete startu scripts with sensible data after jenkins started
- name: Delete startup scripts with sensible data after jenkins started
file:
state: absent
path: "/var/lib/jenkins/init.groovy.d/"
Expand Down

0 comments on commit 7ecf75c

Please sign in to comment.