diff --git a/defaults/main.yml b/defaults/main.yml index 16707871..73f28289 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -70,16 +70,14 @@ ironic_service_in_ldap: False # Is this Ironic installation working standalone? +# If you're wanting Ironic to work without being integrated to other OpenStack +# services, set this to True, and update the dhcp configuration appropriately ironic_standalone: False # Database ironic_galera_user: ironic ironic_galera_database: ironic -ironic_galera_password: gu1d0 - -# TBD(mrda): need to handle this a little better :) -#database_root_user: root -#database_root_password: sp4m3ggs +ironic_galera_password: "gu1d0" # TODO(mrda): Manage secrets # Integrated Openstack configuration ironic_openstack_driver_list: agent_ipmitool @@ -134,8 +132,6 @@ python_ironicclient_pip_packages: ironic_conductor_apt_packages: - libxml2-dev - rabbitmq-server - - isc-dhcp-server - - tftpd-hpa - syslinux - syslinux-common - libxslt1-dev @@ -145,6 +141,10 @@ ironic_conductor_apt_packages: - open-iscsi - ipmitool +ironic_conductor_standalone_apt_packages: + - isc-dhcp-server + - tftpd-hpa + ironic_conductor_pip_packages: - mysql-python diff --git a/files/dhcpd.conf b/files/dhcpd.conf new file mode 100644 index 00000000..3a5ba8a0 --- /dev/null +++ b/files/dhcpd.conf @@ -0,0 +1,44 @@ +# +# Sample configuration file for Ironic deploys via +# openstack-ansible-ironic +# + +# The ddns-updates-style parameter controls whether or not the server will +# attempt to do a DNS update when a lease is confirmed. We default to the +# behavior of the version 2 packages ('none', since DHCP v2 didn't +# have support for DDNS.) +ddns-update-style none; + +default-lease-time 600; +max-lease-time 7200; + +# If this DHCP server is the official DHCP server for the local +# network, the authoritative directive should be uncommented. +authoritative; + +# Use this to send dhcp log messages to a different log file (you also +# have to hack syslog.conf to complete the redirection). +log-facility local7; + +# This is the section of great importance to standalone ironic +# deployers. This host, as well as the deployment hosts, should +# be on the same network segment. And, if you have more than +# one ironic-conduftor, you should only run an isc-dhcp-server +# and tftpd-hpa server on one of these conductors. +# +# TODO(mrda): Enforce this in the os_ironic role +# +subnet 10.141.0.0 netmask 255.255.0.0 { + group { + # Repeat this host section for each ironic deployment host + host ironic_deploy_host_name { + hardware ethernet ; # deploy host mac address + fixed-address ; # deploy host IP address + allow booting; + allow bootp; + next-server ; # tftpd-hpa server IP addr + filename "pxelinux.0"; + } + } +} + diff --git a/handlers/main.yml b/handlers/main.yml index e9577b87..c61ddbb8 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -26,3 +26,9 @@ name: "tftpd-hpa" state: restarted failed_when: false + +- name: Restart isc-dhcp-server + service: + name: "isc-dhcp-server" + state: restarted + failed_when: false diff --git a/tasks/ironic_api_post_install.yml b/tasks/ironic_api_post_install.yml index 4dd1d092..430a639e 100644 --- a/tasks/ironic_api_post_install.yml +++ b/tasks/ironic_api_post_install.yml @@ -31,6 +31,20 @@ file: path: "/etc/apache2/sites-enabled/000-default.conf" state: "absent" + when: not ironic_standalone + notify: + - Restart ironic services + tags: + - ironic-httpd + +- name: Enable default apache site vhost + file: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + state: "{{ item.state }}" + with_items: + - { src: "/etc/apache2/sites-available/000-default.conf", dest: "/etc/apache2/sites-enabled/000-default.conf", state: "link" } + when: ironic_standalone notify: - Restart ironic services tags: diff --git a/tasks/ironic_conductor_install.yml b/tasks/ironic_conductor_install.yml index 37600464..0fc2dcb5 100644 --- a/tasks/ironic_conductor_install.yml +++ b/tasks/ironic_conductor_install.yml @@ -27,6 +27,21 @@ - ironic-conductor - ironic-apt-packages +- name: Install ironic-conductor standalone apt packages + apt: + pkg: "{{ item }}" + state: latest + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: ironic_conductor_standalone_apt_packages + when: ironic_standalone + tags: + - ironic-install + - ironic-conductor + - ironic-apt-packages + - name: Install ironic-conductor specific pip dependencies pip: name: "{{ item }}" diff --git a/tasks/ironic_conductor_post_install.yml b/tasks/ironic_conductor_post_install.yml index b4212f70..157dd1c4 100644 --- a/tasks/ironic_conductor_post_install.yml +++ b/tasks/ironic_conductor_post_install.yml @@ -13,6 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Copy in sample dhcpd.conf file + copy: + src: dhcpd.conf + dest: /etc/dhcp/ + when: ironic_standalone + notify: + - Restart isc-dhcp-server + tags: + - tftpd-hpa + - name: Create /tftpboot file: path: "/tftpboot" @@ -20,6 +30,7 @@ owner: "{{ ironic_system_user_name }}" group: "{{ ironic_system_group_name }}" mode: "0755" + when: ironic_standalone tags: - tftpd-hpa @@ -27,6 +38,7 @@ copy: src: tftpd-hpa dest: /etc/default/tftpd-hpa + when: ironic_standalone notify: - Restart tftpd-hpa tags: @@ -36,6 +48,7 @@ copy: src: map-file dest: /tftpboot/map-file + when: ironic_standalone notify: - Restart tftpd-hpa tags: @@ -44,30 +57,32 @@ - name: Check to see if pxlinux.0 is required stat: path=/tftpboot/pxelinux.0 register: pxelinux_exists + when: ironic_standalone tags: - tftpd-hpa - name: Check to see if chain.c32 is required stat: path=/tftpboot/chain.c32 register: chain32_exists + when: ironic_standalone tags: - tftpd-hpa - name: Check pxlinux.0 exists stat: path=/usr/lib/syslinux/pxelinux.0 register: pxelinux_stat - when: not pxelinux_exists + when: not pxelinux_exists and ironic_standalone tags: - tftpd-hpa - name: Copy syslinux pxlinux.0 command: cp /usr/lib/syslinux/pxelinux.0 /tftpboot/pxelinux.0 - when: not pxelinux_exists and pxelinux_stat.stat.exists + when: not pxelinux_exists and pxelinux_stat.stat.exists and ironic_standalone tags: - tftpd-hpa - name: Copy syslinux chain.c32 command: cp /usr/lib/syslinux/chain.c32 /tftpboot/chain.c32 - when: not chain32_exists and chain32_stat.stat.exists + when: not chain32_exists and chain32_stat.stat.exists and ironic_standalone tags: - tftpd-hpa diff --git a/tasks/ironic_db_setup.yml b/tasks/ironic_db_setup.yml index 7e15501e..36fa4016 100644 --- a/tasks/ironic_db_setup.yml +++ b/tasks/ironic_db_setup.yml @@ -41,24 +41,12 @@ tags: - ironic-db-setup -#- name: Create database schema -## command: "{{ ironic_bin }}/ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema" -# sudo: yes -# sudo_user: "{{ ironic_system_user_name }}" -# notify: -# - Restart ironic services -# 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: - ironic-db-setup - ironic-conductor diff --git a/tasks/ironic_pre_install.yml b/tasks/ironic_pre_install.yml index 4d808a85..5a058975 100644 --- a/tasks/ironic_pre_install.yml +++ b/tasks/ironic_pre_install.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: create the system group +- name: Create the system group group: name: "{{ ironic_system_group_name }}" state: "present" diff --git a/tasks/ironic_upstart_init.yml b/tasks/ironic_upstart_init.yml index 0023fecc..62fd5955 100644 --- a/tasks/ironic_upstart_init.yml +++ b/tasks/ironic_upstart_init.yml @@ -13,15 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#- include: ironic_upstart_common_init.yml -# vars: -# program_name: "{{ ironic_api_program_name }}" -# service_name: "{{ ironic_service_name }}" -# system_user: "{{ ironic_system_user_name }}" -# system_group: "{{ ironic_system_group_name }}" -# service_home: "{{ ironic_system_home_folder }}" -# when: inventory_hostname in groups['ironic_api'] - - include: ironic_upstart_common_init.yml vars: program_name: "{{ ironic_conductor_program_name }}" diff --git a/templates/ironic-ports.conf.j2 b/templates/ironic-ports.conf.j2 index f2de0683..63743852 100644 --- a/templates/ironic-ports.conf.j2 +++ b/templates/ironic-ports.conf.j2 @@ -1,3 +1,7 @@ # {{ ansible_managed }} Listen {{ ironic_service_port }} +{% if ironic_standalone %} +Listen 80 +{% endif %} +