Skip to content

Commit

Permalink
Remove old style kickstart generation.
Browse files Browse the repository at this point in the history
Even if hosts_file_use_custom_inventory == True, skipping over all the
hosts in the old-style kickstart generation takes a long time. In our
environment, running

ansible-playbook install.yml --tags=pxe

shows the following timings:

Wednesday 14 September 2016  10:10:12 +0300 (0:00:01.322)       0:02:16.558 ***
===============================================================================
ansible-role-pxe_config : copy over kickstart file (old style) --------- 34.82s
ansible-role-pxe_config : populate hosts file from template with PXE hosts -- 20.68s
ansible-role-pxe_config : create pxe boot data json file --------------- 19.28s
ansible-role-pxe_config : create_dhcp_configs -------------------------- 19.10s
ansible-role-pxe_config : copy over kickstart file (new and faster style) --- 9.45s

(top 5 only, all other tasks are below 2s.)
  • Loading branch information
jabl committed Sep 14, 2016
1 parent 90a52ca commit 9386cad
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 12 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ hosts_file_login_group_to_populate: ""
hosts_file_extra_group_to_populate: ""
</pre>

Using a custom inventory script to only write kickstart templates once per child group of a group by:
Using the custom inventory script to only write kickstart templates once per child group of a group by:

<pre>
hosts_file_use_custom_inventory: True
hosts_file_group_to_populate: "pxe_bootable_nodes"
hosts_file_inventory_location: "hosts"
</pre>
Expand Down
1 change: 0 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ hosts_file_login_group_to_populate: "{{ groups.login }}"
hosts_file_extra_group_to_populate: ""

#hosts_file_inventory_location points to where the ansible inventory file is
hosts_file_use_custom_inventory: False
hosts_file_group_to_populate: "pxe_bootable_nodes"
hosts_file_inventory_location: "hosts"

Expand Down
9 changes: 1 addition & 8 deletions tasks/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@
- name: print each host
debug: var=item verbosity=1
with_items: "{{ hosts_file_my_group }}"
when: hosts_file_use_custom_inventory

- name: copy over kickstart file (new and faster style)
- name: copy over kickstart file
template: src="kickstart.cfg" dest="{{ ksBootSrvDir }}/{{ hostvars[item].kickstart_profile }}" owner=apache group=apache mode=0644
with_items: "{{ hosts_file_my_group }}"
when: hosts_file_use_custom_inventory

- name: copy over kickstart file (old style)
template: src="kickstart.cfg" dest="{{ ksBootSrvDir }}/{{ hostvars[item].kickstart_profile }}" owner=apache group=apache mode=0644
with_items: "{{ groups.pxe_bootable_nodes }}"
when: hosts_file_use_custom_inventory == False
1 change: 0 additions & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
- rootpwhash: "SHAFOOO"
- hosts_file_login_group_to_populate: ""
- hosts_file_inventory_location: "/ansible-role-pxe_config/tests/inventory"
- hosts_file_use_custom_inventory: True
- hosts_file_extra_group_to_populate: "{{ groups.switches }}"
pre_tasks:
- name: touch hosts_file_to_populate
Expand Down

0 comments on commit 9386cad

Please sign in to comment.