summaryrefslogtreecommitdiffstats
path: root/ansible/test/roles
diff options
context:
space:
mode:
authorSamuli Silvius <s.silvius@partner.samsung.com>2019-04-04 08:22:08 +0300
committerSamuli Silvius <s.silvius@partner.samsung.com>2019-04-17 09:30:59 +0300
commitbb3bef83ca562b9aadc288b3ec46264d73ec73ac (patch)
tree269f5624b39b14cfe249099df11f962147967d0e /ansible/test/roles
parentcceed25e6c773c18e479e246ddeadebc82870f70 (diff)
Molecule tests for rancher role
Issue-ID: OOM-1775 Change-Id: I6ea11db932cd77e03909e4c72acc4b92a544eb4b Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com>
Diffstat (limited to 'ansible/test/roles')
-rw-r--r--ansible/test/roles/cleanup-containers/tasks/main.yml6
-rw-r--r--ansible/test/roles/prepare-common/tasks/main.yml31
2 files changed, 37 insertions, 0 deletions
diff --git a/ansible/test/roles/cleanup-containers/tasks/main.yml b/ansible/test/roles/cleanup-containers/tasks/main.yml
new file mode 100644
index 00000000..3a800c9e
--- /dev/null
+++ b/ansible/test/roles/cleanup-containers/tasks/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Remove containers
+ docker_container:
+ name: "{{ item }}"
+ state: absent
+ loop: "{{ container_list }}"
diff --git a/ansible/test/roles/prepare-common/tasks/main.yml b/ansible/test/roles/prepare-common/tasks/main.yml
new file mode 100644
index 00000000..11dcbe71
--- /dev/null
+++ b/ansible/test/roles/prepare-common/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: Fetch docker host ip
+ block:
+ - name: Get docker host ip to access host where container running (as dood)
+ shell: |
+ set -o pipefail
+ ip route | awk '/default/ { print $3 }'
+ args:
+ executable: /bin/bash
+ register: ip
+ changed_when: false
+
+ - name: "set docker host ip {{ ip.stdout }} for cluster_ip"
+ set_fact:
+ cluster_ip: "{{ ip.stdout }}"
+ when: inventory_hostname != 'localhost'
+
+- name: Set fact for localhost OS
+ block:
+ - name: set localhost fact
+ set_fact:
+ localhost_ansible_os_family: "{{ hostvars['localhost'].ansible_os_family }}"
+
+ - name: debug
+ debug:
+ var: localhost_ansible_os_family
+ when: hostvars['localhost'].ansible_os_family is defined
+
+- name: debug
+ debug:
+ var: ansible_os_family \ No newline at end of file