launch_config.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. - fail:
  3. msg: "Ensure that an AMI value is defined for openshift_aws_ami or openshift_aws_launch_config_custom_image."
  4. when:
  5. - openshift_aws_ami is undefined
  6. - name: fetch the security groups for launch config
  7. ec2_group_facts:
  8. filters:
  9. group-name:
  10. - "{{ openshift_aws_clusterid }}" # default sg
  11. - "{{ openshift_aws_clusterid }}_{{ openshift_aws_node_group_type }}" # node type sg
  12. - "{{ openshift_aws_clusterid }}_{{ openshift_aws_node_group_type }}_k8s" # node type sg k8s
  13. region: "{{ openshift_aws_region }}"
  14. register: ec2sgs
  15. # Create the scale group config
  16. - name: Create the node scale group launch config
  17. ec2_lc:
  18. name: "{{ openshift_aws_launch_config_name }}"
  19. region: "{{ openshift_aws_region }}"
  20. image_id: "{{ openshift_aws_ami }}"
  21. instance_type: "{{ openshift_aws_node_group_config[openshift_aws_node_group_type].instance_type }}"
  22. security_groups: "{{ ec2sgs.security_groups | map(attribute='group_id')| list }}"
  23. user_data: |-
  24. #cloud-config
  25. {% if openshift_aws_node_group_type != 'master' %}
  26. write_files:
  27. - path: /root/csr_kubeconfig
  28. owner: root:root
  29. permissions: '0640'
  30. content: {{ openshift_aws_launch_config_bootstrap_token | default('') | to_yaml }}
  31. - path: /root/openshift_settings
  32. owner: root:root
  33. permissions: '0640'
  34. content:
  35. openshift_type: "{{ openshift_aws_node_group_type }}"
  36. runcmd:
  37. - [ systemctl, enable, atomic-openshift-node]
  38. - [ systemctl, start, atomic-openshift-node]
  39. {% endif %}
  40. key_name: "{{ openshift_aws_ssh_key_name }}"
  41. ebs_optimized: False
  42. volumes: "{{ openshift_aws_node_group_config[openshift_aws_node_group_type].volumes }}"
  43. assign_public_ip: True