-
Notifications
You must be signed in to change notification settings - Fork 20
/
adhoc-deploy-ocp-aws.yml
62 lines (52 loc) · 3.12 KB
/
adhoc-deploy-ocp-aws.yml
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
---
# This playbook requires a file provided to it for vars
# An example of the file exists in inventory/group_vars/openshift-ci-stg
# Needed variables:
# openshift_cluster_base_domain: cloud.stg.ci.centos.org # This is the Route53 delegated zone
# openshift_cluster_name: ocp # sub-domain under base domain that will be the openshift cluster name
# openshift_control_node_instance_type: "m5.xlarge" # EC2 instance type
# openshift_control_node_replicas: 3 # number of control plane nodes
# openshift_control_node_ebs_size: 200 # size in Gigabytes
# openshift_control_node_ebs_type: gp3 # Better throughput than gp2 but less than io1/io2
# openshift_worker_node_instance_type: "m5.xlarge" # ec2 instance type for workers/compute nodes
# openshift_worker_node_replicas: 3 # number of compute ondes
# openshift_worker_node_ebs_size: 200 # size in Gigabytes
# openshift_worker_node_ebs_type: gp3 # Better throughput than gp2 but less than io1/io2
# openshift_install_pull_secret: '' # To be retrieved from https://console.redhat.com/openshift/downloads (limited validity cert)
# openshift_node_ssh_public_key: "ssh-rsa ..." # ssh pub key to login into rhcos nodes
# openshift_ci_access_key: #IAM access key needed to create/deploy resources
# openshift_ci_secret_key: #IAM secret key for access key above
# openshift_build_path: "{{ ansible_env.HOME }}/tmp/ocp-aws-ci-stg" # Tmp and local directory created by openshift-install
# openshift_pvc_machine_network: 172.25.0.0/16 # The large subnet that be splitted in new VPC. Ensure it doesn't overlap for peering/routing/vpn (it will be internal/private in vpc anyway)
#
# Pre-checks:
# It also assumes that an empty Route53 zone exists for {{ openshift_cluster_base_domain }} (to be created first)
# it creates some files locally which should be pushed to the filestore as
# they contain install info needed for the cluster
# how to call it : ansible-playbook playbook/adhoc-deploy-ocp-aws.yml -e '@/path/to/inventory/group_vars/cluster_name'
- hosts: localhost
tasks:
- name: create build directory for deployment artifacts
file:
path: "{{ openshift_build_path }}"
state: directory
mode: 0700
- name: download and extract openshift installer (if needed)
unarchive:
src: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-install-linux.tar.gz
dest: "{{ openshift_build_path }}"
remote_src: yes
creates: "{{ openshift_build_path }}/openshift-install"
- name: create openshift install-config.yaml file
template:
src: "install-config.yaml.j2"
dest: "{{ openshift_build_path }}/install-config.yaml"
- name: backup install-config.yaml file as install-config.yaml.backup
copy:
src: "{{ openshift_build_path }}/install-config.yaml"
dest: "{{ openshift_build_path }}/install-config.yaml.backup"
- name: Run openshift-install cli to deploy cluster
command: "{{ openshift_build_path }}/openshift-install create cluster --dir={{ openshift_build_path }}"
environment:
AWS_ACCESS_KEY: "{{openshift_ci_access_key}}"
AWS_SECRET_ACCESS_KEY: "{{openshift_ci_secret_key}}"