bootstrap.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ---
  2. - name: include package installs
  3. import_tasks: install_rpms.yml
  4. when: not (openshift_is_atomic | default(False) | bool)
  5. - name: create the directory for node
  6. file:
  7. state: directory
  8. path: "/etc/systemd/system/{{ openshift_service_type }}-node.service.d"
  9. when: '"cloud-init" in r_openshift_node_image_prep_packages'
  10. - name: laydown systemd override
  11. copy:
  12. dest: "/etc/systemd/system/{{ openshift_service_type }}-node.service.d/override.conf"
  13. content: |
  14. [Unit]
  15. After=cloud-init.service
  16. when: '"cloud-init" in r_openshift_node_image_prep_packages'
  17. - name: update the sysconfig to have necessary variables
  18. lineinfile:
  19. dest: "/etc/sysconfig/{{ openshift_service_type }}-node"
  20. line: "{{ item.line | default(omit) }}"
  21. regexp: "{{ item.regexp }}"
  22. state: "{{ item.state | default('present') }}"
  23. with_items:
  24. # add the kubeconfig
  25. - line: "KUBECONFIG={{ openshift_node_config_dir }}/bootstrap.kubeconfig"
  26. regexp: "^KUBECONFIG=.*"
  27. - name: include aws sysconfig credentials
  28. import_tasks: aws.yml
  29. when: not (openshift_node_use_instance_profiles | default(False))
  30. - name: "disable {{ openshift_service_type }}-node service"
  31. systemd:
  32. name: "{{ item }}"
  33. enabled: no
  34. with_items:
  35. - "{{ openshift_service_type }}-node.service"
  36. - name: Check for RPM generated config marker file .config_managed
  37. stat:
  38. path: /etc/origin/.config_managed
  39. register: rpmgenerated_config
  40. - name: create directories for bootstrapping
  41. file:
  42. state: directory
  43. dest: "{{ item }}"
  44. with_items:
  45. - /root/openshift_bootstrap
  46. - /var/lib/origin/openshift.local.config
  47. - /var/lib/origin/openshift.local.config/node
  48. - "/etc/docker/certs.d/docker-registry.default.svc:5000"
  49. - name: laydown the bootstrap.yml file for on boot configuration
  50. template:
  51. src: bootstrap.yml.j2
  52. dest: /root/openshift_bootstrap/bootstrap.yml
  53. - name: Create a symlink to the node client CA for the docker registry
  54. file:
  55. src: "{{ openshift_node_config_dir }}/client-ca.crt"
  56. dest: "/etc/docker/certs.d/docker-registry.default.svc:5000/node-client-ca.crt"
  57. state: link
  58. force: yes
  59. follow: no
  60. - when: rpmgenerated_config.stat.exists
  61. block:
  62. - name: Remove RPM generated config files if present
  63. file:
  64. path: "/etc/origin/{{ item }}"
  65. state: absent
  66. with_items:
  67. - master
  68. - .config_managed
  69. # with_fileglob doesn't work correctly due to a few issues.
  70. # Could change this to fileglob when it gets fixed.
  71. - name: find all files in /etc/origin/node so we can remove them
  72. find:
  73. path: /etc/origin/node/
  74. register: find_results
  75. - name: Remove everything except the resolv.conf required for node
  76. file:
  77. path: "{{ item.path }}"
  78. state: absent
  79. when:
  80. - "'resolv.conf' not in item.path"
  81. - "'node-dnsmasq.conf' not in item.path"
  82. with_items: "{{ find_results.files }}"