summaryrefslogtreecommitdiffstats
path: root/playbooks/aws/openshift-cluster/install.yml
blob: 86d58a68e5ee95e2f2d10640e302af25ab81dc4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
- name: Setup the vpc and the master node group
  hosts: localhost
  tasks:
  - name: Alert user to variables needed - clusterid
    debug:
      msg: "openshift_aws_clusterid={{ openshift_aws_clusterid | default('default') }}"

  - name: Alert user to variables needed - region
    debug:
      msg: "openshift_aws_region={{ openshift_aws_region | default('us-east-1') }}"

  - name: fetch newly created instances
    ec2_remote_facts:
      region: "{{ openshift_aws_region | default('us-east-1') }}"
      filters:
        "tag:clusterid": "{{ openshift_aws_clusterid | default('default') }}"
        "tag:host-type": master
        instance-state-name: running
    register: instancesout
    retries: 20
    delay: 3
    until: instancesout.instances|length > 0

  - name: add new master to masters group
    add_host:
      groups: "masters,etcd,nodes"
      name: "{{ item.public_ip_address }}"
      hostname: "{{ openshift_aws_clusterid | default('default') }}-master-{{ item.id[:-5] }}"
    with_items: "{{ instancesout.instances }}"

  - name: wait for ssh to become available
    wait_for:
      port: 22
      host: "{{ item.public_ip_address }}"
      timeout: 300
      search_regex: OpenSSH
    with_items: "{{ instancesout.instances }}"

- name: set the master facts for hostname to elb
  hosts: masters
  gather_facts: no
  remote_user: root
  tasks:
  - name: fetch elbs
    ec2_elb_facts:
      region: "{{ openshift_aws_region | default('us-east-1') }}"
      names:
      - "{{ item }}"
    with_items:
    - "{{ openshift_aws_clusterid | default('default') }}-master-external"
    - "{{ openshift_aws_clusterid | default('default') }}-master-internal"
    delegate_to: localhost
    register: elbs

  - debug: var=elbs

  - name: set fact
    set_fact:
      openshift_master_cluster_hostname: "{{ elbs.results[1].elbs[0].dns_name }}"
      osm_custom_cors_origins:
      - "{{ elbs.results[1].elbs[0].dns_name }}"
      - "console.{{ openshift_aws_clusterid | default('default') }}.openshift.com"
      - "api.{{ openshift_aws_clusterid | default('default') }}.openshift.com"
    with_items: "{{ groups['masters'] }}"

- name: normalize groups
  include: ../../byo/openshift-cluster/initialize_groups.yml

- name: run the std_include
  include: ../../common/openshift-cluster/std_include.yml

- name: run the config
  include: ../../common/openshift-cluster/config.yml