summaryrefslogtreecommitdiffstats
path: root/playbooks/aws/openshift-cluster/accept.yml
blob: ffc367f9f53a3578b234e0b43d6f4b7e92885854 (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
#!/usr/bin/ansible-playbook
---
- name: Setup the vpc and the master node group
  hosts: localhost
  remote_user: root
  gather_facts: no
  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: bring lib_openshift into scope
    include_role:
      name: lib_openshift

  - name: fetch masters
    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: mastersout
    retries: 20
    delay: 3
    until: "'instances' in mastersout and mastersout.instances|length > 0"

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

  - debug:
      msg: "{{ instancesout.instances|map(attribute='private_dns_name') | list | regex_replace('.ec2.internal') }}"

  - name: approve nodes
    oc_adm_csr:
      #approve_all: True
      nodes: "{{ instancesout.instances|map(attribute='private_dns_name') | list | regex_replace('.ec2.internal') }}"
      timeout: 0
    register: nodeout
    delegate_to: "{{ mastersout.instances[0].public_ip_address }}"