Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

1 change: 1 addition & 0 deletions playbooks/gce/openshift-cluster/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
g_nodes_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-node' }}"
g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
g_nodeonmaster: true
openshift_cluster_id: "{{ cluster_id }}"
openshift_debug_level: 2
openshift_deployment_type: "{{ deployment_type }}"
Expand Down
31 changes: 16 additions & 15 deletions playbooks/gce/openshift-cluster/launch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,22 @@
type: "{{ k8s_type }}"
g_sub_host_type: "{{ sub_host_type }}"

# - include: ../../common/openshift-cluster/set_infra_launch_facts_tasks.yml
# vars:
# type: "infra"
# count: "{{ num_infra }}"
# - include: tasks/launch_instances.yml
# vars:
# instances: "{{ infra_names }}"
# cluster: "{{ cluster_id }}"
# type: "{{ k8s_type }}"
# g_sub_host_type: "{{ sub_host_type }}"
#
# - set_fact:
# a_infra: "{{ infra_names[0] }}"
# - add_host: name={{ a_infra }} groups=service_master
#
- include: ../../common/openshift-cluster/set_node_launch_facts_tasks.yml
vars:
type: "infra"
count: "{{ num_infra }}"
- include: tasks/launch_instances.yml
vars:
instances: "{{ node_names }}"
cluster: "{{ cluster_id }}"
type: "{{ k8s_type }}"
g_sub_host_type: "{{ sub_host_type }}"

- add_host:
name: "{{ master_names.0 }}"
groups: service_master
when: master_names is defined and master_names.0 is defined

- include: update.yml
#
#- name: Deploy OpenShift Services
Expand Down
21 changes: 18 additions & 3 deletions playbooks/gce/openshift-cluster/tasks/launch_instances.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,37 @@
- host-type-{{ type }}
- sub-host-type-{{ g_sub_host_type }}
- env-host-type-{{ cluster }}-openshift-{{ type }}
when: instances |length > 0
when: instances |length > 0
register: gce

- set_fact:
node_label:
# There doesn't seem to be a way to get the region directly, so parse it out of the zone.
region: "{{ gce.zone | regex_replace('^(.*)-.*$', '\\\\1') }}"
type: "{{ g_sub_host_type }}"
when: instances |length > 0 and type == "node"

- set_fact:
node_label:
# There doesn't seem to be a way to get the region directly, so parse it out of the zone.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fail at this step while deploying with 0 infra node.
In fact we skip the launch of infra instances in the code above, however this code is executed.
We should check again that instances|length >0

region: "{{ gce.zone | regex_replace('^(.*)-.*$', '\\\\1') }}"
type: "{{ type }}"
when: instances |length > 0 and type != "node"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followup issue to move logrotate bits out of GCE/AWS specific playbooks and into more a common playbook?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 on moving to a more common playbook in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sdodson @detiber Agreed. I hate that this is even in here, but it was in the AWS one, so I copied it here.

I've created this issue to track it (as suggested by @sdodson):
#690

- name: Add new instances to groups and set variables needed
add_host:
hostname: "{{ item.name }}"
ansible_ssh_host: "{{ item.name }}"
ansible_ssh_host: "{{ item.public_ip }}"
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: "{{ item.tags | oo_prepend_strings_in_list('tag_') | join(',') }}"
gce_public_ip: "{{ item.public_ip }}"
gce_private_ip: "{{ item.private_ip }}"
openshift_node_labels: "{{ node_label }}"
with_items: gce.instance_data | default([], true)

- name: Wait for ssh
wait_for: port=22 host={{ item.name }}
wait_for: port=22 host={{ item.public_ip }}
with_items: gce.instance_data | default([], true)

- name: Wait for user setup
Expand Down