Refactoring post andymccr review and suggestions

This commit is contained in:
Michael Davies 2016-01-18 03:57:40 +00:00
parent fffaf0e52d
commit 7869e67bd8
7 changed files with 95 additions and 40 deletions

View File

@ -49,10 +49,10 @@ ironic_service_names:
ironic_standalone: True ironic_standalone: True
# Database # Database
ironic_database_user: ironic ironic_galera_user: ironic
ironic_database_database: ironic ironic_galera_database: ironic
ironic_database_address: localhost ironic_galera_address: localhost
ironic_database_password: gu1d0 ironic_galera_password: gu1d0
# TBD(mrda): need to handle this a little better :) # TBD(mrda): need to handle this a little better :)
database_root_user: root database_root_user: root
@ -94,6 +94,12 @@ ironic_common_apt_packages:
ironic_common_pip_packages: ironic_common_pip_packages:
- virtualenvwrapper - virtualenvwrapper
ironic_pip_packages:
- ironic
python_ironicclient_pip_packages:
- python_ironicclient
ironic_conductor_apt_packages: ironic_conductor_apt_packages:
- libmysqlclient-dev - libmysqlclient-dev
- libxml2-dev - libxml2-dev

View File

@ -15,27 +15,29 @@
- name: Create database for ironic - name: Create database for ironic
mysql_db: mysql_db:
#login_user: "{{ database_root_user }}" login_user: "{{ galera_root_user }}"
#login_password: "{{ database_root_password }}" login_password: "{{ galera_root_password }}"
#login_host: "{{ ironic_database_address }}" login_host: "{{ ironic_galera_address }}"
name: "{{ ironic_database_database }}" name: "{{ ironic_galera_database }}"
state: "present" state: "present"
register: ironic_db
tags: tags:
- ironic-db-setup - ironic-db-setup
- name: Grant access to the DB - name: Grant access to the DB
mysql_user: mysql_user:
#login_user: "{{ database_root_user }}" login_user: "{{ galera_root_user }}"
#login_password: "{{ database_root_password }}" login_password: "{{ galera_root_password }}"
#login_host: "{{ ironic_database_address }}" login_host: "{{ ironic_database_address }}"
name: "{{ ironic_database_user }}" name: "{{ ironic_galera_user }}"
password: "{{ ironic_database_password }}" password: "{{ ironic_galera_password }}"
host: "{{ item }}" host: "{{ item }}"
state: "present" state: "present"
priv: "{{ ironic_database_database }}.*:ALL" priv: "{{ ironic_galera_database }}.*:ALL"
with_items: with_items:
- "localhost" - "localhost"
- "%" - "%"
when: ironic_db.changed == True
tags: tags:
- ironic-db-setup - ironic-db-setup
@ -45,7 +47,18 @@
sudo_user: "{{ ironic_system_user_name }}" sudo_user: "{{ ironic_system_user_name }}"
notify: notify:
- Restart ironic services - Restart ironic services
when: ironic_checkout.changed when: ironic_db.changed == True
tags:
- ironic-db-setup
- ironic-conductor
- name: Update database schema
command: "{{ ironic_bin }}/ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade"
sudo: yes
sudo_user: "{{ ironic_system_user_name }}"
notify:
- Restart ironic services
when: ironic_db.changed == False
tags: tags:
- ironic-db-setup - ironic-db-setup
- ironic-conductor - ironic-conductor

View File

@ -13,19 +13,37 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Install Ironic (python system library) - name: Install pip packages (venv)
when: ironic_checkout.changed and not ironic_venv_enabled
pip: pip:
name: "file://{{ ironic_git_dest }}" name: "{{ item }}"
state: present
virtualenv: "{{ ironic_venv_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ ironic_pip_packages }}"
when:
- ironic_venv_enabled | bool
tags: tags:
- ironic-api - ironic-install
- ironic-conductor - ironic-pip-packages
- name: Install Ironic (openstack venv) - name: Install pip packages (no venv)
when: ironic_checkout.changed and ironic_venv_enabled
pip: pip:
name: "file://{{ ironic_git_dest }}" name: "{{ item }}"
virtualenv: "/openstack/venvs/ironic-{{ ironic_venv_tag }}" state: present
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ ironic_pip_packages }}"
when: not ironic_venv_enabled | bool
tags: tags:
- ironic-api - ironic-install
- ironic-conductor - ironic-pip-packages

View File

@ -45,6 +45,3 @@
tags: tags:
- ironic-init - ironic-init
# TODO(mrda): Configure rabbit if standalone

View File

@ -14,9 +14,9 @@
# limitations under the License. # limitations under the License.
- include: ironic_pre_install.yml - include: ironic_pre_install.yml
- include: ironic_get_source.yml # - include: ironic_get_source.yml
- include: ironic_conductor_pre_install.yml
- include: ironic_install.yml - include: ironic_install.yml
- include: ironic_conductor_install.yml
- include: python_ironicclient_install.yml - include: python_ironicclient_install.yml
- include: ironic_post_install.yml - include: ironic_post_install.yml
- include: ironic_conductor_post_install.yml - include: ironic_conductor_post_install.yml

View File

@ -13,17 +13,38 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Install Python-Ironicclient (python system library) - name: Install pip packages (venv)
when: python_ironicclient_checkout.changed and not ironic_venv_enabled
pip: pip:
name: "file://{{ python_ironicclient_git_dest }}" name: "{{ item }}"
state: present
virtualenv: "{{ ironic_venv_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ python_ironicclient_pip_packages }}"
when:
- ironic_venv_enabled | bool
tags: tags:
- ironic-client - ironicclient-install
- ironicclient-pip-packages
- name: Install Python-Ironicclient (openstack venv) - name: Install pip packages (no venv)
when: python_ironicclient_checkout.changed and ironic_venv_enabled
pip: pip:
name: "file://{{ python_ironicclient_git_dest }}" name: "{{ item }}"
virtualenv: "/openstack/venvs/ironic-{{ ironic_venv_tag }}" state: present
extra_args: "{{ pip_install_options|default('') }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ python_ironicclient_pip_packages }}"
when: not ironic_venv_enabled | bool
tags: tags:
- ironic-client - ironicclient-install
- ironicclient-pip-packages