launch_config.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: query vpc
  7. ec2_vpc_net_facts:
  8. region: "{{ openshift_aws_region }}"
  9. filters:
  10. 'tag:Name': "{{ openshift_aws_vpc_name }}"
  11. register: vpcout
  12. - name: fetch the security groups for launch config
  13. ec2_group_facts:
  14. filters:
  15. group-name: "{{ openshift_aws_launch_config_security_groups }}"
  16. vpc-id: "{{ vpcout.vpcs[0].id }}"
  17. region: "{{ openshift_aws_region }}"
  18. register: ec2sgs
  19. # Create the scale group config
  20. - name: Create the node scale group launch config
  21. ec2_lc:
  22. name: "{{ openshift_aws_launch_config_name }}"
  23. region: "{{ openshift_aws_region }}"
  24. image_id: "{{ openshift_aws_ami }}"
  25. instance_type: "{{ openshift_aws_node_group_config[openshift_aws_node_group_type].instance_type }}"
  26. security_groups: "{{ openshift_aws_launch_config_security_group_id | default(ec2sgs.security_groups | map(attribute='group_id')| list) }}"
  27. user_data: |-
  28. #cloud-config
  29. {% if openshift_aws_node_group_type != 'master' %}
  30. write_files:
  31. - path: /root/csr_kubeconfig
  32. owner: root:root
  33. permissions: '0640'
  34. content: {{ openshift_aws_launch_config_bootstrap_token | default('') | to_yaml }}
  35. - path: /root/openshift_settings
  36. owner: root:root
  37. permissions: '0640'
  38. content:
  39. openshift_type: "{{ openshift_aws_node_group_type }}"
  40. runcmd:
  41. - [ systemctl, enable, atomic-openshift-node]
  42. - [ systemctl, start, atomic-openshift-node]
  43. {% endif %}
  44. key_name: "{{ openshift_aws_ssh_key_name }}"
  45. ebs_optimized: False
  46. volumes: "{{ openshift_aws_node_group_config[openshift_aws_node_group_type].volumes }}"
  47. assign_public_ip: True