Guillaume Coré
2018-11-30 c2d61277d5efd21b06818cc844726006be495b39
OCP Workshop scaleup: remove var_files and add AWS creds for ec2
1 files modified
46 ■■■■ changed files
ansible/configs/ocp-workshop/scaleup.yml 46 ●●●● patch | view | raw | blame | history
ansible/configs/ocp-workshop/scaleup.yml
@@ -10,7 +10,7 @@
# include global vars from the config
- import_playbook: ../../include_vars.yml
- import_playbook: "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/pre_infra.yml"
- import_playbook: pre_infra.yml
  tags:
    - step000
    - pre_infra_tasks
@@ -31,8 +31,6 @@
  connection: local
  gather_facts: false
  become: false
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
  tasks:
    - name: Assert new_node_instance_count and node_instance_count are setup properly.
      tags: assert_new_node
@@ -51,7 +49,7 @@
#################################################################################
#################################################################################
- import_playbook: "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/post_infra.yml"
- import_playbook: post_infra.yml
  tags:
    - step002
    - post_infra_tasks
@@ -68,9 +66,6 @@
    - "newnodes"
  become: true
  gather_facts: False
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  tags:
    - step004
    - common_tasks
@@ -84,9 +79,6 @@
  connection: local
  gather_facts: false
  become: false
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  tags:
    - flight_check
  tasks:
@@ -98,10 +90,6 @@
- name: Configuring openshift-nodes
  gather_facts: False
  become: yes
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  hosts:
    - "newnodes"
  roles:
@@ -113,9 +101,6 @@
  hosts: bastions
  become: true
  gather_facts: False
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  tags:
    - openshift_host_templates
  tasks:
@@ -138,25 +123,23 @@
  gather_facts: False
  become: yes
  hosts: bastions[0]
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
  tags:
    - installing_openshift
  ## Change to scale up, and change inventory file
  tasks:
    - name: run scaleup playbook (pre 3.9.33)
    - name: Run scaleup playbook (pre 3.9.33)
      shell: "ansible-playbook -i /etc/ansible/scaleup_hosts /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-node/scaleup.yml"
      register: openshift_install_log
      when: osrelease is version_compare('3.9.33', '<')
      tags:
        - openshift_installer
    - name: run scaleup playbook (3.9.33 and later)
    - name: Run scaleup playbook (3.9.33 and later)
      shell: "ansible-playbook -i /etc/ansible/scaleup_hosts /usr/share/ansible/openshift-ansible/playbooks/openshift-node/scaleup.yml"
      register: openshift_install_log
      when: osrelease is version_compare('3.9.33', '>=')
      tags:
        - openshift_installer
    - name: show output of the scaleup playbook
    - name: Show output of the scaleup playbook
      debug:
        var: openshift_install_log
        verbosity: 2
@@ -166,14 +149,12 @@
  become: yes
  hosts: masters
  run_once: yes
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
  tags:
    - installing_openshift
  ## Change to scale up, and change inventory file
  tasks:
    - name: Tag new nodes with logging-infra-fluentd=true
      shell: "oc label node {{ item }} logging-infra-fluentd=true"
      shell: "oc label node --overwrite {{ item }} logging-infra-fluentd=true"
      with_items: "{{ groups['newnodes'] }}"
      when: install_logging|d(true)|bool
@@ -182,14 +163,15 @@
  connection: local
  become: False
  gather_facts: False
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  tags:
    - generate_ansible_hosts_file
  tasks:
    # untag nodes, remove newnode tag
    - name: Ensure tags 'newnode' for instance is set to 'false'
      environment:
        AWS_ACCESS_KEY_ID: "{{aws_access_key_id}}"
        AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}"
        AWS_DEFAULT_REGION: "{{aws_region_final|d(aws_region)}}"
      ec2_tag:
        region: "{{ aws_region_final|d(aws_region) }}"
        resource: "{{ hostvars[item].instance_id }}"
@@ -201,9 +183,6 @@
- name: Remove hosts from group newnodes
  gather_facts: False
  become: yes
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  hosts: newnodes
  tasks:
    - group:
@@ -215,9 +194,6 @@
  hosts: bastions
  become: true
  gather_facts: False
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  tags:
    - openshift_host_templates
  tasks:
@@ -225,7 +201,7 @@
        msg: "WARNING: s3user credentials not set"
      when: s3user_access_key is not defined
    - name: generate ansible hosts file, keep it under workdir
    - name: Generate ansible hosts file, keep it under workdir
      template:
        src: "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/files/hosts_template.{{ osrelease }}.j2"
        dest: "{{ ANSIBLE_REPO_PATH }}/workdir/hosts-{{ env_type }}-{{ guid }}"