Browse Source

Update code to reflect review comments

Jhon Honce 10 years ago
parent
commit
90010f6db6
2 changed files with 12 additions and 10 deletions
  1. 7 8
      playbooks/gce/openshift-node/config.yml
  2. 5 2
      roles/openshift_node/tasks/main.yml

+ 7 - 8
playbooks/gce/openshift-node/config.yml

@@ -1,6 +1,7 @@
 - name: "populate oo_hosts_to_config host group if needed"
   hosts: localhost
   gather_facts: no
+
   tasks:
   - name: Evaluate oo_host_group_exp
     add_host: "name={{ item }} groups=oo_hosts_to_config"
@@ -29,17 +30,14 @@
             | oo_collect(attribute='gce_public_ip') }}"
       when: groups['tag_env-host-type-' + oo_env + '-openshift-master'] is defined
 
-- name: "Debug hostvars"
-  hosts: oo_hosts_to_config
-  connection: ssh
-  user: root
-  tasks:
-    - debug: var=hostvars
-
 - name: "Configure instances"
   hosts: oo_hosts_to_config
   connection: ssh
   user: root
+
+  vars:
+    tmp_dir: "/tmp/openshift-{{ 9999 | random }}"
+
   vars_files:
     - vars.yml
   roles:
@@ -51,5 +49,6 @@
         oo_master_ips: "{{ hostvars['localhost'].oo_master_ips | default(['']) }}",
         oo_master_public_ips: "{{ hostvars['localhost'].oo_master_public_ips | default(['']) }}",
         oo_bind_ip: "{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address | default(['']) }}",
-        oo_public_ip: "{{ hostvars[inventory_hostname].ansible_ssh_host }}"
+        oo_public_ip: "{{ hostvars[inventory_hostname].ansible_ssh_host }}",
+        tmp_dir: "{{ tmp_dir }}"
       }

+ 5 - 2
roles/openshift_node/tasks/main.yml

@@ -1,4 +1,5 @@
 ---
+
 # tasks file for openshift_node
 - name: Install OpenShift
   yum: pkg=openshift-node state=installed
@@ -8,13 +9,14 @@
   command: /usr/bin/hostname {{ oo_bind_ip }}
 
 - name: Retrieve OpenShift Master credentials
-  local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh  -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' root@{{ oo_master_public_ips[0] }}:/var/lib/openshift/openshift.local.certificates/admin/ /tmp/openshift
+  local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh  -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' root@{{ oo_master_public_ips[0] }}:/var/lib/openshift/openshift.local.certificates/admin/ {{ tmp_dir }}
   ignore_errors: yes
 
 - file: path=/var/lib/openshift/openshift.local.certificates/admin state=directory
+- file: path={{ tmp_dir }} state=directory
 
 - name: Store OpenShift Master credentials
-  local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh  -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' /tmp/openshift/ root@{{ oo_public_ip }}:/var/lib/openshift/openshift.local.certificates/admin
+  local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh  -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' {{ tmp_dir }}/ root@{{ oo_public_ip }}:/var/lib/openshift/openshift.local.certificates/admin
   ignore_errors: yes
 
 - name: Configure OpenShift Node settings
@@ -36,3 +38,4 @@
 - name: Enable OpenShift
   service: name=openshift-node enabled=yes state=started
 
+- file: name={{ tmp_dir }} state=absent