From a1e6e4dca8a2f72760ebbb1ed43ceaccfb8a57dd Mon Sep 17 00:00:00 2001 From: John Trowbridge Date: Tue, 2 Feb 2016 15:58:11 -0500 Subject: [PATCH] Use wget instead of ansible get_url module The ansible get_url module uses curl, which is not tolerant of flaky HTTP connections. The wget command on the other hand has built-in retry with resume. Change-Id: Ibac865cc951be998f64bf5b846151043c0b393aa --- README.rst | 27 +++---------------- .../libvirt/setup/undercloud/tasks/main.yml | 20 +++++--------- .../undercloud/templates/get-undercloud.sh.j2 | 9 +++++++ 3 files changed, 20 insertions(+), 36 deletions(-) create mode 100644 playbooks/roles/libvirt/setup/undercloud/templates/get-undercloud.sh.j2 diff --git a/README.rst b/README.rst index f85cef940..6cece3ce9 100644 --- a/README.rst +++ b/README.rst @@ -19,25 +19,7 @@ ready to rock is:: The defaults are meant to "just work", so it is as easy as downloading and running the quickstart.sh script. -Or rather it will be once we have a good place to host the -images. The centosci artifacts server drops the http connection -regularly, so we need to use wget for the built in retry with -resume. From the machine that will be the virthost, create a -directory for the undercloud image and wget it. Note, the -image location should be world readable since a ``stack`` user -is used for most steps.:: - - mkdir -p /usr/share/quickstart_images/mitaka/ - cd /usr/share/quickstart_images/mitaka/ - wget https://ci.centos.org/artifacts/rdo/images/mitaka/delorean/stable/undercloud.qcow2.md5 \ - https://ci.centos.org/artifacts/rdo/images/mitaka/delorean/stable/undercloud.qcow2 - - # Check that the md5sum's match (The playbook will also - # check, but better to know now whether the image download - # was ok.) - md5sum -c undercloud.qcow2.md5 - -Then use the quickstart.sh script to install this repo along +The quickstart.sh script will install this repo along with ansible in a virtual environment and run the quickstart playbook. Note, the quickstart playbook will delete the ``stack`` user on the virthost and recreate it.:: @@ -49,10 +31,9 @@ user on the virthost and recreate it.:: bash quickstart.sh -u $UNDERCLOUD_QCOW2_LOCATION $VIRTHOST This script will output instructions at the end to access the -deployed undercloud. Note that to use a different release you will need to -download a different undercloud image in the first step above. -For example, for liberty: -https://ci.centos.org/artifacts/rdo/images/liberty/delorean/stable/undercloud.qcow2 +deployed undercloud. If a release name is not given, ``mitaka`` +is used. + Documentation ============= diff --git a/playbooks/roles/libvirt/setup/undercloud/tasks/main.yml b/playbooks/roles/libvirt/setup/undercloud/tasks/main.yml index 7a1737e8d..2dfacce4a 100644 --- a/playbooks/roles/libvirt/setup/undercloud/tasks/main.yml +++ b/playbooks/roles/libvirt/setup/undercloud/tasks/main.yml @@ -8,20 +8,14 @@ bridges: "{{ networks.bridges }}" register: undercloud_mac_map -- name: get expected md5 of undercloud appliance - shell: curl {{ url }}.md5 | awk '{ print $1 }' - register: undercloud_md5 +- name: Create script to get the undercloud appliance + template: + src: get-undercloud.sh.j2 + dest: "{{ working_dir }}/get-undercloud.sh" + mode: 0744 -- name: get undercloud appliance - register: get_undercloud_result - until: get_undercloud_result.msg.find('did not match') == -1 - retries: 3 - delay: 10 - get_url: - url: '{{ url }}' - dest: '{{ working_dir }}' - timeout: 1200 - checksum: 'md5:{{ undercloud_md5.stdout }}' +- name: Get the undercloud appliance + shell: "{{ working_dir }}/get-undercloud.sh" - name: copy instackenv.json to appliance shell: > diff --git a/playbooks/roles/libvirt/setup/undercloud/templates/get-undercloud.sh.j2 b/playbooks/roles/libvirt/setup/undercloud/templates/get-undercloud.sh.j2 new file mode 100644 index 000000000..d22cb99c7 --- /dev/null +++ b/playbooks/roles/libvirt/setup/undercloud/templates/get-undercloud.sh.j2 @@ -0,0 +1,9 @@ +set -ex + +sudo yum install -y wget --quiet +# Use wget rather than get_url module for its +# retry with resume feature +pushd {{ working_dir }} +wget --quiet {{ url }}.md5 {{ url }} +md5sum -c undercloud.qcow2.md5 +popd \ No newline at end of file