Refactor ironic-install playbook to support CentOS & RHEL
Refactor the ironic-install role so that it can be used on Centos and RHEL. Also add a new template for systemd configuration so we can install and run the ironic services. Document the additional steps that RHEL and CentOS users will need to take to get bifrost up and running. Install gcc in env-setup.sh as it is needed to install pip and we can't take it for granted. Temporarily remove amttool from RedHat family dependencies since it's not currently packaged for RHEL or CentOS 7. We'll handle this in a separate patch. Change libxslt-dev to libxslt1-dev as it is the correct name for the package. Closes-Bug: 1460930 Closes-Bug: 1456896 Partial-Bug: 1463871 Change-Id: I72a5b329d3c55350644a777b5a77d61947c921bc
This commit is contained in:
parent
2cff0c1fe7
commit
5a180949a2
47
README.rst
47
README.rst
@ -24,6 +24,53 @@ Supported Operating Systems:
|
|||||||
* Red Hat Enterprise Linux (RHEL) 7
|
* Red Hat Enterprise Linux (RHEL) 7
|
||||||
* CentOS 7
|
* CentOS 7
|
||||||
|
|
||||||
|
Pre-install steps
|
||||||
|
=================
|
||||||
|
|
||||||
|
Installing bifrost on RHEL or CentOS requires a few extra pre-install steps.
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
Enable additional repositories (RHEL only)
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
The extras and optional yum repositories must be enabled to satisfy bifrost's dependencies. To check::
|
||||||
|
|
||||||
|
sudo yum repolist | grep 'optional\|extras'
|
||||||
|
|
||||||
|
To add the repositories::
|
||||||
|
|
||||||
|
sudo yum repolist all | grep 'optional\|extras'
|
||||||
|
|
||||||
|
The output will look like this::
|
||||||
|
|
||||||
|
!rhui-REGION-rhel-server-debug-extras/7Server/x86_64 Red H disabled
|
||||||
|
rhui-REGION-rhel-server-debug-optional/7Server/x86_64 Red H disabled
|
||||||
|
rhui-REGION-rhel-server-extras/7Server/x86_64 Red H disabled
|
||||||
|
rhui-REGION-rhel-server-optional/7Server/x86_64 Red H disabled
|
||||||
|
rhui-REGION-rhel-server-source-extras/7Server/x86_64 Red H disabled
|
||||||
|
rhui-REGION-rhel-server-source-optional/7Server/x86_64 Red H disabled
|
||||||
|
|
||||||
|
Use the names of the repositories (minus the version and architecture) to enable them::
|
||||||
|
|
||||||
|
sudo yum-config-manager --enable rhui-REGION-rhel-server-optional
|
||||||
|
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras
|
||||||
|
|
||||||
|
---------------------------------
|
||||||
|
Enable the EPEL repository (RHEL)
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
The Extra Packages for Enterprise Linux (EPEL) repository contains some of bifrost's dependencies. To enable it, install the `epel-release` package as follows::
|
||||||
|
|
||||||
|
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
Enable the EPEL repository (CentOS)
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
To enable EPEL on CentOS, run::
|
||||||
|
|
||||||
|
sudo yum install epel-release
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ required_packages:
|
|||||||
- qemu-kvm
|
- qemu-kvm
|
||||||
- qemu-kvm-common
|
- qemu-kvm-common
|
||||||
- sgabios
|
- sgabios
|
||||||
|
- sgabios-bin
|
||||||
- libvirt
|
- libvirt
|
||||||
- libvirt-client
|
- libvirt-client
|
||||||
- libvirt-daemon
|
- libvirt-daemon
|
||||||
|
@ -7,6 +7,7 @@ required_packages:
|
|||||||
- qemu-kvm-common
|
- qemu-kvm-common
|
||||||
- qemu-system-x86
|
- qemu-system-x86
|
||||||
- sgabios
|
- sgabios
|
||||||
|
- sgabios-bin
|
||||||
- libvirt
|
- libvirt
|
||||||
- libvirt-client
|
- libvirt-client
|
||||||
- libvirt-daemon
|
- libvirt-daemon
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
---
|
||||||
|
init_template: upstart_template.j2
|
||||||
|
init_dest_dir: /etc/init/
|
||||||
|
init_ext: .conf
|
||||||
|
syslinux_tftp_dir: /usr/lib/syslinux/
|
||||||
|
ipxe_dir: /usr/lib/ipxe/
|
||||||
|
sgabios_dir: /usr/share/qemu/
|
||||||
|
nginx_user: www-data
|
||||||
|
mysql_service_name: mysql
|
||||||
required_packages:
|
required_packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
@ -6,7 +15,7 @@ required_packages:
|
|||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
- python-configparser
|
- python-configparser
|
||||||
- libffi-dev
|
- libffi-dev
|
||||||
- libxslt-dev
|
- libxslt1-dev
|
||||||
- libssl-dev
|
- libssl-dev
|
||||||
- libxml2-dev
|
- libxml2-dev
|
||||||
- ipxe
|
- ipxe
|
||||||
@ -24,3 +33,5 @@ required_packages:
|
|||||||
- kpartx
|
- kpartx
|
||||||
- qemu-utils
|
- qemu-utils
|
||||||
- python-openwsman
|
- python-openwsman
|
||||||
|
- amtterm
|
||||||
|
- sgabios
|
@ -1,3 +1,12 @@
|
|||||||
|
---
|
||||||
|
init_template: systemd_template.j2
|
||||||
|
init_dest_dir: /usr/lib/systemd/system/
|
||||||
|
init_ext: .service
|
||||||
|
syslinux_tftp_dir: /var/lib/tftpboot
|
||||||
|
ipxe_dir: /usr/share/ipxe/
|
||||||
|
sgabios_dir: /usr/share/sgabios/
|
||||||
|
nginx_user: nginx
|
||||||
|
mysql_service_name: mariadb
|
||||||
required_packages:
|
required_packages:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
@ -22,4 +31,7 @@ required_packages:
|
|||||||
- genisoimage
|
- genisoimage
|
||||||
- kpartx
|
- kpartx
|
||||||
- qemu-kvm-tools
|
- qemu-kvm-tools
|
||||||
|
- qemu-img
|
||||||
- openwsman-python
|
- openwsman-python
|
||||||
|
- sgabios-bin
|
||||||
|
# NOTE(cinerama): amtterm is not currently packaged for RHEL/CentOS 7.
|
@ -13,11 +13,12 @@
|
|||||||
# 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: Include OS-specific packages variables.
|
- name: Include OS-specific packages variables.
|
||||||
include_vars: "{{ item }}"
|
include_vars: "{{ item }}"
|
||||||
with_first_found:
|
with_first_found:
|
||||||
- "../defaults/required_packages_{{ ansible_distribution }}.yml"
|
- "../defaults/required_defaults_{{ ansible_distribution }}.yml"
|
||||||
- "../defaults/required_packages_{{ ansible_os_family }}.yml"
|
- "../defaults/required_defaults_{{ ansible_os_family }}.yml"
|
||||||
- name: "Update Package Cache"
|
- name: "Update Package Cache"
|
||||||
apt: update_cache=yes
|
apt: update_cache=yes
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
@ -64,8 +65,8 @@
|
|||||||
- name: "Include diskimage-builder installation"
|
- name: "Include diskimage-builder installation"
|
||||||
include: dib_install.yml
|
include: dib_install.yml
|
||||||
when: create_image_via_dib == true
|
when: create_image_via_dib == true
|
||||||
- name: "Starting MySQL"
|
- name: "Starting database service"
|
||||||
service: name=mysql state=started
|
service: name={{ mysql_service_name }} state=started
|
||||||
- name: "Starting rabbitmq-server"
|
- name: "Starting rabbitmq-server"
|
||||||
service: name=rabbitmq-server state=started
|
service: name=rabbitmq-server state=started
|
||||||
- name: "RabbitMQ - Testing if hostname is defined firsts in /etc/hosts"
|
- name: "RabbitMQ - Testing if hostname is defined firsts in /etc/hosts"
|
||||||
@ -137,10 +138,13 @@
|
|||||||
command: cp -p /home/ironic/.ssh/id_rsa.pub /home/ironic/.ssh/authorized_keys
|
command: cp -p /home/ironic/.ssh/id_rsa.pub /home/ironic/.ssh/authorized_keys
|
||||||
when: testing == true
|
when: testing == true
|
||||||
- name: "Placing services"
|
- name: "Placing services"
|
||||||
template: src=init_template.j2 dest=/etc/init/{{item.service_name}}.conf owner=root group=root
|
template: src={{ init_template }} dest={{ init_dest_dir }}{{item.service_name}}{{ init_ext }} owner=root group=root
|
||||||
with_items:
|
with_items:
|
||||||
- { service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
|
- { 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'}
|
- { service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'}
|
||||||
|
- name: "Reload systemd configuration"
|
||||||
|
command: systemctl daemon-reload
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
- name: "Start ironic-conductor"
|
- name: "Start ironic-conductor"
|
||||||
service: name=ironic-conductor state=started
|
service: name=ironic-conductor state=started
|
||||||
- name: "Start ironic-api"
|
- name: "Start ironic-api"
|
||||||
@ -148,7 +152,7 @@
|
|||||||
- name: "Start ironic-conductor"
|
- name: "Start ironic-conductor"
|
||||||
service: name=ironic-conductor state=restarted
|
service: name=ironic-conductor state=restarted
|
||||||
- name: "Start ironic-api"
|
- name: "Start ironic-api"
|
||||||
service: name=ironic-api state=reloaded
|
service: name=ironic-api state=restarted
|
||||||
- name: "Setting up PXE and iPXE folders"
|
- name: "Setting up PXE and iPXE folders"
|
||||||
file: name={{item}} owner=ironic group=ironic state=directory
|
file: name={{item}} owner=ironic group=ironic state=directory
|
||||||
with_items:
|
with_items:
|
||||||
@ -160,7 +164,7 @@
|
|||||||
- name: "Disable service tftpd-hpa"
|
- name: "Disable service tftpd-hpa"
|
||||||
service: name=tftpd-hpa state=stopped enabled=no
|
service: name=tftpd-hpa state=stopped enabled=no
|
||||||
- name: "Placing pxelinux.0 (pre-14.10)"
|
- name: "Placing pxelinux.0 (pre-14.10)"
|
||||||
copy: src=/usr/lib/syslinux/pxelinux.0 dest=/tftpboot
|
copy: src={{ syslinux_tftp_dir }}/pxelinux.0 dest=/tftpboot
|
||||||
when: ansible_distribution_version|version_compare('14.10', '<')
|
when: ansible_distribution_version|version_compare('14.10', '<')
|
||||||
- name: "Placing pxelinux.0 (>=14.10)"
|
- name: "Placing pxelinux.0 (>=14.10)"
|
||||||
copy: src=/usr/lib/PXELINUX/pxelinux.0 dest=/tftpboot
|
copy: src=/usr/lib/PXELINUX/pxelinux.0 dest=/tftpboot
|
||||||
@ -170,7 +174,7 @@
|
|||||||
- name: "Place tftp config file"
|
- name: "Place tftp config file"
|
||||||
copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp
|
copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp
|
||||||
- name: "Copy iPXE image into place"
|
- name: "Copy iPXE image into place"
|
||||||
copy: src=/usr/lib/ipxe/undionly.kpxe dest=/tftpboot/
|
copy: src={{ ipxe_dir }}/undionly.kpxe dest=/tftpboot/
|
||||||
- name: "Deploy dnsmasq configuration file"
|
- name: "Deploy dnsmasq configuration file"
|
||||||
template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf
|
template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf
|
||||||
when: "{{include_dhcp_server|bool}}"
|
when: "{{include_dhcp_server|bool}}"
|
||||||
@ -194,8 +198,8 @@
|
|||||||
when: testing == true
|
when: testing == true
|
||||||
# NOTE(Shrews) Ubuntu packaging+apparmor issue prevents libvirt from loading
|
# NOTE(Shrews) Ubuntu packaging+apparmor issue prevents libvirt from loading
|
||||||
# the ROM from /usr/share/misc.
|
# the ROM from /usr/share/misc.
|
||||||
- name: "Looking for sgabios in /usr/share/qemu"
|
- name: "Looking for sgabios in {{ sgabios_dir }}"
|
||||||
stat: path=/usr/share/qemu/sgabios.bin
|
stat: path={{ sgabios_dir }}/sgabios.bin
|
||||||
register: test_sgabios_qemu
|
register: test_sgabios_qemu
|
||||||
- name: "Looking for sgabios in /usr/share/misc"
|
- name: "Looking for sgabios in /usr/share/misc"
|
||||||
stat: path=/usr/share/misc/sgabios.bin
|
stat: path=/usr/share/misc/sgabios.bin
|
||||||
@ -221,7 +225,7 @@
|
|||||||
- xinetd
|
- xinetd
|
||||||
- nginx
|
- nginx
|
||||||
- name: "Sending services a force-reload signal"
|
- name: "Sending services a force-reload signal"
|
||||||
command: /etc/init.d/dnsmasq force-reload
|
service: name=dnsmasq state=restarted
|
||||||
when: "{{include_dhcp_server|bool}}"
|
when: "{{include_dhcp_server|bool}}"
|
||||||
# Similar logic to below can be utilized to retrieve files
|
# Similar logic to below can be utilized to retrieve files
|
||||||
- name: "Determine if folder exists, else create and populate folder."
|
- name: "Determine if folder exists, else create and populate folder."
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
user www-data;
|
user {{ nginx_user }};
|
||||||
worker_processes 2;
|
worker_processes 2;
|
||||||
pid /run/nginx.pid;
|
pid /run/nginx.pid;
|
||||||
|
|
||||||
|
10
playbooks/roles/ironic-install/templates/systemd_template.j2
Normal file
10
playbooks/roles/ironic-install/templates/systemd_template.j2
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description={{ item.service_name }} service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/{{ item.service_name }} {{ item.args }}
|
||||||
|
User={{ item.username }}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Alias={{ item.service_name }}{{ init_ext }}
|
@ -19,10 +19,16 @@ if [ -x '/usr/bin/apt-get' ]; then
|
|||||||
if ! $(easy_install --version &>/dev/null) ; then
|
if ! $(easy_install --version &>/dev/null) ; then
|
||||||
sudo -H apt-get -y install python-setuptools
|
sudo -H apt-get -y install python-setuptools
|
||||||
fi
|
fi
|
||||||
|
if ! $(dpkg -l libpython-dev &>/dev/null); then
|
||||||
|
sudo -H apt-get -y install libpython-dev
|
||||||
|
fi
|
||||||
elif [ -x '/usr/bin/yum' ]; then
|
elif [ -x '/usr/bin/yum' ]; then
|
||||||
if ! yum -q list installed python-devel; then
|
if ! yum -q list installed python-devel; then
|
||||||
sudo -H yum -y install python-devel
|
sudo -H yum -y install python-devel
|
||||||
fi
|
fi
|
||||||
|
if ! $(gcc -v &>/dev/null); then
|
||||||
|
sudo -H yum -y install gcc
|
||||||
|
fi
|
||||||
if ! $(git --version &>/dev/null); then
|
if ! $(git --version &>/dev/null); then
|
||||||
sudo -H yum -y install git
|
sudo -H yum -y install git
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user