Allow for recent ironic sample config changes
In I1bc8b00eb98055a6e0f06af287cfa10c02ee2094 the sample ironic.conf file was modified to prepare for the transition to oslo-config-generator. Since bifrost uses the sample config file, we need to modify our regexps to match both the new and old sample config file. We also need to replace lines with the new style. Change-Id: I1757cc26c7f687b8070ca1f9c61a933fbcee8774
This commit is contained in:
parent
c630eb5117
commit
c9d283a5c1
|
@ -32,162 +32,166 @@
|
|||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[DEFAULT]"
|
||||
regexp='^(.*)enabled_drivers=(.*)$'
|
||||
line="enabled_drivers=agent_ssh,pxe_ssh"
|
||||
regexp='^\#?\s?enabled_drivers\s?=\s?(.*)$'
|
||||
line="enabled_drivers = agent_ssh,pxe_ssh"
|
||||
when: testing | bool == true
|
||||
- name: "If not testing, set driver list"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[DEFAULT]"
|
||||
regexp='^(.*)enabled_drivers=(.*)$'
|
||||
line="enabled_drivers={{ enabled_drivers }}"
|
||||
regexp='^\#?\s?enabled_drivers\s?=\s?(.*)$'
|
||||
line="enabled_drivers = {{ enabled_drivers }}"
|
||||
when: testing | bool == false
|
||||
- name: "Set rabbit user"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[DEFAULT]"
|
||||
regexp='^(.*)rabbit_userid=(.*)$'
|
||||
line="rabbit_userid=ironic"
|
||||
regexp='^\#?\s?rabbit_userid\s?=\s?(.*)$'
|
||||
line="rabbit_userid = ironic"
|
||||
- name: "Set rabbit password"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[DEFAULT]"
|
||||
regexp='^(.*)rabbit_password=(.*)$'
|
||||
line="rabbit_password={{ ironic_db_password }}"
|
||||
regexp='^\#?\s?rabbit_password\s?=\s?(.*)$'
|
||||
line="rabbit_password = {{ ironic_db_password }}"
|
||||
- name: "Set auth_strategy to noauth"
|
||||
command: sed -i 's/#auth_strategy=keystone/auth_strategy=noauth/g' /etc/ironic/ironic.conf
|
||||
replace:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
regexp='^\#\s?auth_strategy\s?=\s?keystone'
|
||||
replace='auth_strategy = noauth'
|
||||
- name: "If testing, enable debug logging"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[DEFAULT]"
|
||||
regexp='^(.*)debug=(.*)$'
|
||||
line="debug=true"
|
||||
regexp='^\#?\s?debug\s?=\s?(.*)$'
|
||||
line="debug = true"
|
||||
when: testing | bool == true
|
||||
- name: "If not testing, disable debug logging"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[DEFAULT]"
|
||||
regexp='^(.*)debug=(.*)$'
|
||||
line="debug=false"
|
||||
regexp='^\#?\s?debug\s?=\s?$'
|
||||
line="debug = false"
|
||||
when: testing | bool == false
|
||||
- name: "For agent, send extra params"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)pxe_append_params=(.*)$'
|
||||
line="pxe_append_params=systemd.journald.forward_to_console=yes {{extra_kernel_options | default('')}}"
|
||||
regexp='^\#?\s?pxe_append_params\s?=\s?(.*)$'
|
||||
line="pxe_append_params = systemd.journald.forward_to_console=yes {{extra_kernel_options | default('')}}"
|
||||
- name: "Configure conductor API url"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[conductor]"
|
||||
regexp='^(.*)api_url=(.*)$'
|
||||
line="api_url=http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:6385/"
|
||||
regexp='^\#?\s?api_url\s?=\s?(.*)$'
|
||||
line="api_url = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:6385/"
|
||||
# Note(TheJulia): clean_nodes config option is deprecated and to be removed in Newton.
|
||||
- name: "Configure conductor cleaning - Pre-Mitaka"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertbefore="[console]"
|
||||
regexp='^(.*)clean_nodes=(.*)$'
|
||||
line="clean_nodes={{ cleaning | lower }}"
|
||||
regexp='^\#?\s?clean_nodes\s?=\s?(.*)$'
|
||||
line="clean_nodes = {{ cleaning | lower }}"
|
||||
- name: "Configure conductor cleaning - Mitaka"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertbefore="[console]"
|
||||
regexp='^(.*)automated_clean=(.*)$'
|
||||
line="automated_clean={{ cleaning | lower }}"
|
||||
regexp='^\#?\s?automated_clean\s?=\s?(.*)$'
|
||||
line="automated_clean = {{ cleaning | lower }}"
|
||||
- name: "Configure database connection"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[database]"
|
||||
regexp='^(.*)connection=(.*)$'
|
||||
line="connection=mysql+pymysql://ironic:{{ ironic_db_password }}@localhost/ironic?charset=utf8"
|
||||
regexp='^\#?\s?connection\s?=\s?(.*)$'
|
||||
line="connection = mysql+pymysql://ironic:{{ ironic_db_password }}@localhost/ironic?charset=utf8"
|
||||
- name: "Configure DHCP provider"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[dhcp]" regexp='^(.*)dhcp_provider=(.*)$'
|
||||
line="dhcp_provider=none"
|
||||
insertafter="[dhcp]"
|
||||
regexp='^\#?\s?dhcp_provider\s?=\s?(.*)$'
|
||||
line="dhcp_provider = none"
|
||||
- name: "Set PXE pxe_config_template"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)pxe_config_template=(.*)$'
|
||||
line="pxe_config_template=$pybasedir/drivers/modules/ipxe_config.template"
|
||||
regexp='^\#?\s?pxe_config_template\s?=\s?(.*)$'
|
||||
line="pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template"
|
||||
- name: "Set PXE tftp_server"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)tftp_server=(.*)$'
|
||||
line="tftp_server={{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}"
|
||||
regexp='^\#?\s?tftp_server\s?=\s?(.*)$'
|
||||
line="tftp_server = {{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}"
|
||||
- name: "Set PXE tftp_root"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)tftp_root=(.*)$'
|
||||
line="tftp_root=/tftpboot"
|
||||
regexp='^\#?\s?tftp_root\s?=\s?(.*)$'
|
||||
line="tftp_root = /tftpboot"
|
||||
- name: "Set iPXE pxe_bootfile_name"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)pxe_bootfile_name=(.*)$'
|
||||
line="pxe_bootfile_name=undionly.kpxe"
|
||||
regexp='^\#?\s?pxe_bootfile_name\s?=\s?\#?\s?$'
|
||||
line="pxe_bootfile_name = undionly.kpxe"
|
||||
- name: "Set iPXE http_url"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)http_url=(.*)$'
|
||||
line="http_url=http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/"
|
||||
regexp='^\#?\s?http_url\s?=\s?(.*)$'
|
||||
line="http_url = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/"
|
||||
- name: "Set iPXE http_root"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)http_root=(.*)$'
|
||||
line="http_root={{ http_boot_folder }}"
|
||||
regexp='^\#?\s?http_root\s?=\s?(.*)$'
|
||||
line="http_root = {{ http_boot_folder }}"
|
||||
- name: "Set iPXE to be enabled"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)ipxe_enabled=(.*)$'
|
||||
line="ipxe_enabled=true"
|
||||
regexp='^\#?\s?ipxe_enabled\s?=\s?(.*)$'
|
||||
line="ipxe_enabled = true"
|
||||
- name: "Set path to ipxe template file"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[pxe]"
|
||||
regexp='^(.*)ipxe_boot_script=(.*)$'
|
||||
line="ipxe_boot_script=/etc/ironic/boot.ipxe"
|
||||
regexp='^\#?\s?ipxe_boot_script\s?=\s?(.*)$'
|
||||
line="ipxe_boot_script = /etc/ironic/boot.ipxe"
|
||||
- name: "Configure SSH libvirt URL if testing"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[ssh]"
|
||||
regexp='^(.*)libvirt_uri=(.*)$'
|
||||
line="libvirt_uri=qemu:///system"
|
||||
regexp='^\#?\s?libvirt_uri\s?=\s?(.*)$'
|
||||
line="libvirt_uri = qemu:///system"
|
||||
when: testing | bool == true
|
||||
- name: "Set CORS allowed_origin if enable_cors is set"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertbefore='^(.*)cors.subdomain(.*)$'
|
||||
regexp='^allowed_origin=(.*)$'
|
||||
line="allowed_origin={{ cors_allowed_origin | default('allowed_origin=http://localhost:8000')}}"
|
||||
when: enable_cors | bool
|
||||
insertbefore='^\#?\s?cors.subdomain(.*)$'
|
||||
regexp='^\#?\s?allowed_origin\s?=\s?(.*)$'
|
||||
line="allowed_origin = {{ cors_allowed_origin | default('allowed_origin=http://localhost:8000')}}"
|
||||
when: enable_cors | bool == true
|
||||
- name: "Set CORS allow_credentials if enable_cors is set"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertbefore='^(.*)cors.subdomain(.*)$'
|
||||
regexp='^allow_credentials=(.*)$'
|
||||
line="allow_credentials={{ enable_cors_credential_support | default('true')}}"
|
||||
when: enable_cors | bool
|
||||
insertbefore='^\#?\s?cors.subdomain(.*)$'
|
||||
regexp='^\#?\s?allow_credentials\s?=\s?(.*)$'
|
||||
line="allow_credentials = {{ enable_cors_credential_support | default('true')}}"
|
||||
when: enable_cors | bool == true
|
||||
- name: "Set ilo driver to utilize web server"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[ilo]"
|
||||
regexp='^(.*)use_web_server_for_images=(.*)$'
|
||||
line="use_web_server_for_images=true"
|
||||
regexp='^\#?\s?use_web_server_for_images\s?=\s?(.*)$'
|
||||
line="use_web_server_for_images = true"
|
||||
- name: "Enable Inspector"
|
||||
lineinfile:
|
||||
dest=/etc/ironic/ironic.conf
|
||||
insertafter="[inspector]"
|
||||
regexp='(^#|^)enabled( |)=(.*)$'
|
||||
regexp='^\#?\s?enabled( |)\s?=\s?(.*)$'
|
||||
line="enabled = True"
|
||||
when: enable_inspector | bool
|
||||
when: enable_inspector | bool == true
|
||||
- name: "Set sudoers for PXE driver support if enabled"
|
||||
lineinfile:
|
||||
dest: /etc/sudoers
|
||||
|
|
Loading…
Reference in New Issue