diff --git a/README.rst b/README.rst index b8914dca6..6f3f96b68 100644 --- a/README.rst +++ b/README.rst @@ -24,6 +24,53 @@ Supported Operating Systems: * Red Hat Enterprise Linux (RHEL) 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 ============ diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml index b989bae90..163aaf6aa 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_CentOS.yml @@ -6,6 +6,7 @@ required_packages: - qemu-kvm - qemu-kvm-common - sgabios + - sgabios-bin - libvirt - libvirt-client - libvirt-daemon diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_RedHat.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_RedHat.yml index 4d3a274ac..ec00eac3c 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_RedHat.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/required_defaults_RedHat.yml @@ -7,6 +7,7 @@ required_packages: - qemu-kvm-common - qemu-system-x86 - sgabios + - sgabios-bin - libvirt - libvirt-client - libvirt-daemon diff --git a/playbooks/roles/ironic-install/defaults/required_packages_Debian.yml b/playbooks/roles/ironic-install/defaults/required_defaults_Debian.yml similarity index 58% rename from playbooks/roles/ironic-install/defaults/required_packages_Debian.yml rename to playbooks/roles/ironic-install/defaults/required_defaults_Debian.yml index 2b6b9ee47..223216a08 100644 --- a/playbooks/roles/ironic-install/defaults/required_packages_Debian.yml +++ b/playbooks/roles/ironic-install/defaults/required_defaults_Debian.yml @@ -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: - mysql-server - dnsmasq @@ -6,7 +15,7 @@ required_packages: - python-mysqldb - python-configparser - libffi-dev - - libxslt-dev + - libxslt1-dev - libssl-dev - libxml2-dev - ipxe @@ -24,3 +33,5 @@ required_packages: - kpartx - qemu-utils - python-openwsman + - amtterm + - sgabios diff --git a/playbooks/roles/ironic-install/defaults/required_packages_RedHat.yml b/playbooks/roles/ironic-install/defaults/required_defaults_RedHat.yml similarity index 53% rename from playbooks/roles/ironic-install/defaults/required_packages_RedHat.yml rename to playbooks/roles/ironic-install/defaults/required_defaults_RedHat.yml index 5cde986a7..39633b340 100644 --- a/playbooks/roles/ironic-install/defaults/required_packages_RedHat.yml +++ b/playbooks/roles/ironic-install/defaults/required_defaults_RedHat.yml @@ -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: - mariadb-server - dnsmasq @@ -22,4 +31,7 @@ required_packages: - genisoimage - kpartx - qemu-kvm-tools + - qemu-img - openwsman-python + - sgabios-bin +# NOTE(cinerama): amtterm is not currently packaged for RHEL/CentOS 7. diff --git a/playbooks/roles/ironic-install/tasks/main.yml b/playbooks/roles/ironic-install/tasks/main.yml index 74a75b843..8e83736bf 100644 --- a/playbooks/roles/ironic-install/tasks/main.yml +++ b/playbooks/roles/ironic-install/tasks/main.yml @@ -13,11 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. --- + - name: Include OS-specific packages variables. include_vars: "{{ item }}" with_first_found: - - "../defaults/required_packages_{{ ansible_distribution }}.yml" - - "../defaults/required_packages_{{ ansible_os_family }}.yml" + - "../defaults/required_defaults_{{ ansible_distribution }}.yml" + - "../defaults/required_defaults_{{ ansible_os_family }}.yml" - name: "Update Package Cache" apt: update_cache=yes when: ansible_os_family == 'Debian' @@ -64,8 +65,8 @@ - name: "Include diskimage-builder installation" include: dib_install.yml when: create_image_via_dib == true -- name: "Starting MySQL" - service: name=mysql state=started +- name: "Starting database service" + service: name={{ mysql_service_name }} state=started - name: "Starting rabbitmq-server" service: name=rabbitmq-server state=started - 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 when: testing == true - 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: - { 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'} +- name: "Reload systemd configuration" + command: systemctl daemon-reload + when: ansible_os_family == 'RedHat' - name: "Start ironic-conductor" service: name=ironic-conductor state=started - name: "Start ironic-api" @@ -148,7 +152,7 @@ - name: "Start ironic-conductor" service: name=ironic-conductor state=restarted - name: "Start ironic-api" - service: name=ironic-api state=reloaded + service: name=ironic-api state=restarted - name: "Setting up PXE and iPXE folders" file: name={{item}} owner=ironic group=ironic state=directory with_items: @@ -160,7 +164,7 @@ - name: "Disable service tftpd-hpa" service: name=tftpd-hpa state=stopped enabled=no - 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', '<') - name: "Placing pxelinux.0 (>=14.10)" copy: src=/usr/lib/PXELINUX/pxelinux.0 dest=/tftpboot @@ -170,7 +174,7 @@ - name: "Place tftp config file" copy: src=xinetd.tftp dest=/etc/xinetd.d/tftp - 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" template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf when: "{{include_dhcp_server|bool}}" @@ -194,8 +198,8 @@ when: testing == true # NOTE(Shrews) Ubuntu packaging+apparmor issue prevents libvirt from loading # the ROM from /usr/share/misc. -- name: "Looking for sgabios in /usr/share/qemu" - stat: path=/usr/share/qemu/sgabios.bin +- name: "Looking for sgabios in {{ sgabios_dir }}" + stat: path={{ sgabios_dir }}/sgabios.bin register: test_sgabios_qemu - name: "Looking for sgabios in /usr/share/misc" stat: path=/usr/share/misc/sgabios.bin @@ -221,7 +225,7 @@ - xinetd - nginx - name: "Sending services a force-reload signal" - command: /etc/init.d/dnsmasq force-reload + service: name=dnsmasq state=restarted when: "{{include_dhcp_server|bool}}" # Similar logic to below can be utilized to retrieve files - name: "Determine if folder exists, else create and populate folder." diff --git a/playbooks/roles/ironic-install/templates/nginx.conf.j2 b/playbooks/roles/ironic-install/templates/nginx.conf.j2 index b2cfdcb5a..e627a84d0 100644 --- a/playbooks/roles/ironic-install/templates/nginx.conf.j2 +++ b/playbooks/roles/ironic-install/templates/nginx.conf.j2 @@ -1,4 +1,4 @@ -user www-data; +user {{ nginx_user }}; worker_processes 2; pid /run/nginx.pid; diff --git a/playbooks/roles/ironic-install/templates/systemd_template.j2 b/playbooks/roles/ironic-install/templates/systemd_template.j2 new file mode 100644 index 000000000..f489a20b2 --- /dev/null +++ b/playbooks/roles/ironic-install/templates/systemd_template.j2 @@ -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 }} \ No newline at end of file diff --git a/playbooks/roles/ironic-install/templates/init_template.j2 b/playbooks/roles/ironic-install/templates/upstart_template.j2 similarity index 100% rename from playbooks/roles/ironic-install/templates/init_template.j2 rename to playbooks/roles/ironic-install/templates/upstart_template.j2 diff --git a/scripts/env-setup.sh b/scripts/env-setup.sh index f6ab4009f..961092dbe 100755 --- a/scripts/env-setup.sh +++ b/scripts/env-setup.sh @@ -19,10 +19,16 @@ if [ -x '/usr/bin/apt-get' ]; then if ! $(easy_install --version &>/dev/null) ; then sudo -H apt-get -y install python-setuptools fi + if ! $(dpkg -l libpython-dev &>/dev/null); then + sudo -H apt-get -y install libpython-dev + fi elif [ -x '/usr/bin/yum' ]; then if ! yum -q list installed python-devel; then sudo -H yum -y install python-devel fi + if ! $(gcc -v &>/dev/null); then + sudo -H yum -y install gcc + fi if ! $(git --version &>/dev/null); then sudo -H yum -y install git fi