123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- ---
- - hosts: localhost
- connection: local
- gather_facts: no
- tasks:
- - name: Require openshift_aws_base_ami
- fail:
- msg: "A base AMI is required for AMI building. Please ensure `openshift_aws_base_ami` is defined."
- when: openshift_aws_base_ami is undefined
- - name: "Alert user to variables needed and their values - {{ item.name }}"
- debug:
- msg: "{{ item.msg }}"
- with_items:
- - name: openshift_aws_clusterid
- msg: "openshift_aws_clusterid={{ openshift_aws_clusterid | default('default') }}"
- - name: openshift_aws_region
- msg: "openshift_aws_region={{ openshift_aws_region | default('us-east-1') }}"
- - name: create an instance and prepare for ami
- include_role:
- name: openshift_aws
- tasks_from: build_ami.yml
- vars:
- openshift_aws_node_group_type: compute
- - name: fetch newly created instances
- ec2_remote_facts:
- region: "{{ openshift_aws_region | default('us-east-1') }}"
- filters:
- "tag:Name": "{{ openshift_aws_base_ami_name | default('ami_base') }}"
- instance-state-name: running
- register: instancesout
- retries: 20
- delay: 3
- until: instancesout.instances|length > 0
- - name: wait for ssh to become available
- wait_for:
- port: 22
- host: "{{ instancesout.instances[0].public_ip_address }}"
- timeout: 300
- search_regex: OpenSSH
- - name: add host to nodes
- add_host:
- groups: nodes
- name: "{{ instancesout.instances[0].public_dns_name }}"
- - hosts: nodes
- gather_facts: False
- tasks:
- - name: set the user to perform installation
- set_fact:
- ansible_ssh_user: "{{ openshift_aws_build_ami_ssh_user | default('root') }}"
- - name: normalize groups
- include: ../../byo/openshift-cluster/initialize_groups.yml
- - name: run the std_include
- include: ../../common/openshift-cluster/evaluate_groups.yml
- - name: run the std_include
- include: ../../common/openshift-cluster/initialize_facts.yml
- - name: run the std_include
- include: ../../common/openshift-cluster/initialize_openshift_repos.yml
- - name: run node config setup
- include: ../../common/openshift-node/setup.yml
- - name: run node config
- include: ../../common/openshift-node/configure_nodes.yml
- - name: Re-enable excluders
- include: ../../common/openshift-node/enable_excluders.yml
- - hosts: localhost
- connection: local
- become: no
- tasks:
- - name: seal the ami
- include_role:
- name: openshift_aws
- tasks_from: seal_ami.yml
- vars:
- openshift_aws_ami_name: "openshift-gi-{{ lookup('pipe', 'date +%Y%m%d%H%M')}}"
|