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.
This commit is contained in:
Kevin Fenzi 2015-06-15 19:14:55 +00:00
parent d86702c4f3
commit d206ef0f46
3 changed files with 43 additions and 8 deletions

View file

@ -180,3 +180,8 @@
- name: restart stunnel - name: restart stunnel
service: name=stunnel state=restarted 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

View file

@ -163,10 +163,21 @@
get_url: url=https://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm dest=/root/ 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 - 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 - name: install basic openstack packages
action: yum state=present name={{ item }} action: yum state=present name={{ item }}
with_items: with_items:
- http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
- openstack-utils - openstack-utils
- openstack-selinux - openstack-selinux
- openstack-packstack - openstack-packstack
@ -177,8 +188,6 @@
- openstack-neutron - openstack-neutron
- openstack-nova-common - openstack-nova-common
- haproxy - 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 - name: install etckeeper
action: yum state=present name=etckeeper action: yum state=present name=etckeeper
@ -518,26 +527,47 @@
notify: notify:
- restart httpd - restart httpd
# configure cider with multi back-end # 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 # 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" - ini_file: dest=/etc/cinder/cinder.conf section=DEFAULT option="enabled_backends" value="equallogic-1,lvmdriver-1"
notify:
- restart cinder
# LVM # LVM
- ini_file: dest=/etc/cinder/cinder.conf section="lvmdriver-1" option="volume_group" value="cinder-volumes" - 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" - 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" - 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 # 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" - 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 }}" - 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 }}" - 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 - name: set password for equallogic-1
ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="san_password" value="{{ SAN_PW }}" 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 }}" - 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 }}" - 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" - ini_file: dest=/etc/cinder/cinder.conf section="equallogic-1" option="volume_backend_name" value="equallogic"
- service: name=openstack-cinder-api state=restarted notify:
- service: name=openstack-cinder-scheduler state=restarted - restart cinder
- service: name=openstack-cinder-volume state=restarted
# flush handlers here in case cinder changes and we need to restart it.
- meta: flush_handlers
# create storage types # create storage types
# note that existing keys can be retrieved using: cinder extra-specs-list # note that existing keys can be retrieved using: cinder extra-specs-list

View file

@ -56,7 +56,7 @@
tags: tags:
- rootpw - rootpw
- base - 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 - name: add ansible root key
authorized_key: user=root key="{{ item }}" authorized_key: user=root key="{{ item }}"