Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sol1 Ansible Roles
sol1-influxdb
Commits
bbbc0591
Commit
bbbc0591
authored
May 27, 2016
by
Ross McDonald
Browse files
Merge pull request #11 from rossmcdonald/ross-develop
Docker Improvements
parents
ca292ab8
051605d0
Changes
12
Hide whitespace changes
Inline
Side-by-side
LICENSE
0 → 100644
View file @
bbbc0591
The MIT License (MIT)
Copyright (c) 2016 Ross McDonald
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
defaults/main.yml
View file @
bbbc0591
...
@@ -17,7 +17,7 @@ influxdb_load_sample_data: no
...
@@ -17,7 +17,7 @@ influxdb_load_sample_data: no
influxdb_sample_database_name
:
sample_database
influxdb_sample_database_name
:
sample_database
influxdb_sample_measurement_name
:
random_ints
influxdb_sample_measurement_name
:
random_ints
influxdb_bind_hostname
:
"
{{
ansible_hostname
}}"
influxdb_bind_hostname
:
'
'
influxdb_install_python_client
:
no
influxdb_install_python_client
:
no
...
...
docker/Dockerfile_centos_6
View file @
bbbc0591
...
@@ -13,4 +13,4 @@ RUN mkdir -p $PROJECT_DIR
...
@@ -13,4 +13,4 @@ RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR
WORKDIR $PROJECT_DIR
VOLUME $PROJECT_DIR
VOLUME $PROJECT_DIR
ENTRYPOINT [ "ansible-playbook", "-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
ENTRYPOINT [ "ansible-playbook",
"-M", "/root",
"-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
docker/Dockerfile_centos_7
View file @
bbbc0591
...
@@ -13,4 +13,4 @@ RUN mkdir -p $PROJECT_DIR
...
@@ -13,4 +13,4 @@ RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR
WORKDIR $PROJECT_DIR
VOLUME $PROJECT_DIR
VOLUME $PROJECT_DIR
ENTRYPOINT [ "ansible-playbook", "-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
ENTRYPOINT [ "ansible-playbook",
"-M", "/root",
"-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
docker/Dockerfile_opensuse_harlequin
0 → 100644
View file @
bbbc0591
FROM opensuse:13.2
MAINTAINER Ross McDonald <mcdonaldrossc+docker@gmail.com>
RUN zypper -n in ansible
ENV PROJECT_DIR /root
RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR
VOLUME $PROJECT_DIR
ENTRYPOINT [ "ansible-playbook", "-M", "/root", "-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
docker/Dockerfile_opensuse_leap
0 → 100644
View file @
bbbc0591
FROM opensuse:leap
MAINTAINER Ross McDonald <mcdonaldrossc+docker@gmail.com>
RUN zypper -n in ansible
ENV PROJECT_DIR /root
RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR
VOLUME $PROJECT_DIR
ENTRYPOINT [ "ansible-playbook", "-M", "/root", "-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
docker/Dockerfile_ubuntu_trusty
View file @
bbbc0591
...
@@ -15,4 +15,4 @@ RUN mkdir -p $PROJECT_DIR
...
@@ -15,4 +15,4 @@ RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR
WORKDIR $PROJECT_DIR
VOLUME $PROJECT_DIR
VOLUME $PROJECT_DIR
ENTRYPOINT [ "ansible-playbook", "-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
ENTRYPOINT [ "ansible-playbook",
"-M", "/root",
"-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
docker/Dockerfile_ubuntu_wily
View file @
bbbc0591
...
@@ -15,4 +15,4 @@ RUN mkdir -p $PROJECT_DIR
...
@@ -15,4 +15,4 @@ RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR
WORKDIR $PROJECT_DIR
VOLUME $PROJECT_DIR
VOLUME $PROJECT_DIR
ENTRYPOINT [ "ansible-playbook", "-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
ENTRYPOINT [ "ansible-playbook",
"-M", "/root",
"-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
docker/Dockerfile_ubuntu_xenial
View file @
bbbc0591
...
@@ -15,4 +15,4 @@ RUN mkdir -p $PROJECT_DIR
...
@@ -15,4 +15,4 @@ RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR
WORKDIR $PROJECT_DIR
VOLUME $PROJECT_DIR
VOLUME $PROJECT_DIR
ENTRYPOINT [ "ansible-playbook", "-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
ENTRYPOINT [ "ansible-playbook",
"-M", "/root",
"-c", "local", "-e", "is_docker=true", "-i", "localhost," ]
docker/build.sh
View file @
bbbc0591
...
@@ -7,10 +7,14 @@ function err {
...
@@ -7,10 +7,14 @@ function err {
}
}
echo
"Building CentOS containers..."
echo
"Building CentOS containers..."
docker build
-f
Dockerfile_centos_6
-t
ansible
.influxdb.centos.6:latest
.
||
err
"Could not build CentOS 6 container"
docker build
-f
Dockerfile_centos_6
-t
ansible
:centos6
.
||
err
"Could not build CentOS 6 container"
docker build
-f
Dockerfile_centos_7
-t
ansible
.influxdb.centos.7:latest
.
||
err
"Could not build CentOS 6 container"
docker build
-f
Dockerfile_centos_7
-t
ansible
:centos7
.
||
err
"Could not build CentOS 6 container"
echo
"Building Ubuntu containers..."
echo
"Building Ubuntu containers..."
docker build
-f
Dockerfile_ubuntu_trusty
-t
ansible.influxdb.ubuntu.trusty:latest
.
||
err
"Could not build Ubuntu Trusty container"
docker build
-f
Dockerfile_ubuntu_trusty
-t
ansible:ubuntu_trusty
.
||
err
"Could not build Ubuntu Trusty container"
docker build
-f
Dockerfile_ubuntu_wily
-t
ansible.influxdb.ubuntu.wily:latest
.
||
err
"Could not build Ubuntu Wily container"
docker build
-f
Dockerfile_ubuntu_wily
-t
ansible:ubuntu_wily
.
||
err
"Could not build Ubuntu Wily container"
docker build
-f
Dockerfile_ubuntu_xenial
-t
ansible.influxdb.ubuntu.xenial:latest
.
||
err
"Could not build Ubuntu Xenial container"
docker build
-f
Dockerfile_ubuntu_xenial
-t
ansible:ubuntu_xenial
.
||
err
"Could not build Ubuntu Xenial container"
echo
"Building Ubuntu containers..."
docker build
-f
Dockerfile_opensuse_harlequin
-t
ansible:opensuse_harlequin
.
||
err
"Could not build OpenSuse Harlequin container"
docker build
-f
Dockerfile_opensuse_leap
-t
ansible:opensuse_leap
.
||
err
"Could not build OpenSuse Leap container"
run-playbook-in-docker.sh
0 → 100755
View file @
bbbc0591
#!/bin/bash
function
err
{
echo
"ERROR:
$@
"
exit
1
}
current_directory
=
"
$(
pwd
)
"
# Check for Docker
which docker &>/dev/null
||
err
"Docker is required to run Ansible playbooks."
# Validate the Docker image is available (assuming images are named)
docker_image
=
"
$1
"
docker images |
awk
"{ print
\$
1
\"
:
\"
\$
2 }"
|
grep
"
$1
"
&>/dev/null
||
err
"Could not find Docker image:
$docker_image
"
# Create symlinks to previous directory (assumes the influxdb module is in a module directory)
# module_dirs="$(ls -1 ../)"
# echo "Creating symlinks for each folder in '$(dirname $current_directory)' so that Ansible can find them..."
# for dir in ${module_dirs[@]}; do
# test -h ./$dir && err "Stopping due to current directory containing symlink $dir"
# test -d ./$dir && err "Stopping due to current directory containing dir $dir"
# ln -s ../$dir $dir
# done
echo
"Running in Docker:
$@
"
docker run
\
--rm
\
-v
$(
pwd
)
:/root
\
$@
# Remove symlinks so that current directory is clean
# echo "Clearing symlinks..."
# for dir in ${module_dirs[@]}; do rm $dir; done
exit
0
tasks/main.yml
View file @
bbbc0591
...
@@ -13,23 +13,32 @@
...
@@ -13,23 +13,32 @@
register
:
influxdb_started
register
:
influxdb_started
when
:
influxdb_start_service
when
:
influxdb_start_service
-
name
:
Pause to ensure InfluxDB service is up
-
name
:
Wait for InfluxDB to come up
pause
:
wait_for
:
seconds
:
5
host
:
"
{{
influxdb_bind_hostname
|
default(
\"
localhost
\"
,
true)
}}"
port
:
"
{{
influxdb_http_port
}}"
delay
:
5
timeout
:
30
when
:
influxdb_started.changed and influxdb_start_service
when
:
influxdb_started.changed and influxdb_start_service
-
name
:
Collect service status
command
:
service influxdb status
register
:
influxdb_service_status
when
:
influxdb_start_service
ignore_errors
:
yes
ignore_errors
:
yes
register
:
influxdb_start_attempt
-
name
:
Run tail on log
command
:
tail /var/log/influxdb/influxd.log
register
:
influxdb_tail_output
when
:
influxdb_start_attempt.failed is defined and influxdb_start_attempt.failed == True
-
name
:
Show log output
debug
:
msg
:
"
{{
influxdb_tail_output.stdout_lines
}}"
when
:
influxdb_start_attempt.failed is defined and influxdb_start_attempt.failed == True
-
name
:
Assert status of InfluxDB service
-
name
:
Assert status of InfluxDB service
assert
:
assert
:
that
:
that
:
-
"
influxdb_s
ervice_status.rc
==
0"
-
"
influxdb_s
tart_attempt
==
0"
when
:
influxdb_start
_servic
e
when
:
influxdb_start
ed.changed and influxdb_start_service and influxdb_start_attempt.failed is defined and influxdb_start_attempt.failed == Tru
e
-
include
:
demo.yml
-
include
:
demo.yml
tags
:
[
influxdb
,
demo
]
tags
:
[
influxdb
,
demo
]
when
:
influxdb_load_sample_data and influxdb_http_auth_enabled == "false" and influxdb_start_service
when
:
influxdb_load_sample_data and influxdb_http_auth_enabled == "false" and influxdb_start_service
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment