From d206ef0f46d161874b006cb80952650e4b265d0a Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Mon, 15 Jun 2015 19:14:55 +0000 Subject: [PATCH] Finally make the fedora infra cloud playbook idempotent Don't set root password in base and again later in host playbook. Download rpms and make sure they are installed rather than using url in yum module. Move cinder restart to a handler. --- handlers/restart_services.yml | 5 +++ .../fed-cloud09.cloud.fedoraproject.org.yml | 44 ++++++++++++++++--- roles/base/tasks/main.yml | 2 +- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/handlers/restart_services.yml b/handlers/restart_services.yml index 1f9b83a0bf..8d951c38fb 100644 --- a/handlers/restart_services.yml +++ b/handlers/restart_services.yml @@ -180,3 +180,8 @@ - name: restart stunnel service: name=stunnel state=restarted + +- name: restart cinder + service: name=openstack-cinder-api state=restarted + service: name=openstack-cinder-scheduler state=restarted + service: name=openstack-cinder-volume state=restarted diff --git a/playbooks/hosts/fed-cloud09.cloud.fedoraproject.org.yml b/playbooks/hosts/fed-cloud09.cloud.fedoraproject.org.yml index 8505027f52..bbd6cf3be5 100644 --- a/playbooks/hosts/fed-cloud09.cloud.fedoraproject.org.yml +++ b/playbooks/hosts/fed-cloud09.cloud.fedoraproject.org.yml @@ -163,10 +163,21 @@ get_url: url=https://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm dest=/root/ - yum: state=present name=/root/rdo-release-icehouse-4.noarch.rpm + - name: make sure epel-release is installed + get_url: url=http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm dest=/root/ + - yum: state=present name=/root/epel-release-latest-7.noarch.rpm + + - name: make sure latest openvswitch is installed + get_url: url=http://people.redhat.com/~lkellogg/rpms/openvswitch-2.3.1-2.git20150113.el7.x86_64.rpm dest=/root/ + - yum: state=present name=/root/openvswitch-2.3.1-2.git20150113.el7.x86_64.rpm + + - name: make sure latest openstack-utils is installed + get_url: url=https://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-7/openstack-utils-2014.2-1.el7.centos.noarch.rpm dest=/root/ + - yum: state=present name=/root/openstack-utils-2014.2-1.el7.centos.noarch.rpm + - name: install basic openstack packages action: yum state=present name={{ item }} with_items: - - http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm - openstack-utils - openstack-selinux - openstack-packstack @@ -177,8 +188,6 @@ - openstack-neutron - openstack-nova-common - haproxy - - http://people.redhat.com/~lkellogg/rpms/openvswitch-2.3.1-2.git20150113.el7.x86_64.rpm - - https://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-7/openstack-utils-2014.2-1.el7.centos.noarch.rpm - name: install etckeeper action: yum state=present name=etckeeper @@ -518,26 +527,47 @@ notify: - restart httpd - # configure cider with multi back-end # https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/5/html/Cloud_Administrator_Guide/section_manage-volumes.html - ini_file: dest=/etc/cinder/cinder.conf section=DEFAULT option="enabled_backends" value="equallogic-1,lvmdriver-1" + notify: + - restart cinder # LVM - ini_file: dest=/etc/cinder/cinder.conf section="lvmdriver-1" option="volume_group" value="cinder-volumes" + notify: + - restart cinder - ini_file: dest=/etc/cinder/cinder.conf section="lvmdriver-1" option="volume_driver" value="cinder.volume.drivers.lvm.LVMISCSIDriver" + notify: + - restart cinder - ini_file: dest=/etc/cinder/cinder.conf section="lvmdriver-1" option="volume_backend_name" value="LVM_iSCSI" + notify: + - restart cinder # Dell EqualLogic - http://docs.openstack.org/trunk/config-reference/content/dell-equallogic-driver.html - ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="volume_driver" value="cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver" + notify: + - restart cinder - ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="san_ip" value="{{ IP_EQLX }}" + notify: + - restart cinder - ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="san_login" value="{{ SAN_UNAME }}" + notify: + - restart cinder - name: set password for equallogic-1 ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="san_password" value="{{ SAN_PW }}" + notify: + - restart cinder - ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="eqlx_group_name" value="{{ EQLX_GROUP }}" + notify: + - restart cinder - ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="eqlx_pool" value="{{ EQLX_POOL }}" + notify: + - restart cinder - ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="volume_backend_name" value="equallogic" - - service: name=openstack-cinder-api state=restarted - - service: name=openstack-cinder-scheduler state=restarted - - service: name=openstack-cinder-volume state=restarted + notify: + - restart cinder + + # flush handlers here in case cinder changes and we need to restart it. + - meta: flush_handlers # create storage types # note that existing keys can be retrieved using: cinder extra-specs-list diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index bc76aff83c..45cff54e22 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -56,7 +56,7 @@ tags: - rootpw - base - when: not (inventory_hostname.startswith('rawhide') or inventory_hostname.startswith('branched') or inventory_hostname.startswith('compose') or inventory_hostname.startswith('build') or inventory_hostname.startswith('arm') or inventory_hostname.startswith('bkernel') or inventory_hostname.startswith('koji01.stg') or inventory_hostname.startswith('aarch64') or inventory_hostname.startswith('s390')) + when: not (inventory_hostname.startswith('rawhide') or inventory_hostname.startswith('branched') or inventory_hostname.startswith('compose') or inventory_hostname.startswith('build') or inventory_hostname.startswith('arm') or inventory_hostname.startswith('bkernel') or inventory_hostname.startswith('koji01.stg') or inventory_hostname.startswith('aarch64') or inventory_hostname.startswith('s390') or inventory_hostname.startswith('fed-cloud09')) - name: add ansible root key authorized_key: user=root key="{{ item }}"