summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter_plugins/oo_filters.py5
-rw-r--r--playbooks/adhoc/uninstall.yml4
-rw-r--r--playbooks/common/openshift-node/config.yml1
-rw-r--r--roles/etcd_ca/tasks/main.yml15
-rw-r--r--roles/openshift_manage_node/tasks/main.yml40
-rw-r--r--roles/openshift_manageiq/tasks/main.yaml4
6 files changed, 54 insertions, 15 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 053de7703..7b241e203 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -16,6 +16,7 @@ import pkg_resources
import re
import json
import yaml
+from ansible.parsing.yaml.dumper import AnsibleDumper
from ansible.utils.unicode import to_unicode
from urlparse import urlparse
@@ -621,7 +622,9 @@ class FilterModule(object):
return ""
try:
- transformed = yaml.safe_dump(data, indent=indent, allow_unicode=True, default_flow_style=False, **kw)
+ transformed = yaml.dump(data, indent=indent, allow_unicode=True,
+ default_flow_style=False,
+ Dumper=AnsibleDumper, **kw)
padded = "\n".join([" " * level * indent + line for line in transformed.splitlines()])
return to_unicode("\n{0}".format(padded))
except Exception as my_e:
diff --git a/playbooks/adhoc/uninstall.yml b/playbooks/adhoc/uninstall.yml
index ae4316f86..30e0f05fd 100644
--- a/playbooks/adhoc/uninstall.yml
+++ b/playbooks/adhoc/uninstall.yml
@@ -346,8 +346,12 @@
- /etc/etcd
- /etc/systemd/system/etcd_container.service
+ # Intenationally using rm command over file module because if someone had mounted a filesystem
+ # at /var/lib/etcd then the contents was not removed correctly
- name: Remove etcd data
shell: rm -rf /var/lib/etcd/*
+ args:
+ warn: no
failed_when: false
- hosts: lb
diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml
index e7c7ffb38..94c30e268 100644
--- a/playbooks/common/openshift-node/config.yml
+++ b/playbooks/common/openshift-node/config.yml
@@ -159,7 +159,6 @@
openshift_nodes: "{{ hostvars
| oo_select_keys(groups['oo_nodes_to_config'])
| oo_collect('openshift.common.hostname') }}"
- openshift_node_vars: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']) }}"
pre_tasks:
# Necessary because when you're on a node that's also a master the master will be
# restarted after the node restarts docker and it will take up to 60 seconds for
diff --git a/roles/etcd_ca/tasks/main.yml b/roles/etcd_ca/tasks/main.yml
index 865074e41..4e68bc962 100644
--- a/roles/etcd_ca/tasks/main.yml
+++ b/roles/etcd_ca/tasks/main.yml
@@ -38,9 +38,18 @@
delegate_to: "{{ etcd_ca_host }}"
run_once: true
-- command: touch {{ etcd_ca_db }}
- args:
- creates: "{{ etcd_ca_db }}"
+- name: Check etcd_ca_db exist
+ stat: path="{{ etcd_ca_db }}"
+ register: etcd_ca_db_check
+ changed_when: false
+ delegate_to: "{{ etcd_ca_host }}"
+ run_once: true
+
+- name: Touch etcd_ca_db file
+ file:
+ path: "{{ etcd_ca_db }}"
+ state: touch
+ when: etcd_ca_db_check.stat.isreg is not defined
delegate_to: "{{ etcd_ca_host }}"
run_once: true
diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml
index 5abac32cd..f999092cc 100644
--- a/roles/openshift_manage_node/tasks/main.yml
+++ b/roles/openshift_manage_node/tasks/main.yml
@@ -1,6 +1,22 @@
+---
+- name: Create temp directory for kubeconfig
+ command: mktemp -d /tmp/openshift-ansible-XXXXXX
+ register: mktemp
+ changed_when: False
+
+- set_fact:
+ openshift_manage_node_kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
+
+- name: Copy the admin client config(s)
+ command: >
+ cp {{ openshift.common.config_base }}/master/admin.kubeconfig {{ openshift_manage_node_kubeconfig }}
+ changed_when: False
+
- name: Wait for Node Registration
command: >
- {{ openshift.common.client_binary }} get node {{ item | lower }}
+ {{ openshift.common.client_binary }} get node {{ item | lower }}
+ --config={{ openshift_manage_node_kubeconfig }}
+ -n default
register: omd_get_node
until: omd_get_node.rc == 0
retries: 50
@@ -10,14 +26,24 @@
- name: Set node schedulability
command: >
- {{ openshift.common.admin_binary }} manage-node {{ item.openshift.common.hostname | lower }} --schedulable={{ 'true' if item.openshift.node.schedulable | bool else 'false' }}
+ {{ openshift.common.admin_binary }} manage-node {{ hostvars[item].openshift.common.hostname | lower }} --schedulable={{ 'true' if hostvars[item].openshift.node.schedulable | bool else 'false' }}
+ --config={{ openshift_manage_node_kubeconfig }}
+ -n default
with_items:
- - "{{ openshift_node_vars }}"
- when: item.openshift.common.hostname is defined
+ - "{{ openshift_nodes }}"
+ when: hostvars[item].openshift.common.hostname is defined
- name: Label nodes
command: >
- {{ openshift.common.client_binary }} label --overwrite node {{ item.openshift.common.hostname | lower }} {{ item.openshift.node.labels | oo_combine_dict }}
+ {{ openshift.common.client_binary }} label --overwrite node {{ hostvars[item].openshift.common.hostname | lower }} {{ hostvars[item].openshift.node.labels | oo_combine_dict }}
+ --config={{ openshift_manage_node_kubeconfig }}
+ -n default
with_items:
- - "{{ openshift_node_vars }}"
- when: item.openshift.common.hostname is defined and 'labels' in item.openshift.node and item.openshift.node.labels != {}
+ - "{{ openshift_nodes }}"
+ when: hostvars[item].openshift.common.hostname is defined and 'labels' in hostvars[item].openshift.node and hostvars[item].openshift.node.labels != {}
+
+- name: Delete temp directory
+ file:
+ name: "{{ mktemp.stdout }}"
+ state: absent
+ changed_when: False
diff --git a/roles/openshift_manageiq/tasks/main.yaml b/roles/openshift_manageiq/tasks/main.yaml
index de0a7000e..5d7a3c038 100644
--- a/roles/openshift_manageiq/tasks/main.yaml
+++ b/roles/openshift_manageiq/tasks/main.yaml
@@ -70,6 +70,4 @@
when: openshift.common.version_gte_3_2_or_1_2 | bool
- name: Clean temporary configuration file
- command: >
- rm -f {{manage_iq_tmp_conf}}
- changed_when: false
+ file: path={{manage_iq_tmp_conf}} state=absent