main.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132
  1. ---
  2. - name: validate role inputs
  3. fail:
  4. msg: Please pass in the required role variables
  5. when:
  6. - r_openshift_aws_node_group_clusterid is not defined
  7. - r_openshift_aws_node_group_region is not defined
  8. - r_openshift_aws_node_group_subnet_name is not defined
  9. - name: fetch the subnet to use in scale group
  10. ec2_vpc_subnet_facts:
  11. region: "{{ r_openshift_aws_node_group_region }}"
  12. filters:
  13. "tag:Name": "{{ r_openshift_aws_node_group_subnet_name }}"
  14. register: subnetout
  15. - name: Create the scale group
  16. ec2_asg:
  17. name: "{{ r_openshift_aws_node_group_name }}"
  18. launch_config_name: "{{ r_openshift_aws_node_group_lc_name }}"
  19. health_check_period: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].health_check.period }}"
  20. health_check_type: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].health_check.type }}"
  21. min_size: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].min_size }}"
  22. max_size: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].max_size }}"
  23. desired_capacity: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].desired_size }}"
  24. region: "{{ r_openshift_aws_node_group_region }}"
  25. termination_policies: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].termination_policy if 'termination_policy' in r_openshift_aws_node_group_config[r_openshift_aws_node_group_type] else omit }}"
  26. load_balancers: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].elbs if 'elbs' in r_openshift_aws_node_group_config[r_openshift_aws_node_group_type] else omit }}"
  27. wait_for_instances: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].wait_for_instances | default(False)}}"
  28. vpc_zone_identifier: "{{ subnetout.subnets[0].id }}"
  29. tags:
  30. - "{{ r_openshift_aws_node_group_config.tags | combine(r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].tags) }}"