bootstrap.yml 3.0 KB

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