From e7a7d1642c1ffbfe23cd5ad2d920e842f0cae4b2 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Thu, 20 Jul 2017 16:53:05 +0200 Subject: Static inventory autogeneration (#550) * At the provisioning stage, allow users to auto-generate a static inventory w/o manual steps needed. The alternative to go fully dynamic TBD. * Move openshift pre-install playbook to the post provision playbook, where the second part of the pre install tasks is already placed. Signed-off-by: Bogdan Dobrelya --- .../openstack/post-provision-openstack.yml | 72 ++++++++++++++-------- 1 file changed, 45 insertions(+), 27 deletions(-) (limited to 'playbooks/provisioning/openstack/post-provision-openstack.yml') diff --git a/playbooks/provisioning/openstack/post-provision-openstack.yml b/playbooks/provisioning/openstack/post-provision-openstack.yml index 53db5061c..a807c4d2f 100644 --- a/playbooks/provisioning/openstack/post-provision-openstack.yml +++ b/playbooks/provisioning/openstack/post-provision-openstack.yml @@ -1,72 +1,90 @@ --- +- hosts: cluster_hosts + name: Wait for the the nodes to come up + become: False + gather_facts: False + tasks: + - wait_for_connection: + +- hosts: cluster_hosts + gather_facts: True + tasks: + - name: Debug hostvar + debug: + msg: "{{ hostvars[inventory_hostname] }}" + verbosity: 2 + +- name: OpenShift Pre-Requisites (part 1) + include: pre-install.yml + - name: Assign hostnames hosts: cluster_hosts gather_facts: False become: true pre_tasks: - - include: pre_tasks.yml + - include: pre_tasks.yml roles: - - role: hostnames + - role: hostnames - name: Subscribe DNS Host to allow for configuration below hosts: dns gather_facts: False become: true roles: - - role: subscription-manager - when: hostvars.localhost.rhsm_register|default(False) - tags: 'subscription-manager' + - role: subscription-manager + when: hostvars.localhost.rhsm_register|default(False) + tags: 'subscription-manager' - name: Determine which DNS server(s) to use for our generated records hosts: localhost gather_facts: False become: False roles: - - dns-server-detect + - dns-server-detect - name: Build the DNS Server Views and Configure DNS Server(s) hosts: dns gather_facts: False become: true pre_tasks: - - include: pre_tasks.yml - - name: "Generate dns-server views" - include: openstack_dns_views.yml + - include: pre_tasks.yml + - name: "Generate dns-server views" + include: openstack_dns_views.yml roles: - - role: infra-ansible/roles/dns-server + - role: infra-ansible/roles/dns-server - name: Build and process DNS Records hosts: localhost - gather_facts: False + gather_facts: True become: False pre_tasks: - - include: pre_tasks.yml - - name: "Generate dns records" - include: openstack_dns_records.yml + - include: pre_tasks.yml + - name: "Generate dns records" + include: openstack_dns_records.yml roles: - - role: infra-ansible/roles/dns + - role: infra-ansible/roles/dns - name: Switch the stack subnet to the configured private DNS server hosts: localhost gather_facts: False become: False vars_files: - - stack_params.yaml + - stack_params.yaml tasks: - - include_role: - name: openstack-stack - tasks_from: subnet_update_dns_servers + - include_role: + name: openstack-stack + tasks_from: subnet_update_dns_servers -- name: OpenShift Pre-Requisites +- name: OpenShift Pre-Requisites (part 2) hosts: OSEv3 gather_facts: true become: true pre_tasks: - - name: "Include DNS configuration to ensure proper name resolution" - lineinfile: - state: present - dest: /etc/sysconfig/network - regexp: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" - line: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" + - name: "Include DNS configuration to ensure proper name resolution" + lineinfile: + state: present + dest: /etc/sysconfig/network + regexp: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" + line: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" roles: - - node-network-manager + - node-network-manager -- cgit v1.2.3 From df8f5f0e251a014ab30dabd62c17e151b7fe36e8 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Wed, 12 Jul 2017 13:09:45 +0200 Subject: Options for bastion, SSH config, static inventory autogeneration * At the provisioning stage, allow users to auto-generate SSH config, when using a static inventory. * Run playbooks to provsion and post-provision as a separate, when using a bastion. This re-applies the SSH config, which ansible can't do on the fly. * Support a pre-installed bastion node, colocated with the 1st infra node. * With a bastion enabled, reduce floating IP footprint to infra and dns nodes only, effectively isolating a cluster in a private network. Signed-off-by: Bogdan Dobrelya --- playbooks/provisioning/openstack/post-provision-openstack.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'playbooks/provisioning/openstack/post-provision-openstack.yml') diff --git a/playbooks/provisioning/openstack/post-provision-openstack.yml b/playbooks/provisioning/openstack/post-provision-openstack.yml index a807c4d2f..c7df74a87 100644 --- a/playbooks/provisioning/openstack/post-provision-openstack.yml +++ b/playbooks/provisioning/openstack/post-provision-openstack.yml @@ -4,7 +4,11 @@ become: False gather_facts: False tasks: - - wait_for_connection: + - when: not openstack_use_bastion|default(False)|bool + wait_for_connection: + - when: openstack_use_bastion|default(False)|bool + delegate_to: bastion + wait_for_connection: - hosts: cluster_hosts gather_facts: True -- cgit v1.2.3