summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
authorMaciej Skrocki <maciej.skrocki@intel.com>2017-09-01 15:33:53 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-09-05 00:00:01 -0700
commita691427480c3a8cad60b275d47d7ddbde1c26f64 (patch)
tree0c4474ebe7bfa260c94cfddd4e53c3f688333a16 /ansible/roles
parent22dfb4fcb474ac201a22c5b3ce3c34baec641f9d (diff)
Introduced ansible playbook to setup NSB.
Change-Id: I5865cd50d5fde26e9e9fc265d4385372d668413f Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/docker/defaults/main.yml15
-rw-r--r--ansible/roles/docker/handlers/main.yml20
-rw-r--r--ansible/roles/docker/tasks/Debian.yml26
-rw-r--r--ansible/roles/docker/tasks/RedHat.yml20
-rw-r--r--ansible/roles/docker/tasks/main.yml31
-rw-r--r--ansible/roles/docker/templates/RedHat-repos.j27
-rw-r--r--ansible/roles/docker/templates/http-proxy-conf.j22
-rw-r--r--ansible/roles/docker/vars/main.yml20
-rwxr-xr-xansible/roles/install_dependencies/tasks/Debian.yml1
-rw-r--r--ansible/roles/install_image_dependencies/defaults/main.yml2
10 files changed, 141 insertions, 3 deletions
diff --git a/ansible/roles/docker/defaults/main.yml b/ansible/roles/docker/defaults/main.yml
new file mode 100644
index 000000000..e961969a4
--- /dev/null
+++ b/ansible/roles/docker/defaults/main.yml
@@ -0,0 +1,15 @@
+# Copyright (c) 2017 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+ubuntu_docker_url: https://apt.dockerproject.org/repo
diff --git a/ansible/roles/docker/handlers/main.yml b/ansible/roles/docker/handlers/main.yml
new file mode 100644
index 000000000..5e6556031
--- /dev/null
+++ b/ansible/roles/docker/handlers/main.yml
@@ -0,0 +1,20 @@
+# Copyright (c) 2017 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+ - name: systemd daemon reload
+ command: systemctl daemon-reload
+
+ - name: restart docker
+ service: name=docker state=restarted
+
diff --git a/ansible/roles/docker/tasks/Debian.yml b/ansible/roles/docker/tasks/Debian.yml
new file mode 100644
index 000000000..cf4128774
--- /dev/null
+++ b/ansible/roles/docker/tasks/Debian.yml
@@ -0,0 +1,26 @@
+# Copyright (c) 2017 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+ - name: add Ubuntu docker repo
+ apt_repository: repo='deb [trusted=yes] {{ ubuntu_docker_url }} ubuntu-{{ ansible_distribution_release }} main' state=present
+
+ - name: ensure correct docker version
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes"
+ with_items: "{{ docker_packages[ansible_os_family] }}"
+
+ - name: remove Ubuntu docker repo
+ apt_repository:
+ repo: 'deb [trusted=yes] {{ ubuntu_docker_url }} ubuntu-{{ ansible_distribution_release }} main'
+ state: absent
+ update_cache: no
diff --git a/ansible/roles/docker/tasks/RedHat.yml b/ansible/roles/docker/tasks/RedHat.yml
new file mode 100644
index 000000000..2261da3de
--- /dev/null
+++ b/ansible/roles/docker/tasks/RedHat.yml
@@ -0,0 +1,20 @@
+# Copyright (c) 2017 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+ - name: bootstrap docker project repos
+ template: "src={{ ansible_os_family }}-repos.j2 dest=/etc/yum.repos.d/docker.repo"
+
+ - name: ensure correct docker version
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: "{{ docker_packages[ansible_os_family] }}"
diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml
new file mode 100644
index 000000000..bbec371a8
--- /dev/null
+++ b/ansible/roles/docker/tasks/main.yml
@@ -0,0 +1,31 @@
+# Copyright (c) 2017 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+ - name: Install docker
+ include: "{{ ansible_os_family }}.yml"
+
+ - name: create docker service config dir
+ file: path=/etc/systemd/system/docker.service.d state=directory
+
+ - name: create docker proxy config
+ template: src=http-proxy-conf.j2 dest=/etc/systemd/system/docker.service.d/http-proxy.conf owner=root mode=0644
+ when: 'proxy_env is defined and "http_proxy" in proxy_env or "https_proxy" in proxy_env'
+ notify:
+ - systemd daemon reload
+ - restart docker
+
+ - name: start docker service
+ service: name=docker state=started enabled=yes
+
+ - meta: flush_handlers
diff --git a/ansible/roles/docker/templates/RedHat-repos.j2 b/ansible/roles/docker/templates/RedHat-repos.j2
new file mode 100644
index 000000000..6d367408c
--- /dev/null
+++ b/ansible/roles/docker/templates/RedHat-repos.j2
@@ -0,0 +1,7 @@
+[dockerrepo]
+name=Docker Repository
+# $releasever for RHEL 7 is '7Server' so we can't use $releasever
+baseurl={{ docker_project_url }}/repo/main/{{ ansible_distribution|lower|regex_replace('redhat', 'centos') }}/{{ ansible_distribution_major_version }}/
+enabled=1
+gpgcheck=1
+gpgkey={{ docker_project_url }}/gpg
diff --git a/ansible/roles/docker/templates/http-proxy-conf.j2 b/ansible/roles/docker/templates/http-proxy-conf.j2
new file mode 100644
index 000000000..854ddfe09
--- /dev/null
+++ b/ansible/roles/docker/templates/http-proxy-conf.j2
@@ -0,0 +1,2 @@
+[Service]
+Environment={% if "http_proxy" in proxy_env %}"HTTP_PROXY={{ proxy_env.http_proxy }}" {% endif %} {% if "https_proxy" in proxy_env %} "HTTPS_PROXY={{ proxy_env.https_proxy }}" {% endif %} {% if "http_proxy" in proxy_env or "https_proxy" in proxy_env %} "NO_PROXY=localhost,127.0.0.0/8" {% endif %}
diff --git a/ansible/roles/docker/vars/main.yml b/ansible/roles/docker/vars/main.yml
new file mode 100644
index 000000000..8b5077490
--- /dev/null
+++ b/ansible/roles/docker/vars/main.yml
@@ -0,0 +1,20 @@
+# Copyright (c) 2017 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+docker_project_url: https://yum.dockerproject.org
+docker_packages:
+ "RedHat":
+ - docker-engine-1.13.1
+ "Debian":
+ - docker-engine=1.13.1*
diff --git a/ansible/roles/install_dependencies/tasks/Debian.yml b/ansible/roles/install_dependencies/tasks/Debian.yml
index 0047a5e3b..7a9911ebf 100755
--- a/ansible/roles/install_dependencies/tasks/Debian.yml
+++ b/ansible/roles/install_dependencies/tasks/Debian.yml
@@ -47,4 +47,3 @@
- uwsgi-plugin-python
- supervisor
- python-setuptools
-
diff --git a/ansible/roles/install_image_dependencies/defaults/main.yml b/ansible/roles/install_image_dependencies/defaults/main.yml
index b1695e278..1540806cc 100644
--- a/ansible/roles/install_image_dependencies/defaults/main.yml
+++ b/ansible/roles/install_image_dependencies/defaults/main.yml
@@ -13,9 +13,7 @@ install_dependencies:
- iproute2
- linux-tools-common
- linux-tools-generic
- - lmbench
- make
- - netperf
- patch
- perl
- rt-tests