static.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ---
  2. - name: Set hostname and ip facts
  3. set_fact:
  4. # Store etcd_hostname and etcd_ip such that they will be available
  5. # in hostvars. Defaults for these variables are set in etcd_common.
  6. etcd_hostname: "{{ etcd_hostname }}"
  7. etcd_ip: "{{ etcd_ip }}"
  8. - name: setup firewall
  9. import_tasks: firewall.yml
  10. # TODO: this task may not be needed with Validate permissions
  11. - name: Ensure etcd datadir exists
  12. file:
  13. path: "{{ etcd_data_dir }}"
  14. state: directory
  15. mode: 0700
  16. - name: Validate permissions on the config dir
  17. file:
  18. path: "{{ etcd_conf_dir }}"
  19. state: directory
  20. mode: 0700
  21. - name: Validate permissions on the static pods dir
  22. file:
  23. path: "/etc/origin/node/pods/"
  24. state: directory
  25. owner: "root"
  26. group: "root"
  27. mode: 0700
  28. - name: Write etcd global config file
  29. template:
  30. src: etcd.conf.j2
  31. dest: "{{ etcd_conf_file }}"
  32. backup: true
  33. - name: Create temp directory for static pods
  34. command: mktemp -d /tmp/openshift-ansible-XXXXXX
  35. register: mktemp
  36. changed_when: false
  37. - name: Prepare etcd static pod
  38. copy:
  39. src: "{{ item }}"
  40. dest: "{{ mktemp.stdout }}"
  41. mode: 0600
  42. with_items:
  43. - etcd.yaml
  44. - name: Update etcd static pod
  45. yedit:
  46. src: "{{ mktemp.stdout }}/{{ item }}"
  47. edits:
  48. - key: spec.containers[0].image
  49. value: "{{ etcd_image }}"
  50. with_items:
  51. - etcd.yaml
  52. - name: Deploy etcd static pod
  53. copy:
  54. remote_src: true
  55. src: "{{ mktemp.stdout }}/{{ item }}"
  56. dest: "/etc/origin/node/pods/"
  57. mode: 0600
  58. with_items:
  59. - etcd.yaml
  60. - name: Remove temp directory
  61. file:
  62. state: absent
  63. name: "{{ mktemp.stdout }}"
  64. changed_when: False