From 16ab19a24e6e2122f3f1b8f229b8bb20c88045cd Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Tue, 17 Feb 2015 10:07:09 -0700 Subject: * Use hostname module * Use mktemp for scratch directory --- playbooks/gce/openshift-node/config.yml | 7 +---- roles/openshift_node/files/sysconfig/kubeconfig | 40 ------------------------- roles/openshift_node/tasks/main.yml | 13 ++++---- 3 files changed, 9 insertions(+), 51 deletions(-) delete mode 100644 roles/openshift_node/files/sysconfig/kubeconfig diff --git a/playbooks/gce/openshift-node/config.yml b/playbooks/gce/openshift-node/config.yml index 10016463b..c9cacbc63 100644 --- a/playbooks/gce/openshift-node/config.yml +++ b/playbooks/gce/openshift-node/config.yml @@ -34,10 +34,6 @@ hosts: oo_hosts_to_config connection: ssh user: root - - vars: - tmp_dir: "/tmp/openshift-{{ 9999 | random }}" - vars_files: - vars.yml roles: @@ -49,6 +45,5 @@ 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 }}", - tmp_dir: "{{ tmp_dir }}" + oo_public_ip: "{{ hostvars[inventory_hostname].ansible_ssh_host }}" } diff --git a/roles/openshift_node/files/sysconfig/kubeconfig b/roles/openshift_node/files/sysconfig/kubeconfig deleted file mode 100644 index 81e660ae4..000000000 --- a/roles/openshift_node/files/sysconfig/kubeconfig +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - api-version: v1beta1 - server: http://cow.org:8080 - name: cow-cluster -- cluster: - certificate-authority: path/to/my/cafile - server: https://horse.org:4443 - name: horse-cluster -- cluster: - insecure-skip-tls-verify: true - server: https://pig.org:443 - name: pig-cluster -contexts: -- context: - cluster: horse-cluster - namespace: chisel-ns - user: green-user - name: federal-context -- context: - cluster: pig-cluster - namespace: saw-ns - user: black-user - name: queen-anne-context -current-context: federal-context -kind: Config -preferences: - colors: true -users: -- name: black-user - user: - auth-path: path/to/my/existing/.kubernetes_auth_file -- name: blue-user - user: - token: blue-token -- name: green-user - user: - client-certificate: path/to/my/client/cert - client-key: path/to/my/client/key diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 73383da2c..f1b2e9ac0 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -6,17 +6,20 @@ # fixme: Once openshift stops resolving hostnames for node queries remove this... - name: Set hostname to IP Addr (WORKAROUND) - command: /usr/bin/hostname {{ oo_bind_ip }} + hostname: name={{ oo_bind_ip }} + +- local_action: command /usr/bin/mktemp -d /tmp/openshift-ansible-XXXXXXX + register: mktemp - 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_dir }} + 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/ {{ mktemp.stdout }} ignore_errors: yes - file: path=/var/lib/openshift/openshift.local.certificates/admin state=directory -- file: path={{ tmp_dir }} state=directory +- file: path={{ mktemp.stdout }} 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_dir }}/ 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' {{ mktemp.stdout }}/ root@{{ oo_public_ip }}:/var/lib/openshift/openshift.local.certificates/admin ignore_errors: yes - name: Configure OpenShift Node settings @@ -38,4 +41,4 @@ - name: Enable OpenShift service: name=openshift-node enabled=yes state=started -- file: name={{ tmp_dir }} state=absent +- file: name={{ mktemp.stdout }} state=absent -- cgit v1.2.3