---
- name: Reboot instance
  hosts: localhost
  gather_facts: no
  tasks:
  # After installing certain packages rebooting the instance is a must before all
  # changes (e.g. new Selinux rules) get properly applied and propagated.
  # Must be done before the cloud-init is cleaned.
  # Otherwise, the cloud-init will be run again.
  - name: Reboot instance
    import_role:
      name: openshift_aws
      tasks_from: reboot_instance.yml
    when: openshift_node_reboot_instance_before_cleanup | default(false)

- name: Configure nodes
  hosts: oo_nodes_to_config
  tasks:
  - name: Set gquota for slash filesystem
    import_role:
      name: openshift_aws
      tasks_from: set_gquota_for_slashfs.yml
    when: openshift_aws_ami_build_set_gquota_on_slashfs | default(false)
  - name: Remove any ansible facts created during AMI creation
    file:
      path: "/etc/ansible/facts.d/{{ item }}"
      state: absent
    with_items:
    - openshift.fact
  - name: Clean cloud-init path
    file:
      state: absent
      path: "/var/lib/cloud/"
