summaryrefslogtreecommitdiffstats
path: root/roles/docker_img_build
diff options
context:
space:
mode:
Diffstat (limited to 'roles/docker_img_build')
-rw-r--r--roles/docker_img_build/README.md36
-rw-r--r--roles/docker_img_build/defaults/main.yml2
-rwxr-xr-xroles/docker_img_build/files/ops-build-container.sh56
-rw-r--r--roles/docker_img_build/handlers/main.yml2
-rw-r--r--roles/docker_img_build/meta/main.yml14
-rw-r--r--roles/docker_img_build/tasks/main.yml6
-rw-r--r--roles/docker_img_build/vars/main.yml2
7 files changed, 118 insertions, 0 deletions
diff --git a/roles/docker_img_build/README.md b/roles/docker_img_build/README.md
new file mode 100644
index 000000000..cf332cde7
--- /dev/null
+++ b/roles/docker_img_build/README.md
@@ -0,0 +1,36 @@
+Role Name
+=========
+
+The purpose of this role is to setup tools to do docker image builds
+
+Requirements
+------------
+
+Docker
+
+Role Variables
+--------------
+
+None
+
+Dependencies
+------------
+
+None
+
+Example Playbook
+----------------
+
+ - hosts: servers
+ roles:
+ - docker_img_build
+
+License
+-------
+
+ASL 2.0
+
+Author Information
+------------------
+
+Thomas Wiest
diff --git a/roles/docker_img_build/defaults/main.yml b/roles/docker_img_build/defaults/main.yml
new file mode 100644
index 000000000..087287db1
--- /dev/null
+++ b/roles/docker_img_build/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# defaults file for docker_img_build
diff --git a/roles/docker_img_build/files/ops-build-container.sh b/roles/docker_img_build/files/ops-build-container.sh
new file mode 100755
index 000000000..308fbd58c
--- /dev/null
+++ b/roles/docker_img_build/files/ops-build-container.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+RED=$(echo -e "\e[31m")
+GREEN=$(echo -e "\e[32m")
+YELLOW=$(echo -e "\e[33m")
+BLUE=$(echo -e "\e[34m")
+NORM=$(echo -e "\e[0m")
+
+CTR_DIR='/usr/local/etc/containers'
+
+EXIT_CODE=0
+
+function main()
+{
+ # Make sure we're in the directory we expect to be in
+ cd $CTR_DIR
+
+ TAG=$(echo $1 | sed 's/_container[\/]*//')
+ if [ -z "$TAG" ]
+ then
+ echo "FAILED parsing tag from \$1 [$1]"
+ exit 10
+ fi
+
+ docker build --rm -t $TAG $1
+ EXIT_CODE=$?
+}
+
+if [ $# -ne 1 ]
+then
+ echo
+ echo " Usage: $(basename $0) container"
+ echo "Example: $(basename $0) monitoring_container"
+ echo
+ exit
+fi
+
+if ! [ -d "$CTR_DIR/$1" ]
+then
+ echo "Error: directory not found [$CTR_DIR/$1]"
+ exit 10
+fi
+
+time main $@
+echo
+echo
+
+if [ $EXIT_CODE -eq 0 ]
+then
+ echo "${GREEN}$1 build succeeded.${NORM}"
+else
+ echo "${RED}$1 build FAILED!${NORM}"
+fi
+
+echo
+exit $EXIT_CODE
diff --git a/roles/docker_img_build/handlers/main.yml b/roles/docker_img_build/handlers/main.yml
new file mode 100644
index 000000000..9b5fe2b3d
--- /dev/null
+++ b/roles/docker_img_build/handlers/main.yml
@@ -0,0 +1,2 @@
+---
+# handlers file for docker_img_build
diff --git a/roles/docker_img_build/meta/main.yml b/roles/docker_img_build/meta/main.yml
new file mode 100644
index 000000000..40f83bf2f
--- /dev/null
+++ b/roles/docker_img_build/meta/main.yml
@@ -0,0 +1,14 @@
+---
+galaxy_info:
+ author: Thomas Wiest
+ description: Tools to do docker image builds
+ company: Red Hat
+ license: ASL 2.0
+ min_ansible_version: 1.6
+ platforms:
+ - name: EL
+ versions:
+ - 7
+ categories:
+ - docker
+dependencies: []
diff --git a/roles/docker_img_build/tasks/main.yml b/roles/docker_img_build/tasks/main.yml
new file mode 100644
index 000000000..aaa2fae25
--- /dev/null
+++ b/roles/docker_img_build/tasks/main.yml
@@ -0,0 +1,6 @@
+---
+- name: mkdir -p /usr/local/etc/containers
+ file: dest=/usr/local/etc/containers state=directory
+
+- name: deploy ops-build-container.sh
+ copy: src=ops-build-container.sh dest=/usr/local/bin/ops-build-container.sh mode=755
diff --git a/roles/docker_img_build/vars/main.yml b/roles/docker_img_build/vars/main.yml
new file mode 100644
index 000000000..ddb684fda
--- /dev/null
+++ b/roles/docker_img_build/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for docker_img_build