aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/barometer_collectd/tasks/main.yaml40
-rw-r--r--ansible/roles/docker/tasks/Debian.yml16
-rw-r--r--ansible/roles/enable_iommu_on_boot/tasks/main.yml54
-rw-r--r--ansible/roles/enable_iommu_on_boot/tasks/manual_modify_grub.yml12
-rw-r--r--ansible/roles/enable_iommu_on_boot/vars/main.yml4
5 files changed, 93 insertions, 33 deletions
diff --git a/ansible/roles/barometer_collectd/tasks/main.yaml b/ansible/roles/barometer_collectd/tasks/main.yaml
new file mode 100644
index 000000000..c06540c3f
--- /dev/null
+++ b/ansible/roles/barometer_collectd/tasks/main.yaml
@@ -0,0 +1,40 @@
+#Copyright 2018 OPNFV and 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: Remove barometer-collectd container
+ docker_container:
+ name: barometer-collectd
+ state: absent
+
+- name: Remove barometer-collectd image
+ docker_image:
+ name: opnfv/barometer-collectd
+ state: absent
+
+- name: Prepare collectd container
+ docker_container:
+ name: barometer-collectd
+ image: opnfv/barometer-collectd
+ volumes:
+ - /opt/collectd/etc/collectd.conf.d/:/opt/collectd/etc/collectd.conf.d
+ - /var/run:/var/run
+ - /tmp:/tmp
+ - /var/lib/collectd:/var/lib/collectd
+ command: "/run_collectd.sh"
+ detach: yes
+ state: present
+ restart: no
+ privileged: yes
+ network_mode: host
diff --git a/ansible/roles/docker/tasks/Debian.yml b/ansible/roles/docker/tasks/Debian.yml
index 7f998de45..a03040d88 100644
--- a/ansible/roles/docker/tasks/Debian.yml
+++ b/ansible/roles/docker/tasks/Debian.yml
@@ -14,3 +14,19 @@
---
- name: Install docker.io
action: "{{ ansible_pkg_mgr }} name=docker.io state=present force=yes"
+
+ - name: Update package manager cache
+ tags:
+ - cache_update
+ package:
+ update_cache: yes
+
+ - name: Install python-pip
+ package:
+ name: python-pip
+ state: present
+
+ - name: Install docker-py
+ pip:
+ name: docker-py
+ state: present
diff --git a/ansible/roles/enable_iommu_on_boot/tasks/main.yml b/ansible/roles/enable_iommu_on_boot/tasks/main.yml
index 1b98a50b1..e406fcc1e 100644
--- a/ansible/roles/enable_iommu_on_boot/tasks/main.yml
+++ b/ansible/roles/enable_iommu_on_boot/tasks/main.yml
@@ -1,4 +1,4 @@
-# Copyright (c) 2017 Intel Corporation
+# Copyright (c) 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,41 +22,45 @@
iommu_boot_params: ' amd_iommu=on iommu=pt'
when: hostvars[inventory_hostname]['ansible_system_vendor'] == "AuthenticAMD"
-- name: Set facts for this role
+- name: Define grub string for IOMMU
set_fact:
- hugepages_help_string: ' # added by hugepages role'
- iommu_help_string: ', added by iommu role'
- hugepages_params: " default_hugepagesz=1G hugepagesz=1G hugepages=8"
- iommu_original_kernel_params: 'GRUB_CMDLINE_LINUX="\$GRUB_CMDLINE_LINUX{{ hugepages_params }}'
- iommu_enabled_kernel_params: '{{ iommu_original_kernel_params }}{{ iommu_boot_params }}"'
- iommu_enabled_kernel_params_with_help: '{{ iommu_original_kernel_params }}{{ iommu_boot_params }}"{{ hugepages_help_string }}{{ iommu_help_string }}'
+ enable_iommu: 'GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX{{ iommu_boot_params }}'
-- name: check if iommu is set by this role in /etc/default/grub
+- name: check if iommu is set by this role in {{ grub_file}}
lineinfile:
- path: /etc/default/grub
- line: '{{ iommu_enabled_kernel_params_with_help }}'
- #changed_when: no
+ path: "{{ grub_file}}"
+ regexp: '{{ iommu_help_string }}'
+ line: '{{ iommu_help_string }}'
+ state: absent
check_mode: yes
- register: is_mine_iommu_etc_grub
+ register: is_nsb_iommu_role
ignore_errors: True
-- name: check if iommu is set by someone else
- command: "grep -o 'iommu' /etc/default/grub"
+- name: Check if IOMMU is set by someone else
+ lineinfile:
+ path: "{{ grub_file}}"
+ regexp: "_iommu="
+ line: '{{ iommu_help_string }}'
+ state: absent
+ check_mode: yes
register: is_iommu
ignore_errors: True
-- fail:
- msg: "Iommu already set by someone else"
- when: is_mine_iommu_etc_grub.changed == false and is_iommu.stdout != ""
+- name: Send info that IOMMU is configured by someone else
+ debug:
+ msg: "INFO: NOT modified, IOMMU is already configured by someone."
+ when:
+ - not is_nsb_iommu_role.changed
+ - is_iommu.changed
-- name: 'Configure iommu in /etc/default/grub'
-# and /boot/grub/grub.cfg(when: ansible_distribution == "Ubuntu")'
+- name: Add IOMMU when it is not set
lineinfile:
- path: /etc/default/grub
- regexp: '({{ iommu_original_kernel_params }})"{{ hugepages_help_string }}'
- line: '\1{{ iommu_boot_params }}"{{ hugepages_help_string }}{{ iommu_help_string }}'
- backrefs: yes
- when: is_mine_iommu_etc_grub.changed == true
+ path: "{{ grub_file }}"
+ regexp: "{{ iommu_help_string }}"
+ line: '{{ enable_iommu }}" {{ iommu_help_string }}'
+ when:
+ - not is_nsb_iommu_role.changed
+ - not is_iommu.changed
- name: find boot grub.cfg
find:
diff --git a/ansible/roles/enable_iommu_on_boot/tasks/manual_modify_grub.yml b/ansible/roles/enable_iommu_on_boot/tasks/manual_modify_grub.yml
index 6760c3f9d..e0c880912 100644
--- a/ansible/roles/enable_iommu_on_boot/tasks/manual_modify_grub.yml
+++ b/ansible/roles/enable_iommu_on_boot/tasks/manual_modify_grub.yml
@@ -1,4 +1,4 @@
-# Copyright (c) 2017 Intel Corporation
+# Copyright (c) 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,14 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
-
-
- name: check if iommu is set by this role in /boot grub.cfg files
lineinfile:
path: "{{ item.path }}"
- regexp: '{{ hugepages_params }}{{ iommu_boot_params }}'
- line: ''
- #changed_when: no
+ regexp: '{{ iommu_boot_params }}'
+ line: '{{ iommu_boot_params }}'
+ state: absent
check_mode: yes
register: is_mine_iommu_boot_grub
ignore_errors: True
@@ -29,6 +27,6 @@
path: "{{ item.path }}"
regexp: '(.*linux\s+/boot/vmlinuz.*)$'
replace: '\1{{ iommu_boot_params }}'
- when: is_mine_iommu_boot_grub.msg != "line replaced"
+ when: not is_mine_iommu_boot_grub.changed
- debug: var=ansible_kernel
diff --git a/ansible/roles/enable_iommu_on_boot/vars/main.yml b/ansible/roles/enable_iommu_on_boot/vars/main.yml
index 1b642dcb5..d2575ffd6 100644
--- a/ansible/roles/enable_iommu_on_boot/vars/main.yml
+++ b/ansible/roles/enable_iommu_on_boot/vars/main.yml
@@ -1,4 +1,4 @@
-# Copyright (c) 2017 Intel Corporation
+# Copyright (c) 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
+grub_file: "/etc/default/grub"
+iommu_help_string: ' # added by Yardstick ansible iommu role'
update_grub:
Debian: "update-grub2"
RedHat: "grub2-mkconfig -o /boot/grub2/grub.cfg"