bootstrap.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. # remove the config file. This comes from openshift_facts
  28. - line: "CONFIG_FILE={{ openshift_node_config_dir }}/bootstrap-node-config.yaml"
  29. regexp: "^CONFIG_FILE=.*"
  30. - name: include aws sysconfig credentials
  31. import_tasks: aws.yml
  32. when: not (openshift_node_use_instance_profiles | default(False))
  33. - name: "disable {{ openshift_service_type }}-node service"
  34. systemd:
  35. name: "{{ item }}"
  36. enabled: no
  37. with_items:
  38. - "{{ openshift_service_type }}-node.service"
  39. - name: Check for RPM generated config marker file .config_managed
  40. stat:
  41. path: /etc/origin/.config_managed
  42. register: rpmgenerated_config
  43. - name: create directories for bootstrapping
  44. file:
  45. state: directory
  46. dest: "{{ item }}"
  47. with_items:
  48. - /root/openshift_bootstrap
  49. - /var/lib/origin/openshift.local.config
  50. - /var/lib/origin/openshift.local.config/node
  51. - "/etc/docker/certs.d/docker-registry.default.svc:5000"
  52. - name: laydown the bootstrap.yml file for on boot configuration
  53. template:
  54. src: bootstrap.yml.j2
  55. dest: /root/openshift_bootstrap/bootstrap.yml
  56. - name: Create a symlink to the node client CA for the docker registry
  57. file:
  58. src: "{{ openshift_node_config_dir }}/client-ca.crt"
  59. dest: "/etc/docker/certs.d/docker-registry.default.svc:5000/node-client-ca.crt"
  60. state: link
  61. force: yes
  62. follow: no
  63. - name: Remove default node-config.yaml to allow bootstrapping config
  64. file:
  65. path: "/etc/origin/node/node-config.yaml"
  66. state: absent
  67. - when: rpmgenerated_config.stat.exists
  68. block:
  69. - name: Remove RPM generated config files if present
  70. file:
  71. path: "/etc/origin/{{ item }}"
  72. state: absent
  73. with_items:
  74. - master
  75. - .config_managed
  76. # with_fileglob doesn't work correctly due to a few issues.
  77. # Could change this to fileglob when it gets fixed.
  78. - name: find all files in /etc/origin/node so we can remove them
  79. find:
  80. path: /etc/origin/node/
  81. register: find_results
  82. - name: Remove everything except the resolv.conf required for node
  83. file:
  84. path: "{{ item.path }}"
  85. state: absent
  86. when:
  87. - "'resolv.conf' not in item.path"
  88. - "'node-dnsmasq.conf' not in item.path"
  89. with_items: "{{ find_results.files }}"