Cleanup: adding linebreaks for readability

Change-Id: Ice32f692c7c8dd451e654e7c637ab610b296e96b
This commit is contained in:
Julia Kreger 2016-10-14 20:40:21 +00:00
parent aa6c5cc4c0
commit cb373c8598
10 changed files with 63 additions and 0 deletions

View File

@ -16,28 +16,35 @@
# the host's assigned UUID value. # the host's assigned UUID value.
- name: "Update facts from ironic to fill in any missing values" - name: "Update facts from ironic to fill in any missing values"
include: update_facts_from_ironic.yaml include: update_facts_from_ironic.yaml
- name: "Identify ssh_public_key if ssh_public_key_path is defined" - name: "Identify ssh_public_key if ssh_public_key_path is defined"
include: ssh_public_key_path.yaml include: ssh_public_key_path.yaml
when: ssh_public_key is undefined and ssh_public_key_path is defined when: ssh_public_key is undefined and ssh_public_key_path is defined
- name: "Make temporary folder to build configdrive" - name: "Make temporary folder to build configdrive"
local_action: command mktemp -d local_action: command mktemp -d
register: variable_configdrive_location register: variable_configdrive_location
- name: "Make metadata folder - /openstack/{{ metadata_version }}" - name: "Make metadata folder - /openstack/{{ metadata_version }}"
file: file:
state: directory state: directory
name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ metadata_version }}/" name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ metadata_version }}/"
- name: "Make metadata folder - /openstack/latest" - name: "Make metadata folder - /openstack/latest"
file: file:
state: directory state: directory
name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/" name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/"
- name: "Place template in each openstack/{{ metadata_version }} folder" - name: "Place template in each openstack/{{ metadata_version }} folder"
template: template:
src: openstack_meta_data.json.j2 src: openstack_meta_data.json.j2
dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ metadata_version }}/meta_data.json" dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ metadata_version }}/meta_data.json"
- name: "Place template in each openstack/latest folder" - name: "Place template in each openstack/latest folder"
template: template:
src: openstack_meta_data.json.j2 src: openstack_meta_data.json.j2
dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/meta_data.json" dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/meta_data.json"
- name: "Generate network_info" - name: "Generate network_info"
network_metadata: network_metadata:
ipv4_address: "{{ ipv4_address | default('') }}" ipv4_address: "{{ ipv4_address | default('') }}"
@ -50,44 +57,55 @@
nics: "{{ nics | default(omit) }}" nics: "{{ nics | default(omit) }}"
node_network_info: "{{ node_network_info | default({}) }}" node_network_info: "{{ node_network_info | default({}) }}"
when: addressing_mode is undefined or "dhcp" not in addressing_mode when: addressing_mode is undefined or "dhcp" not in addressing_mode
- name: "Place network info template in each openstack/latest folder" - name: "Place network info template in each openstack/latest folder"
template: template:
src: network_info.json.j2 src: network_info.json.j2
dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/network_info.json" dest: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/network_info.json"
when: addressing_mode is undefined or "dhcp" not in addressing_mode when: addressing_mode is undefined or "dhcp" not in addressing_mode
- name: "Make metadata folder - /openstack/latest" - name: "Make metadata folder - /openstack/latest"
file: file:
state: directory state: directory
name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/" name: "{{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/"
- name: "Write network Debian style interface template" - name: "Write network Debian style interface template"
local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000 local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000
when: write_interfaces_file | bool == true when: write_interfaces_file | bool == true
- name: "Check if mkisofs is available" - name: "Check if mkisofs is available"
shell: mkisofs --help &> /dev/null shell: mkisofs --help &> /dev/null
ignore_errors: yes ignore_errors: yes
register: test_mkisofs register: test_mkisofs
- name: "If mkisofs is not available, fallback to genisoimage" - name: "If mkisofs is not available, fallback to genisoimage"
set_fact: set_fact:
iso_gen_utility: "genisoimage" iso_gen_utility: "genisoimage"
when: ('genisoimage' in test_mkisofs.stderr) or test_mkisofs.rc != 0 when: ('genisoimage' in test_mkisofs.stderr) or test_mkisofs.rc != 0
- name: "Check if genisoimage is available" - name: "Check if genisoimage is available"
shell: genisoimage --help &> /dev/null shell: genisoimage --help &> /dev/null
ignore_errors: yes ignore_errors: yes
register: test_genisoimage register: test_genisoimage
- name: "fail if genisoimage is not available." - name: "fail if genisoimage is not available."
fail: msg="Neither mkisofs or genisoimage is available. Cannot make config drive files." fail: msg="Neither mkisofs or genisoimage is available. Cannot make config drive files."
when: test_genisoimage.rc != 0 and test_mkisofs.rc != 0 when: test_genisoimage.rc != 0 and test_mkisofs.rc != 0
- name: "Make config drive files" - name: "Make config drive files"
become: yes become: yes
command: "{{iso_gen_utility}} -R -V config-2 -o {{http_boot_folder}}/configdrive-{{ uuid }}.iso {{ variable_configdrive_location.stdout }}/{{ uuid }}" command: "{{iso_gen_utility}} -R -V config-2 -o {{http_boot_folder}}/configdrive-{{ uuid }}.iso {{ variable_configdrive_location.stdout }}/{{ uuid }}"
- name: "Make config drive files base64 encoded and gzip compressed" - name: "Make config drive files base64 encoded and gzip compressed"
become: yes become: yes
shell: gzip -c {{http_boot_folder}}/configdrive-{{ uuid }}.iso | base64 > {{http_boot_folder}}/configdrive-{{ uuid }}.iso.gz shell: gzip -c {{http_boot_folder}}/configdrive-{{ uuid }}.iso | base64 > {{http_boot_folder}}/configdrive-{{ uuid }}.iso.gz
- name: "Cleanup configdrive .iso files" - name: "Cleanup configdrive .iso files"
become: yes become: yes
file: file:
state: absent state: absent
name: "{{http_boot_folder}}/configdrive-{{ uuid }}.iso" name: "{{http_boot_folder}}/configdrive-{{ uuid }}.iso"
- name: "Cleanup configdrive temp folder" - name: "Cleanup configdrive temp folder"
become: yes become: yes
file: file:

View File

@ -16,8 +16,10 @@
local_action: stat path={{ ssh_public_key_path }} local_action: stat path={{ ssh_public_key_path }}
register: test_ssh_public_key_path register: test_ssh_public_key_path
when: ssh_public_key_path is defined when: ssh_public_key_path is defined
- name: "Defined ssh_public_key_path - Error if ssh_public_key_path is not valid" - name: "Defined ssh_public_key_path - Error if ssh_public_key_path is not valid"
local_action: fail msg="ssh_public_key_path is not valid." local_action: fail msg="ssh_public_key_path is not valid."
when: test_ssh_public_key_path.stat.exists == false when: test_ssh_public_key_path.stat.exists == false
- name: "Defined ssh_public_key_path - Read SSH public key in" - name: "Defined ssh_public_key_path - Read SSH public key in"
set_fact: ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}" set_fact: ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}"

View File

@ -23,11 +23,13 @@
set_fact: set_fact:
ansible_os_family: "Suse" ansible_os_family: "Suse"
when: ansible_os_family | search("openSUSE Tumbleweed") when: ansible_os_family | search("openSUSE Tumbleweed")
- name: Ensure openSUSE Leap has the correct family - name: Ensure openSUSE Leap has the correct family
set_fact: set_fact:
ansible_os_family: "Suse" ansible_os_family: "Suse"
when: (ansible_os_family | search("SUSE LINUX")) or when: (ansible_os_family | search("SUSE LINUX")) or
(ansible_os_family | search("openSUSE Leap")) (ansible_os_family | search("openSUSE Leap"))
- name: "Update apt cache if Ubuntu/Debian" - name: "Update apt cache if Ubuntu/Debian"
apt: apt:
update_cache: yes update_cache: yes

View File

@ -20,43 +20,58 @@
- /tftpboot/pxelinux.cfg - /tftpboot/pxelinux.cfg
- "{{ http_boot_folder }}" - "{{ http_boot_folder }}"
- "{{ http_boot_folder }}/pxelinux.cfg" - "{{ http_boot_folder }}/pxelinux.cfg"
- name: "Place tftpd map-file" - name: "Place tftpd map-file"
copy: src=tftpboot-map-file dest=/tftpboot/map-file owner=ironic group=ironic copy: src=tftpboot-map-file dest=/tftpboot/map-file owner=ironic group=ironic
- name: "Disable service {{ tftp_service_name }}" - name: "Disable service {{ tftp_service_name }}"
service: name="{{ tftp_service_name }}" state=stopped enabled=no service: name="{{ tftp_service_name }}" state=stopped enabled=no
- name: "Set pxelinux.0 source (for Ubuntu >=14.10)" - name: "Set pxelinux.0 source (for Ubuntu >=14.10)"
set_fact: set_fact:
syslinux_tftp_dir: '/usr/lib/PXELINUX' syslinux_tftp_dir: '/usr/lib/PXELINUX'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('14.10', '>=') when: ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('14.10', '>=')
- name: "Determine if pxelinux.0 is in place" - name: "Determine if pxelinux.0 is in place"
stat: path=/tftpboot/pxelinux.0 stat: path=/tftpboot/pxelinux.0
register: test_pxelinux register: test_pxelinux
- name: "Place pxelinux.0" - name: "Place pxelinux.0"
copy: src={{ syslinux_tftp_dir }}/pxelinux.0 dest=/tftpboot copy: src={{ syslinux_tftp_dir }}/pxelinux.0 dest=/tftpboot
when: test_pxelinux.stat.exists == false when: test_pxelinux.stat.exists == false
- name: "Place boot.ipxe helper script /etc/ironic" - name: "Place boot.ipxe helper script /etc/ironic"
copy: src=boot.ipxe dest=/etc/ironic/boot.ipxe owner=ironic group=ironic mode=0744 copy: src=boot.ipxe dest=/etc/ironic/boot.ipxe owner=ironic group=ironic mode=0744
- name: "Pre-stage boot.ipxe into /httpboot/" - name: "Pre-stage boot.ipxe into /httpboot/"
copy: src=boot.ipxe dest=/httpboot/boot.ipxe owner=ironic group=ironic mode=0744 copy: src=boot.ipxe dest=/httpboot/boot.ipxe owner=ironic group=ironic mode=0744
- name: "Place tftp config file" - name: "Place tftp config file"
copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp
- name: "Download ipxe files if asked" - name: "Download ipxe files if asked"
include: get_ipxe.yml include: get_ipxe.yml
when: download_ipxe | bool == true when: download_ipxe | bool == true
- name: "Copy iPXE image into place" - name: "Copy iPXE image into place"
copy: src={{ ipxe_dir }}/undionly.kpxe dest=/tftpboot/ copy: src={{ ipxe_dir }}/undionly.kpxe dest=/tftpboot/
# NOTE(TheJulia): Copy full iPXE chain loader images in case they are required. # NOTE(TheJulia): Copy full iPXE chain loader images in case they are required.
- name: "Copy full iPXE image into /httpboot" - name: "Copy full iPXE image into /httpboot"
copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest=/httpboot/ copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest=/httpboot/
- name: "Copy full iPXE image into /tftpboot" - name: "Copy full iPXE image into /tftpboot"
copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest=/tftpboot/ copy: src={{ ipxe_dir }}/{{ ipxe_full_binary }} dest=/tftpboot/
# Similar logic to below can be utilized to retrieve files # Similar logic to below can be utilized to retrieve files
- name: "Determine if folder exists, else create and populate folder." - name: "Determine if folder exists, else create and populate folder."
stat: path=/tftpboot/master_images stat: path=/tftpboot/master_images
register: test_master_images register: test_master_images
- name: "Create master_images folder" - name: "Create master_images folder"
file: name=/tftpboot/master_images state=directory owner=ironic group=ironic file: name=/tftpboot/master_images state=directory owner=ironic group=ironic
when: test_master_images.stat.exists == false when: test_master_images.stat.exists == false
- name: "Inspector - Place default tftp boot file in {{ http_boot_folder}}/pxelinux.cfg/" - name: "Inspector - Place default tftp boot file in {{ http_boot_folder}}/pxelinux.cfg/"
template: template:
src=inspector-default-boot-ipxe.j2 src=inspector-default-boot-ipxe.j2

View File

@ -18,12 +18,15 @@
- name: "Test if IPA kernel is present" - name: "Test if IPA kernel is present"
stat: path={{ ipa_kernel }} stat: path={{ ipa_kernel }}
register: test_ipa_kernel_present register: test_ipa_kernel_present
- name: "Download IPA kernel" - name: "Download IPA kernel"
get_url: url={{ ipa_kernel_upstream_url }} dest={{ ipa_kernel }} timeout=300 get_url: url={{ ipa_kernel_upstream_url }} dest={{ ipa_kernel }} timeout=300
when: test_ipa_kernel_present.stat.exists == false when: test_ipa_kernel_present.stat.exists == false
- name: "Test if IPA image is present" - name: "Test if IPA image is present"
stat: path={{ ipa_ramdisk }} stat: path={{ ipa_ramdisk }}
register: test_ipa_image_present register: test_ipa_image_present
- name: "Download IPA image" - name: "Download IPA image"
get_url: url={{ ipa_ramdisk_upstream_url }} dest={{ ipa_ramdisk }} timeout=300 get_url: url={{ ipa_ramdisk_upstream_url }} dest={{ ipa_ramdisk }} timeout=300
when: test_ipa_image_present.stat.exists == false when: test_ipa_image_present.stat.exists == false

View File

@ -20,6 +20,7 @@
owner=root owner=root
group=root group=root
mode=0755 mode=0755
- name: Get ipxe files - name: Get ipxe files
get_url: get_url:
url: "https://boot.ipxe.org/{{ item }}" url: "https://boot.ipxe.org/{{ item }}"

View File

@ -19,6 +19,7 @@
state=latest state=latest
sourcedir={{ ironicinspector_git_folder }} sourcedir={{ ironicinspector_git_folder }}
source_install={{ ironicinspector_source_install }} source_install={{ ironicinspector_source_install }}
- name: "Inspector - PIP client install" - name: "Inspector - PIP client install"
include: pip_install.yml include: pip_install.yml
package=python-ironic-inspector-client package=python-ironic-inspector-client

View File

@ -22,11 +22,13 @@
set_fact: set_fact:
ansible_os_family: "Suse" ansible_os_family: "Suse"
when: ansible_os_family | search("openSUSE Tumbleweed") when: ansible_os_family | search("openSUSE Tumbleweed")
- name: Ensure openSUSE Leap has the correct family - name: Ensure openSUSE Leap has the correct family
set_fact: set_fact:
ansible_os_family: "Suse" ansible_os_family: "Suse"
when: (ansible_os_family | search("SUSE LINUX")) or when: (ansible_os_family | search("SUSE LINUX")) or
(ansible_os_family | search("openSUSE Leap")) (ansible_os_family | search("openSUSE Leap"))
# NOTE(cinerama) dummy-defaults.yml is an empty defaults file. We use it # NOTE(cinerama) dummy-defaults.yml is an empty defaults file. We use it
# here to ensure that with_first_found won't fail should we not have # here to ensure that with_first_found won't fail should we not have
# defaults for a particular distribution, version, etc. # defaults for a particular distribution, version, etc.
@ -35,23 +37,28 @@
with_first_found: with_first_found:
- "../defaults/required_defaults_{{ ansible_os_family }}_family.yml" - "../defaults/required_defaults_{{ ansible_os_family }}_family.yml"
- "../defaults/dummy-defaults.yml" - "../defaults/dummy-defaults.yml"
- name: Include OS distribution-specific defaults - name: Include OS distribution-specific defaults
include_vars: "{{ item }}" include_vars: "{{ item }}"
with_first_found: with_first_found:
- "../defaults/required_defaults_{{ ansible_distribution }}.yml" - "../defaults/required_defaults_{{ ansible_distribution }}.yml"
- "../defaults/dummy-defaults.yml" - "../defaults/dummy-defaults.yml"
- name: Include OS version-specific defaults - name: Include OS version-specific defaults
include_vars: "{{ item }}" include_vars: "{{ item }}"
with_first_found: with_first_found:
- "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_release }}.yml" - "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_release }}.yml"
- "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml" - "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml"
- "../defaults/dummy-defaults.yml" - "../defaults/dummy-defaults.yml"
- name: "Install Ironic deps" - name: "Install Ironic deps"
include: install.yml include: install.yml
when: skip_package_install | bool != True when: skip_package_install | bool != True
- name: "Bootstrap Ironic" - name: "Bootstrap Ironic"
include: bootstrap.yml include: bootstrap.yml
when: skip_bootstrap | bool != True when: skip_bootstrap | bool != True
- name: "Start Ironic services" - name: "Start Ironic services"
include: start.yml include: start.yml
when: skip_start | bool != True when: skip_start | bool != True

View File

@ -16,42 +16,54 @@
- name: "Reload systemd configuration" - name: "Reload systemd configuration"
command: systemctl daemon-reload command: systemctl daemon-reload
when: init_template == 'systemd_template.j2' when: init_template == 'systemd_template.j2'
- name: "Start database service" - name: "Start database service"
service: name={{ mysql_service_name }} state=started service: name={{ mysql_service_name }} state=started
- name: "Start rabbitmq-server" - name: "Start rabbitmq-server"
service: name=rabbitmq-server state=started service: name=rabbitmq-server state=started
- name: "start ironic-inspector" - name: "start ironic-inspector"
include: inspector_start.yml include: inspector_start.yml
when: enable_inspector | bool == true when: enable_inspector | bool == true
- name: "Start ironic-conductor" - name: "Start ironic-conductor"
service: name=ironic-conductor state=started service: name=ironic-conductor state=started
- name: "Start ironic-api" - name: "Start ironic-api"
service: name=ironic-api state=started service: name=ironic-api state=started
- name: "Start ironic-conductor" - name: "Start ironic-conductor"
service: name=ironic-conductor state=restarted service: name=ironic-conductor state=restarted
- name: "Start ironic-api" - name: "Start ironic-api"
service: name=ironic-api state=restarted service: name=ironic-api state=restarted
# NOTE(Shrews) When testing, we want to use our custom dnsmasq.conf file, # NOTE(Shrews) When testing, we want to use our custom dnsmasq.conf file,
# not the one supplied by libvirt. And the libvirt started dnsmasq processes # not the one supplied by libvirt. And the libvirt started dnsmasq processes
# are not controlled by upstart, so we need to manually kill those. # are not controlled by upstart, so we need to manually kill those.
- name: "Stop existing libvirt dnsmasq processes" - name: "Stop existing libvirt dnsmasq processes"
command: killall -w dnsmasq command: killall -w dnsmasq
when: "{{ testing | bool == true and include_dhcp_server | bool == true }}" when: "{{ testing | bool == true and include_dhcp_server | bool == true }}"
- name: "Ensure services are running with current config" - name: "Ensure services are running with current config"
service: name={{ item }} state=restarted service: name={{ item }} state=restarted
with_items: with_items:
- xinetd - xinetd
- nginx - nginx
- name: "Ensure dnsmasq is running with current config" - name: "Ensure dnsmasq is running with current config"
service: name={{ item }} state=restarted service: name={{ item }} state=restarted
with_items: with_items:
- dnsmasq - dnsmasq
when: "{{ include_dhcp_server | bool == true }}" when: "{{ include_dhcp_server | bool == true }}"
- name: "Send services a reload signal" - name: "Send services a reload signal"
service: name={{ item }} state=reloaded service: name={{ item }} state=reloaded
with_items: with_items:
- xinetd - xinetd
- nginx - nginx
- name: "Send services a force-reload signal" - name: "Send services a force-reload signal"
service: name=dnsmasq state=restarted service: name=dnsmasq state=restarted
when: "{{ include_dhcp_server | bool == true }}" when: "{{ include_dhcp_server | bool == true }}"

View File

@ -18,6 +18,7 @@
set_fact: set_fact:
deprecated: true deprecated: true
when: deprecated_test_playbook | bool == true when: deprecated_test_playbook | bool == true
- name: > - name: >
"Execute ping step to verify connectivity and login to the host. "Execute ping step to verify connectivity and login to the host.
If this fails, the configdrive may not have loaded." If this fails, the configdrive may not have loaded."
@ -25,6 +26,7 @@
# hostname. This is because cirros lacks sftp support. # hostname. This is because cirros lacks sftp support.
raw: hostname raw: hostname
register: instance_hostname register: instance_hostname
- name: > - name: >
'Error if hostname is set to "ubuntu", "cirros", "debian", or "centos"' 'Error if hostname is set to "ubuntu", "cirros", "debian", or "centos"'
# TODO: Presently this step is unable to cycle through each host and verify # TODO: Presently this step is unable to cycle through each host and verify