diff --git a/.gitignore b/.gitignore index 5f3f30d..69eb45d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /*.yaml !moxie.yml !upgrade-moxie.yml +!dockerbox.yml /environments/ diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..654ae40 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,18 @@ +pipeline { + agent any + stages { + stage('Build') { + steps { + + dir ('environments') { + git credentialsId: 'b643c25a-d040-4692-8067-d82511509bd0', + branch: 'prom', url: 'git@github.com:krislamo/moxie-env.git' + } + + ansiblePlaybook credentialsId: '4e3a5a7a-fca5-4f10-89a4-8996cf14fec7', + playbook: 'dockerbox.yml' + + } + } + } +} diff --git a/dockerbox.yml b/dockerbox.yml new file mode 100644 index 0000000..b072777 --- /dev/null +++ b/dockerbox.yml @@ -0,0 +1,22 @@ +# Copyright (C) 2020 Kris Lamoureux +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +- name: Install Docker Box Server + hosts: dockerbox + become: true + roles: + - ansible + - docker + - jenkins + - prometheus diff --git a/roles/jenkins/ansible.list b/roles/jenkins/ansible.list new file mode 100644 index 0000000..3ebd328 --- /dev/null +++ b/roles/jenkins/ansible.list @@ -0,0 +1 @@ +deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main diff --git a/roles/jenkins/tasks/main.yml b/roles/jenkins/tasks/main.yml new file mode 100644 index 0000000..62af455 --- /dev/null +++ b/roles/jenkins/tasks/main.yml @@ -0,0 +1,39 @@ +- name: Install Ansible source + template: + src: ansible.list + dest: /etc/apt/sources.list.d/ansible.list + +- name: Add Ansible source key + apt_key: + keyserver: keyserver.ubuntu.com + id: 93C4A3FD7BB9C367 + +- name: Install Ansible + apt: + name: ansible + state: present + +- name: Install Java + apt: + name: default-jre + state: present + +- name: Create Jenkin's directory + file: + path: /home/{{ docker_user }}/jenkins + state: directory + recurse: yes + owner: "1000" + group: "1000" + +- name: Start Jenkins Container + docker_container: + name: jenkins + image: jenkins/jenkins:2.228 + state: started + restart_policy: always + ports: + - 8080:8080 + - 50000:50000 + volumes: + - /home/{{ docker_user }}/jenkins:/var/jenkins_home