From 8fb8308e1c036e8391bc0792ebc054cad33c260f Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Fri, 13 Mar 2015 10:41:52 -0400 Subject: [PATCH] Removal of local_action Removed local_action calls as they are an artifact of the original playbook and no longer required. --- .../tasks/create_bootable_image.yml | 57 +++--- roles/ironic-install/tasks/dib_install.yml | 20 +- roles/ironic-install/tasks/main.yml | 176 +++++++++--------- 3 files changed, 118 insertions(+), 135 deletions(-) diff --git a/roles/ironic-install/tasks/create_bootable_image.yml b/roles/ironic-install/tasks/create_bootable_image.yml index 26870747e..f56cc66a2 100644 --- a/roles/ironic-install/tasks/create_bootable_image.yml +++ b/roles/ironic-install/tasks/create_bootable_image.yml @@ -14,63 +14,56 @@ # limitations under the License. --- - name: "Extracting the raw disk image" - local_action: command qemu-img convert -O raw "{{http_boot_folder}}/{{deploy_image_filename}}" "{{http_boot_folder}}/{{deploy_image_filename}}.raw" + command: qemu-img convert -O raw "{{http_boot_folder}}/{{deploy_image_filename}}" "{{http_boot_folder}}/{{deploy_image_filename}}.raw" - name: "Copying Image however with 32k of empty space at the beginning of the file." - local_action: command dd if="{{http_boot_folder}}/{{deploy_image_filename}}.raw" of="{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" seek=64 + command: dd if="{{http_boot_folder}}/{{deploy_image_filename}}.raw" of="{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" seek=64 - name: "Creating Partition Table lining up with the copied file's contents." - local_action: shell echo '32;' | sfdisk "{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" -uB -f + shell: echo '32;' | sfdisk "{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" -uB -f - name: "Allocating one of two loopbacks" - local_action: command losetup -f + command: losetup -f register: stored_value_loopback_alpha - name: "Creating loopback connetion to new image file" - local_action: command losetup "{{stored_value_loopback_alpha.stdout}}" "{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" + command: losetup "{{stored_value_loopback_alpha.stdout}}" "{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" - name: "Forcing partition table to be re-read" - local_action: command kpartx -v -a "{{stored_value_loopback_alpha.stdout}}" + command: kpartx -v -a "{{stored_value_loopback_alpha.stdout}}" # Using second loopback as for some reason /dev/mapper does not translate into a chroot cleanly when devfs is mounted - name: "Allocating second loopback pointing to the initial partition" - local_action: command losetup -f + command: losetup -f register: stored_value_loopback_beta - name: "Binding second loopback to the first partition" - local_action: shell losetup "{{stored_value_loopback_beta.stdout}}" /dev/mapper/$(echo "{{stored_value_loopback_alpha.stdout}}"|cut -f3 -d '/')p1 + shell: losetup "{{stored_value_loopback_beta.stdout}}" /dev/mapper/$(echo "{{stored_value_loopback_alpha.stdout}}"|cut -f3 -d '/')p1 # TODO parameterize folder name/location - name: "Ensuring we have a location to mount the disk to" - local_action: file path=/mnt/bootimg state=directory + file: path=/mnt/bootimg state=directory - name: "Mounting volume on /mnt/bootimg" - local_action: command mount "{{stored_value_loopback_beta.stdout}}" /mnt/bootimg + command: mount "{{stored_value_loopback_beta.stdout}}" /mnt/bootimg - name: "Binding /sys into /mnt/bootimg/sys" - local_action: command mount -t sysfs sysfs /mnt/bootimg/sys + command: mount -t sysfs sysfs /mnt/bootimg/sys - name: "Binding /proc into /mnt/bootimg/proc" - local_action: command mount -t proc proc /mnt/bootimg/proc + command: mount -t proc proc /mnt/bootimg/proc - name: "Binding /dev into /mnt/bootimg/dev" - local_action: command mount --bind /dev /mnt/bootimg/dev - # Attempt to identify kernel -#- name: "Identify kernel" -# local_action: shell ls vmlinuz* |cut -f 1 -d ' ' chdir=/mnt/bootimg/boot/ -# register: kernel_filename -#- name: "Identify initrd" -# local_action: shell ls initrd* |cut -f 1 -d ' ' chdir=/mnt/bootimg/boot/ -# register: initrd_filename + command: mount --bind /dev /mnt/bootimg/dev - name: "Disable Grub Prober" - local_action: shell echo "GRUB_DISABLE_OS_PROBER=true" >>/etc/default/grub + shell: echo "GRUB_DISABLE_OS_PROBER=true" >>/etc/default/grub - name: "Disable Grub Prober" - local_action: shell echo 'GRUB_TERMIAL="serial console"' >>/etc/default/grub + shell: echo 'GRUB_TERMIAL="serial console"' >>/etc/default/grub - name: "Run the grub-install tool" - local_action: command chroot /mnt/bootimg grub-install --boot-directory=/boot --modules="biosdisk part_msdos" "{{stored_value_loopback_alpha.stdout}}" + command: chroot /mnt/bootimg grub-install --boot-directory=/boot --modules="biosdisk part_msdos" "{{stored_value_loopback_alpha.stdout}}" - name: "Unlink /dev/bootimg/dev" - local_action: command umount /mnt/bootimg/dev + command: umount /mnt/bootimg/dev - name: "Unlink /dev/bootimg/proc" - local_action: command umount /mnt/bootimg/proc + command: umount /mnt/bootimg/proc - name: "Unlink /dev/bootimg/sys" - local_action: command umount /mnt/bootimg/sys + command: umount /mnt/bootimg/sys - name: "Unmounting image" - local_action: command umount /mnt/bootimg + command: umount /mnt/bootimg - name: "Detaching second loop device" - local_action: command losetup -d "{{stored_value_loopback_beta.stdout}}" + command: losetup -d "{{stored_value_loopback_beta.stdout}}" - name: "Removing partition map" - local_action: command kpartx -v -d "{{stored_value_loopback_alpha.stdout}}" + command: kpartx -v -d "{{stored_value_loopback_alpha.stdout}}" - name: "Detaching first loop device" - local_action: command losetup -d "{{stored_value_loopback_alpha.stdout}}" + command: losetup -d "{{stored_value_loopback_alpha.stdout}}" - name: "Moving image to .oldimg" - local_action: command mv "{{http_boot_folder}}/{{deploy_image_filename}}" "{{http_boot_folder}}/{{deploy_image_filename}}.oldimg" + command: mv "{{http_boot_folder}}/{{deploy_image_filename}}" "{{http_boot_folder}}/{{deploy_image_filename}}.oldimg" - name: "Moving new image into place" - local_action: command mv "{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" "{{http_boot_folder}}/{{deploy_image_filename}}" + command: mv "{{http_boot_folder}}/{{deploy_image_filename}}.bootimg" "{{http_boot_folder}}/{{deploy_image_filename}}" diff --git a/roles/ironic-install/tasks/dib_install.yml b/roles/ironic-install/tasks/dib_install.yml index 495b2a939..2ecd0df17 100644 --- a/roles/ironic-install/tasks/dib_install.yml +++ b/roles/ironic-install/tasks/dib_install.yml @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -- name: "Shade - Retrieving diskimage-builder from git.openstack.org" - local_action: command git clone https://git.openstack.org/openstack/diskimage-builder chdir=/opt/stack creates=/opt/stack/diskimage-builder -- name: "Shade - Checking out master branch" - local_action: command git checkout -f master chdir=/opt/stack/diskimage-builder -- name: "Shade - Resetting local repository" - local_action: command git reset --hard master chdir=/opt/stack/diskimage-builder -- name: "Shade - Resyncing local repository" - local_action: command git pull --ff-only chdir=/opt/stack/diskimage-builder -- name: "Shade - Installing patched library." - local_action: command pip install -I --force-reinstall /opt/stack/diskimage-builder +- name: "DIB - Retrieving diskimage-builder from git.openstack.org" + command: git clone https://git.openstack.org/openstack/diskimage-builder chdir=/opt/stack creates=/opt/stack/diskimage-builder +- name: "DIB - Checking out master branch" + command: git checkout -f master chdir=/opt/stack/diskimage-builder +- name: "DIB- Resetting local repository" + command: git reset --hard master chdir=/opt/stack/diskimage-builder +- name: "DIB - Resyncing local repository" + command: git pull --ff-only chdir=/opt/stack/diskimage-builder +- name: "DIB - Installing patched library." + command: pip install -I --force-reinstall /opt/stack/diskimage-builder diff --git a/roles/ironic-install/tasks/main.yml b/roles/ironic-install/tasks/main.yml index 03c2dd183..167125a6f 100644 --- a/roles/ironic-install/tasks/main.yml +++ b/roles/ironic-install/tasks/main.yml @@ -14,18 +14,18 @@ # limitations under the License. --- - name: "Update Package Cache" - local_action: apt update_cache=yes + apt: update_cache=yes - name: "Install packages" - local_action: apt name={{ item }} + apt: name={{ item }} with_items: required_packages_ubuntu # Step required for Ubuntu 14.10 - name: "Install 14.10 packages" - local_action: apt name={{ item }} + apt: name={{ item }} with_items: - pxelinux when: ansible_distribution_version|version_compare('14.10', '>=') - name: "Install testing packages" - local_action: apt name={{ item }} + apt: name={{ item }} with_items: - libvirt-bin - qemu-utils @@ -33,52 +33,43 @@ - sgabios when: testing == true - name: "Ensuring /opt/stack is present" - local_action: file name=/opt/stack state=directory owner=root group=root -# This won't be necessary in the long run, however until a suitable version -# lands upstream, it is required. + file: name=/opt/stack state=directory owner=root group=root - name: "Retrieving latest known os_ironic.py file" - local_action: get_url url={{ latest_os_ironic_url }} dest=/opt/stack/ansible/lib/ansible/modules/extras/cloud/os_ironic.py + get_url: url={{ latest_os_ironic_url }} dest=/opt/stack/ansible/lib/ansible/modules/extras/cloud/os_ironic.py - name: "Retrieving latest known os_ironic_node.py file" - local_action: get_url url={{ latest_os_ironic_node_url }} dest=/opt/stack/ansible/lib/ansible/modules/extras/cloud/os_ironic_node.py + get_url: url={{ latest_os_ironic_node_url }} dest=/opt/stack/ansible/lib/ansible/modules/extras/cloud/os_ironic_node.py - name: "Downloading Ironic" - local_action: command git clone https://git.openstack.org/openstack/ironic chdir=/opt/stack creates=/opt/stack/ironic + command: git clone https://git.openstack.org/openstack/ironic chdir=/opt/stack creates=/opt/stack/ironic - name: "Ironic - checking out master branch" - local_action: command git checkout -f master chdir=/opt/stack/ironic + command: git checkout -f master chdir=/opt/stack/ironic - name: "Ironic - resetting master branch" - local_action: command git reset --hard master chdir=/opt/stack/ironic + command: git reset --hard master chdir=/opt/stack/ironic - name: "Ironic - resyncing to current master branch" - local_action: command git pull --ff-only chdir=/opt/stack/ironic/ -# As of 20150302 155728 has merged. Leaving code present but commented out for future -# cases where we need to apply a specific patch at this time. -# - name: "Ironic - Downloading PXE support for IPA" -# local_action: command git fetch https://review.openstack.org/openstack/ironic refs/changes/28/155728/16 chdir=/opt/stack/ironic -#- name: "Ironic - Checking out PXE support for IPA" -# local_action: command git checkout FETCH_HEAD chdir=/opt/stack/ironic -### End comment out + command: git pull --ff-only chdir=/opt/stack/ironic/ # TODO: The pip installation of python-ironicclient is disabled in order to # support rev 158520. #- name: "Install ironic client" -# local_action: pip name=python-ironicclient state=present +# pip name=python-ironicclient state=present - name: "python-ironicclient - Retrieving library from git.openstack.org" - local_action: command git clone https://review.openstack.org/openstack/python-ironicclient chdir=/opt/stack creates=/opt/stack/python-ironicclient + command: git clone https://review.openstack.org/openstack/python-ironicclient chdir=/opt/stack creates=/opt/stack/python-ironicclient - name: "python-ironicclient - Checking out master branch" - local_action: command git checkout -f master chdir=/opt/stack/python-ironicclient + command: git checkout -f master chdir=/opt/stack/python-ironicclient - name: "python-ironicclient - Resetting local repository" - local_action: command git reset --hard master chdir=/opt/stack/python-ironicclient + command: git reset --hard master chdir=/opt/stack/python-ironicclient - name: "python-ironicclient - Resyncing local repository" - local_action: command git pull --ff-only chdir=/opt/stack/python-ironicclient + command: git pull --ff-only chdir=/opt/stack/python-ironicclient # This patch is https://review.openstack.org/#/c/158520/ which adds support # for use of node names instead of UUIDs. We don't presently utilize this # but it can be supported at some point. - name: "python-ironicclient - Downloading patch for logical names in Ironic" - local_action: command git fetch https://review.openstack.org/openstack/python-ironicclient refs/changes/20/158520/1 chdir=/opt/stack/python-ironicclient + command: git fetch https://review.openstack.org/openstack/python-ironicclient refs/changes/20/158520/1 chdir=/opt/stack/python-ironicclient - name: "python-ironicclient - Checking out patch." - local_action: command git checkout FETCH_HEAD chdir=/opt/stack/python-ironicclient + command: git checkout FETCH_HEAD chdir=/opt/stack/python-ironicclient - name: "python-ironicclient - Installing patched python-ironicclient library." - local_action: command pip install -I --force-reinstall /opt/stack/python-ironicclient + command: pip install -I --force-reinstall /opt/stack/python-ironicclient when: skip_install is not defined - name: "proliantutils - Install from pip" - local_action: pip name=proliantutils state=present + pip: name=proliantutils state=present when: skip_install is not defined # TODO: The next package is installed via git and then manyally installed # as the os_ironic and os_ironic_node are under active development and @@ -87,186 +78,185 @@ # be converted to an include... or consider converting to the integrated # git module. - name: "Shade - Retrieving library from git.openstack.org" - local_action: command git clone https://review.openstack.org/openstack-infra/shade chdir=/opt/stack creates=/opt/stack/shade + command: git clone https://review.openstack.org/openstack-infra/shade chdir=/opt/stack creates=/opt/stack/shade - name: "Shade - Checking out master branch" - local_action: command git checkout -f master chdir=/opt/stack/shade + command: git checkout -f master chdir=/opt/stack/shade - name: "Shade - Resetting local repository" - local_action: command git reset --hard master chdir=/opt/stack/shade + command: git reset --hard master chdir=/opt/stack/shade - name: "Shade - Resyncing local repository" - local_action: command git pull --ff-only chdir=/opt/stack/shade + command: git pull --ff-only chdir=/opt/stack/shade - name: "Shade - Installing patched shade library." - local_action: command pip install -I --force-reinstall /opt/stack/shade + command: pip install -I --force-reinstall /opt/stack/shade when: skip_install is not defined - name: "Include diskimage-builder installation" include: dib_install.yml when: create_image_via_dib == true - name: "Starting MySQL" - local_action: service name=mysql state=started + service: name=mysql state=started - name: "Starting rabbitmq-server" - local_action: service name=rabbitmq-server state=started + service: name=rabbitmq-server state=started - name: "RabbitMQ - Testing if hostname is defined firsts in /etc/hosts" - local_action: command grep -i "127.0.0.1*.{{ ansible_hostname }}\ localhost" /etc/hosts + command: grep -i "127.0.0.1*.{{ ansible_hostname }}\ localhost" /etc/hosts ignore_errors: yes register: test_grep_fix_hostname - name: "RabbitMQ - Fixing /etc/hosts" - local_action: command sed -i 's/localhost/{{ ansible_hostname }} localhost/' /etc/hosts + command: sed -i 's/localhost/{{ ansible_hostname }} localhost/' /etc/hosts when: test_grep_fix_hostname.rc != 0 - name: "Ensuring guest user is removed from rabbitmq" - local_action: rabbitmq_user user=guest state=absent force=yes + rabbitmq_user: user=guest state=absent force=yes - name: "Creating Ironic user in RabbitMQ" - local_action: rabbitmq_user user=ironic password={{ ironic_db_password }} force=yes state=present configure_priv=.* write_priv=.* read_priv=.* + rabbitmq_user: user=ironic password={{ ironic_db_password }} force=yes state=present configure_priv=.* write_priv=.* read_priv=.* no_log: true - name: "MySQL - Creating DB" - local_action: mysql_db login_user=root login_password={{ mysql_password }} name=ironic state=present encoding=utf8 + mysql_db: login_user=root login_password={{ mysql_password }} name=ironic state=present encoding=utf8 register: test_created_db no_log: True - name: "MySQL - Creating user for Ironic" - local_action: mysql_user login_user=root login_password={{ mysql_password }} name=ironic password={{ ironic_db_password }} priv=ironic.*:ALL state=present + mysql_user: login_user=root login_password={{ mysql_password }} name=ironic password={{ ironic_db_password }} priv=ironic.*:ALL state=present no_log: True - name: "Install Ironic using pip" - local_action: pip name=/opt/stack/ironic state=latest + pip: name=/opt/stack/ironic state=latest when: skip_install is not defined - name: "Ensure /etc/ironic exists" - local_action: file name=/etc/ironic state=directory + file: name=/etc/ironic state=directory - name: "Place Ironic Config file" - local_action: template src=ironic.conf.j2 dest=/etc/ironic/ironic.conf + template: src=ironic.conf.j2 dest=/etc/ironic/ironic.conf - name: "Place Ironic IPA Agent PXE configuration file" - local_action: template src=agent_config.template.j2 dest=/etc/ironic/agent_config.template + template: src=agent_config.template.j2 dest=/etc/ironic/agent_config.template - name: "Copy policy.json to /etc/ironic" - local_action: copy src=/opt/stack/ironic/etc/ironic/policy.json dest=/etc/ironic/ + copy: src=/opt/stack/ironic/etc/ironic/policy.json dest=/etc/ironic/ - name: "Creating Ironic DB Schema" - local_action: command ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema + command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema when: test_created_db.changed == true - name: "Upgrading Ironic DB Schema" - local_action: command ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade + command: ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade when: test_created_db.changed == false - name: "Creating an ironic service group" - local_action: group name=ironic + group: name=ironic - name: "Creating an ironic service user" - local_action: user name=ironic group=ironic + user: name=ironic group=ironic - name: "Adding ironic user to libvirtd group" - local_action: user name=ironic group=libvirtd append=yes + user: name=ironic group=libvirtd append=yes when: testing == true - name: "Placing services" - local_action: template src=init_template.j2 dest=/etc/init/{{item.service_name}}.conf owner=root group=root + template: src=init_template.j2 dest=/etc/init/{{item.service_name}}.conf owner=root group=root with_items: - { service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'} - { service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'} - name: "Start ironic-conductor" - local_action: service name=ironic-conductor state=started + service: name=ironic-conductor state=started - name: "Start ironic-api" - local_action: service name=ironic-api state=started + service: name=ironic-api state=started - name: "Start ironic-conductor" - local_action: service name=ironic-conductor state=restarted + service: name=ironic-conductor state=restarted - name: "Start ironic-api" - local_action: service name=ironic-api state=reloaded + service: name=ironic-api state=reloaded - name: "Setting up PXE and iPXE folders" - local_action: file name={{item}} owner=ironic group=ironic state=directory + file: name={{item}} owner=ironic group=ironic state=directory with_items: - /tftpboot - /tftpboot/pxelinux.cfg - "{{ http_boot_folder }}" - name: "Placing tftpd map-file" - local_action: copy src=tftpboot-map-file dest=/tftpboot/map-file owner=ironic group=ironic -# TODO: This should not be shell, fix. -- name: "Disable tftpd-hpa by setting it to manual start" - local_action: shell echo "manual" > /etc/init/tftpd-hpa.override + copy: src=tftpboot-map-file dest=/tftpboot/map-file owner=ironic group=ironic - name: "Disable service tftpd-hpa" - local_action: service name=tftpd-hpa state=stopped enabled=no + service: name=tftpd-hpa state=stopped enabled=no - name: "Placing pxelinux.0 (pre-14.10)" - local_action: copy src=/usr/lib/syslinux/pxelinux.0 dest=/tftpboot + copy: src=/usr/lib/syslinux/pxelinux.0 dest=/tftpboot when: ansible_distribution_version|version_compare('14.10', '<') - name: "Placing pxelinux.0 (>=14.10)" - local_action: copy src=/usr/lib/PXELINUX/pxelinux.0 dest=/tftpboot + copy: src=/usr/lib/PXELINUX/pxelinux.0 dest=/tftpboot when: ansible_distribution_version|version_compare('14.10', '>=') - name: "Place boot.ipxe helper script to HTTP root" - local_action: copy src=boot.ipxe dest=/httpboot/boot.ipxe + copy: src=boot.ipxe dest=/httpboot/boot.ipxe - name: "Place tftp config file" - local_action: copy src=xinetd.tftp dest=/etc/xinetd.d/tftp + copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp - name: "Copy iPXE image into place" - local_action: copy src=/usr/lib/ipxe/undionly.kpxe dest=/tftpboot/ + copy: src=/usr/lib/ipxe/undionly.kpxe dest=/tftpboot/ - name: "Deploy dnsmasq configuration file" - local_action: template src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf - + template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf # 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 # are not controlled by upstart, so we need to manually kill those. - name: "Looking for libvirt dnsmasq config" - local_action: stat path=/etc/dnsmasq.d/libvirt-bin + stat: path=/etc/dnsmasq.d/libvirt-bin register: test_libvirt_dnsmasq - name: "Disabling libvirt dnsmasq config" - local_action: command mv /etc/dnsmasq.d/libvirt-bin /etc/dnsmasq.d/libvirt-bin~ + command: mv /etc/dnsmasq.d/libvirt-bin /etc/dnsmasq.d/libvirt-bin~ when: test_libvirt_dnsmasq == true and testing == true - name: "Stopping existing libvirt dnsmasq processes" - local_action: command killall -w dnsmasq + command: killall -w dnsmasq when: testing == true # NOTE(Shrews) We need to enable ip forwarding for the libvirt bridge to # operate properly with dnsmasq. This should be done before starting dnsmasq. - name: "Enabling IP forwarding in sysctl" - local_action: sysctl name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes + sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes when: testing == true # NOTE(Shrews) Ubuntu packaging+apparmor issue prevents libvirt from loading # the ROM from /usr/share/misc. - name: "Looking for sgabios in /usr/share/qemu" - local_action: stat path=/usr/share/qemu/sgabios.bin + stat: path=/usr/share/qemu/sgabios.bin register: test_sgabios_qemu - name: "Looking for sgabios in /usr/share/misc" - local_action: stat path=/usr/share/misc/sgabios.bin + stat: path=/usr/share/misc/sgabios.bin register: test_sgabios_misc - name: "Place sgabios.bin" - local_action: command cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin + command: cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin when: test_sgabios_qemu == false and test_sgabios_misc == true and testing == true - - name: "Deploying nginx configuration file for serving HTTP requests" - local_action: template src=nginx.conf.j2 dest=/etc/nginx/nginx.conf + template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf - name: "Ensuring dnsmasq is running" - local_action: service name={{ item }} state=started + service: name={{ item }} state=started with_items: - xinetd - dnsmasq - nginx - name: "Sending services a reload signal" - local_action: service name={{ item }} state=reloaded + service: name={{ item }} state=reloaded with_items: - xinetd - nginx - name: "Sending services a force-reload signal" - local_action: command /etc/init.d/dnsmasq force-reload + command: /etc/init.d/dnsmasq force-reload # Similar logic to below can be utilized to retrieve files - name: "Determine if folder exists, else create and populate folder." - local_action: stat path=/tftpboot/master_images + stat: path=/tftpboot/master_images register: test_master_images - name: "Create master_images folder" - local_action: 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 # This is overly complex, however get_url will always re-retrieve the file # if it already exists, and this is to prevent that behavior. - name: "Test if CoreOS kernel is present" - local_action: stat path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz + stat: path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz register: test_core_os_kernel_present - name: "Download CoreOS kernel" - local_action: get_url url=http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe.vmlinuz dest={{ http_boot_folder }}/coreos_production_pxe.vmlinuz + get_url: url=http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe.vmlinuz dest={{ http_boot_folder }}/coreos_production_pxe.vmlinuz when: test_core_os_kernel_present.stat.exists == false - name: "Test if CoreOS image is present" - local_action: stat path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz + stat: path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz register: test_core_os_image_present - name: "Download CoreOS image" - local_action: get_url url=http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz dest={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz + get_url: url=http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz dest={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz when: test_core_os_image_present.stat.exists == false - name: "Test if Ubuntu 14.04 server cloud amd64 is present" - local_action: stat path={{ deploy_image }} + stat: path={{ deploy_image }} register: test_os_image_present -# TODO(Julia) This needs to be entirely variablized and made a toggable setting, or auto-discovered? -# Anything better! - name: "Download Ubuntu image" - local_action: get_url url=http://cloud-images.ubuntu.com/releases/trusty/release/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz + get_url: url=http://cloud-images.ubuntu.com/releases/trusty/release/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz when: test_os_image_present.stat.exists == false and create_image_via_dib == false - name: "Extract Ubuntu image" - local_action: command tar -xvzf ubuntu-14.04-server-cloudimg-amd64.tar.gz chdir=/httpboot creates=/httpboot/trusty-server-cloudimg-amd64.img + command: tar -xvzf ubuntu-14.04-server-cloudimg-amd64.tar.gz chdir=/httpboot creates=/httpboot/trusty-server-cloudimg-amd64.img when: test_os_image_present.stat.exists == false and create_image_via_dib == false + # Create bootable image takes a partition image, prepends space for a + # bootloader, partition table, and then installs the bootloader. + # + # If attempting to utilize a base Ubuntu image, diskimage-builder + # is the recommended, and default path. - name: "Creating bootable image" include: create_bootable_image.yml when: test_os_image_present.stat.exists == false and transform_boot_image == true and create_image_via_dib == false + # DIB is presently the default path. - name: "Creating image via disk imae builder" include: create_dib_image.yml when: test_os_image_present.stat.exists == false and transform_boot_image == false and create_image_via_dib == true