user_data.j2 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {% if openshift_aws_node_user_data is defined and openshift_aws_node_user_data != '' %}
  2. {{ openshift_aws_node_user_data }}
  3. {% else %}
  4. #cloud-config
  5. write_files:
  6. - path: /root/openshift_bootstrap/openshift_settings.yaml
  7. owner: 'root:root'
  8. permissions: '0640'
  9. content: |
  10. openshift_node_config_name: {%
  11. if l_instance_tags['host-type'] == 'master' %}
  12. node-config-master
  13. {% elif l_instance_tags['host-type'] == 'node' %}
  14. {{ openshift_aws_node_group.node_group_config }}
  15. {% else %}
  16. unset
  17. {% endif %}
  18. {% if l_instance_tags['host-type'] == 'node' %}
  19. - path: /etc/origin/node/bootstrap.kubeconfig
  20. owner: 'root:root'
  21. permissions: '0640'
  22. encoding: b64
  23. content: {{ openshift_aws_launch_config_bootstrap_token | b64encode }}
  24. {% endif %}
  25. runcmd:
  26. {% if openshift_aws_node_run_bootstrap_startup %}
  27. - [ ansible-playbook, /root/openshift_bootstrap/bootstrap.yml]
  28. {% endif %}
  29. {% if l_instance_tags['host-type'] == 'node' %}
  30. {# Restarting systemd-hostnamed ensures that instances will have FQDN
  31. hostnames following network restart. #}
  32. - [ systemctl, restart, systemd-hostnamed]
  33. - [ systemctl, restart, NetworkManager]
  34. - [ systemctl, enable, {% if openshift_deployment_type == 'openshift-enterprise' %}atomic-openshift{% else %}origin{% endif %}-node]
  35. - [ systemctl, start, {% if openshift_deployment_type == 'openshift-enterprise' %}atomic-openshift{% else %}origin{% endif %}-node]
  36. {% endif %}
  37. {% endif %}