bootstrap.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ---
  2. - name: install needed rpm(s)
  3. package:
  4. name: "{{ item }}"
  5. state: present
  6. with_items: "{{ openshift_node_ami_prep_packages }}"
  7. - name: create the directory for node
  8. file:
  9. state: directory
  10. path: "/etc/systemd/system/{{ openshift_service_type }}-node.service.d"
  11. - name: laydown systemd override
  12. copy:
  13. dest: "/etc/systemd/system/{{ openshift_service_type }}-node.service.d/override.conf"
  14. content: |
  15. [Unit]
  16. After=cloud-init.service
  17. - name: update the sysconfig to have KUBECONFIG
  18. lineinfile:
  19. dest: "/etc/sysconfig/{{ openshift_service_type }}-node"
  20. line: "KUBECONFIG=/root/csr_kubeconfig"
  21. regexp: "^KUBECONFIG=.*"
  22. - name: update the ExecStart to have bootstrap
  23. lineinfile:
  24. dest: "/usr/lib/systemd/system/{{ openshift_service_type }}-node.service"
  25. line: "{% raw %}ExecStart=/usr/bin/openshift start node --bootstrap --kubeconfig=${KUBECONFIG} $OPTIONS{% endraw %}"
  26. regexp: "^ExecStart=.*"
  27. - name: "systemctl enable {{ openshift_service_type }}-node"
  28. systemd:
  29. name: "{{ item }}"
  30. enabled: no
  31. with_items:
  32. - "{{ openshift_service_type }}-node.service"
  33. - "{{ openshift_service_type }}-master.service"
  34. - name: Check for RPM generated config marker file .config_managed
  35. stat:
  36. path: /etc/origin/.config_managed
  37. register: rpmgenerated_config
  38. - when: rpmgenerated_config.stat.exists
  39. block:
  40. - name: Remove RPM generated config files if present
  41. file:
  42. path: "/etc/origin/{{ item }}"
  43. state: absent
  44. with_items:
  45. - master
  46. # with_fileglob doesn't work correctly due to a few issues.
  47. # Could change this to fileglob when it gets fixed.
  48. - name: find all files in /etc/origin/node so we can remove them
  49. find:
  50. path: /etc/origin/node/
  51. register: find_results
  52. - name: Remove everything except the resolv.conf required for node
  53. file:
  54. path: "{{ item.path }}"
  55. state: absent
  56. when: "'resolv.conf' not in item.path or 'node-dnsmasq.conf' not in item.path"
  57. with_items: "{{ find_results.files }}"