From a67004c0a3c35081c3ef55b8a298f8274aaa75d0 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Wed, 9 Dec 2015 10:46:15 -0500 Subject: [PATCH] Adjust primary bifrost settings for Debian jessie support Specific settings are required for Debian jessie as it uses different defaults from wheezy. Additionally, we're going to attempt to ensure that the service folder exists if we're using a systemd template upon install as sometimes that folder may not be present on systems. Added genisoimage as a fallback to mkisofs in configuration drive generation. Change-Id: I74bf93416513094293bc071fd40e62f4240d61bc Closes-Bug: 1522552 --- .../defaults/main.yml | 3 ++ .../tasks/main.yml | 10 +++- .../required_defaults_Debian_jessie.yml | 47 +++++++++++++++++++ .../bifrost-ironic-install/tasks/main.yml | 7 +++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml diff --git a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml index 5471b29a1..46b32a6f0 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml @@ -21,3 +21,6 @@ network_mtu: 1500 # Default URL to Ironic ironic_url: "http://localhost:6385/" + +# Default ISO generation utility +iso_gen_utility: "mkisofs" diff --git a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml index 90b053c8f..c3b40b3bf 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml @@ -62,9 +62,17 @@ - name: "Write network Debian style interface template" local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000 when: write_interfaces_file | bool +- name: "Check if mkisofs is available" + shell: mkisofs --help >>/dev/null + ignore_errors: yes + register: test_mkisofs +- name: "If mkisofs is not available, fallback to genisoimage" + set_fact: + iso_gen_utility: "genisoimage" + when: test_mkisofs.rc != 0 - name: "Make config drive files" become: yes - command: mkisofs -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" become: yes shell: gzip -c {{http_boot_folder}}/configdrive-{{ uuid }}.iso | base64 > {{http_boot_folder}}/configdrive-{{ uuid }}.iso.gz diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml new file mode 100644 index 000000000..efe3cc16c --- /dev/null +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml @@ -0,0 +1,47 @@ +--- +init_template: systemd_template.j2 +init_dest_dir: /usr/lib/systemd/system/ +init_ext: .service +syslinux_tftp_dir: /usr/lib/PXELINUX/ +ipxe_dir: /usr/lib/ipxe/ +ipxe_full_binary: ipxe.pxe +sgabios_dir: /usr/share/qemu/ +nginx_user: www-data +virt_group: libvirt +mysql_service_name: mysql +required_packages: + - mysql-server + - rabbitmq-server + - python-dev + - python-mysqldb + - python-configparser + - libffi-dev + - libxslt1-dev + - libssl-dev + - libxml2-dev + - ipxe + - tftpd-hpa + - tftp-hpa + - syslinux-common + - syslinux + - pxelinux + - xinetd + - parted + - ipmitool + - psmisc + - nginx + - wget + - genisoimage + - kpartx + - qemu-utils + - amtterm + - sgabios + - libvirt-bin + - debootstrap + - uuid-runtime + - dnsmasq +# NOTE(TheJulia): The above entry for dnsmasq must be the last entry in the +# package list as the installation causes name resolution changes that can +# temporarily block packages following it while the system is being +# reconfigured. See: https://review.openstack.org/#/c/223813 + diff --git a/playbooks/roles/bifrost-ironic-install/tasks/main.yml b/playbooks/roles/bifrost-ironic-install/tasks/main.yml index 18655829f..0e5729ac4 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/main.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/main.yml @@ -29,6 +29,7 @@ - name: Include OS version-specific defaults include_vars: "{{ item }}" with_first_found: + - "../defaults/required_defaults_{{ ansible_distribution }}_{{ansible_distribution_release }}.yml" - "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml" - "../defaults/dummy-defaults.yml" - name: "Update Package Cache" @@ -136,6 +137,12 @@ - name: "Create authorized_keys file for ironic user" command: cp -p /home/ironic/.ssh/id_rsa.pub /home/ironic/.ssh/authorized_keys when: testing == true +- name: "Create service folder if systemd template is defined" + file: + path: "{{ init_dest_dir }}" + state: directory + mode: 0755 + when: init_template == 'systemd_template.j2' - name: "Install ironic-inspector to permit use of inspection interface" include: inspector_install.yml when: enable_inspector | bool