Guillaume Coré
2018-12-17 41fa25300bd852bda74e9196b1c36a81f36382ba
upgrade openshift/installer to 0.7.0 in OCP4

- Environment variables are no more possible, generate and use install-config.yml
- use target dir (like for multiple deployments)
1 files added
3 files modified
90 ■■■■■ changed files
ansible/configs/ocp4-coreos-deployer/destroy_env.yml 23 ●●●● patch | view | raw | blame | history
ansible/configs/ocp4-coreos-deployer/env_vars.yml 2 ●●● patch | view | raw | blame | history
ansible/configs/ocp4-coreos-deployer/files/install-config.yml.j2 26 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp4-coreos-deployer/software.yml 39 ●●●● patch | view | raw | blame | history
ansible/configs/ocp4-coreos-deployer/destroy_env.yml
@@ -40,21 +40,20 @@
        src: /tmp/home.tar.gz
        dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}_{{ guid }}_user_home.tar.gz"
    - name: destroy terraform resources
      command: openshift-install destroy cluster
    - name: destroy terraform resources (target directory)
      command: openshift-install destroy cluster --dir=/home/{{ ansible_user }}/cluster-{{ guid }}/
      register: destroyr
    - name: Save output to output_dir
      copy:
        content: "{{ destroyr.stdout }}"
        dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}-{{ guid }}.destroy-cluster.stdout.log"
      delegate_to: localhost
    - name: Pack an archive of everything
      archive:
        path: /home/{{ansible_user}}/cluster-{{ guid }}
        dest: /tmp/cluster-{{ guid }}.tar.gz
    - name: Save stderr to output_dir
      copy:
        content: "{{ destroyr.stderr }}"
        dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}-{{ guid }}.destroy-cluster.stderr.log"
      delegate_to: localhost
    - fetch:
        flat: yes
        src: /tmp/cluster-{{ guid }}.tar.gz
        dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}_{{ guid }}_cluster-{{ guid }}.tar.gz"
- name: Delete ocp4 provisioner stack
  hosts: localhost
ansible/configs/ocp4-coreos-deployer/env_vars.yml
@@ -25,7 +25,7 @@
## Automatically deploy ocp4 cluster using the installer
install_ocp4: false
ocp4_installer_version: "v0.6.0"
ocp4_installer_version: "v0.7.0"
oc_client_version: "4.0.0-0.79.0"
# Install a user id 'student'. If install_student_user=true then a global variable
ansible/configs/ocp4-coreos-deployer/files/install-config.yml.j2
New file
@@ -0,0 +1,26 @@
---
baseDomain: {{ guid }}{{subdomain_base_suffix}}
clusterID: {{ guid | to_uuid }}
machines:
- name: master
  platform: {}
  replicas: 3
- name: worker
  platform: {}
  replicas: 3
metadata:
  creationTimestamp: null
  name: cluster-{{ guid }}
networking:
  clusterNetworks:
  - cidr: 10.128.0.0/14
    hostSubnetLength: 9
  serviceCIDR: 172.30.0.0/16
  type: OpenshiftSDN
platform:
  aws:
    region: us-east-1
    vpcCIDRBlock: 10.0.0.0/16
pullSecret: '{{ ocp4_token }}'
sshKey: |
  {{ idrsapub.content | b64decode }}
ansible/configs/ocp4-coreos-deployer/software.yml
@@ -87,12 +87,6 @@
            owner: root
            group: root
        - name: Write down OCP4 token
          copy:
            content: "{{ ocp4_token }}"
            dest: ~/ocp_auth_token.json
            mode: 0700
        - name: Generate SSH keys
          shell: ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ""
          args:
@@ -103,21 +97,28 @@
          args:
            creates: ~/.ssh/id_rsa.pub
        - environment:
            OPENSHIFT_INSTALL_PULL_SECRET_PATH: /home/{{ ansible_user }}/ocp_auth_token.json
            OPENSHIFT_INSTALL_SSH_PUB_KEY_PATH: /home/{{ ansible_user }}/.ssh/id_rsa.pub
            OPENSHIFT_INSTALL_BASE_DOMAIN: "{{ guid }}{{subdomain_base_suffix}}"
            OPENSHIFT_INSTALL_CLUSTER_NAME: "cluster-{{ guid }}"
            OPENSHIFT_INSTALL_PLATFORM: aws
            #OPENSHIFT_INSTALL_AWS_REGION: "{{ aws_region_final|d(aws_region)|d('us-east-1') }}"
            OPENSHIFT_INSTALL_AWS_REGION: us-east-1
          name: Run the installer
          command: openshift-install create cluster
        - name: Slurp public key
          slurp:
            path: /home/{{ ansible_user }}/.ssh/id_rsa.pub
          register: idrsapub
        - name: Create cluster directory
          file:
            path: /home/{{ ansible_user }}/cluster-{{ guid }}
            state: directory
        - name: Generate config install-config.yml
          template:
            src: files/install-config.yml.j2
            dest: /home/{{ ansible_user }}/cluster-{{ guid }}/install-config.yml
        - name: Run the installer
          command: openshift-install create cluster --dir=/home/{{ ansible_user }}/cluster-{{ guid }}/
        - name: Fetch kube config
          fetch:
            flat: yes
            src: /home/{{ ansible_user }}/auth/{{ item }}
            src: /home/{{ ansible_user }}/cluster-{{ guid }}/auth/{{ item }}
            dest: "{{ hostvars.localhost.output_dir }}/{{ env_type }}_{{ guid }}_{{ item }}"
          loop:
            - kubeconfig
@@ -125,12 +126,12 @@
        - name: Get kubeadmin password
          slurp:
            path: /home/{{ ansible_user }}/auth/kubeadmin-password
            path: /home/{{ ansible_user }}/cluster-{{ guid }}/auth/kubeadmin-password
          register: kubeadminr
        - name: Get console route
          environment:
            KUBECONFIG: /home/{{ ansible_user }}/auth/kubeconfig
            KUBECONFIG: /home/{{ ansible_user }}/cluster-{{ guid }}/auth/kubeconfig
          command: oc get route -n openshift-console console -o json
          register: routeconsole