tripleo-heat-templates/deployment/multipathd/multipathd-container.yaml
Emilien Macchi 38bad5283f Remove all ignore_errors to avoid confusion when debugging
- deploy-steps-tasks-step-1.yaml: Do not ignore errors when dealing
  with check-mode directories. The file module is resilient enough to
  not fail if the path is already absent.

- deploy-steps-tasks.yaml: Replace ignore_errors by another condition,
  "not ansible_check_mode"; this task is not needed in check mode.

- generate-config-tasks.yaml: Replace ignore_errors by another
  condition, "not ansible_check_mode"; this task is not needed in check mode.

- Neutron wrappers: use fail_key: False instead of ignore_errors: True
  if a key can't be found in /etc/passwd.

- All services with service checks: Replace "ignore_errors: true" by
  "failed_when: false". Since we don't care about whether or not the
  task returns 0, let's just make the task never fail. It will only
  improve UX when scrawling logs; no more failure will be shown for
  these tasks.

- Same as above for cibadmin commands, cluster resources show
  commands and keepalived container restart command; and all other shell
  or command or yum modules uses where we just don't care about their potential
  failures.

- Aodh/Gnocchi: Add pipefail so the task isn't support to fail

- tripleo-packages-baremetal-puppet and undercloud-upgrade: check shell
  rc instead of "succeeded", since the task will always succeed.

Change-Id: I0c44db40e1b9a935e7dde115bb0c9affa15c42bf
2020-03-05 09:22:04 -05:00

164 lines
5.3 KiB
YAML

heat_template_version: rocky
description: >
OpenStack containerized Multipathd service
parameters:
ContainerMultipathdImage:
description: image
type: string
ContainerMultipathdConfigImage:
description: The container image to use for the multipathd config_volume
type: string
MultipathdEnable:
default: false
description: Whether to enable the multipath daemon
type: boolean
MultipathdEnableUserFriendlyNames:
default: false
description: Whether to enable assigning a user friendly name to each path
type: boolean
MultipathdEnableFindMultipaths:
default: true
description: Whether to automatically create a multipath device for each path
type: boolean
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
DefaultPasswords:
default: {}
type: json
conditions:
multipathd_enabled: {equals: [{get_param: MultipathdEnable}, true]}
user_friendly_names_enabled: {equals: [{get_param: MultipathdEnableUserFriendlyNames}, true]}
find_multipaths_enabled: {equals: [{get_param: MultipathdEnableFindMultipaths}, true]}
resources:
ContainersCommon:
type: ../containers-common.yaml
outputs:
role_data:
description: Role data for the Multipathd API role.
value:
service_name: multipathd
config_settings: {}
service_config_settings: {}
# BEGIN DOCKER SETTINGS
puppet_config:
config_volume: multipathd
puppet_tags: exec
step_config:
str_replace:
template: |
exec { "update multipath.conf":
command => "/usr/sbin/mpathconf CMD --with_multipathd n --user_friendly_names UFN --find_multipaths FM"
}
params:
CMD:
if:
- multipathd_enabled
- '--enable'
- '--disable'
UFN:
if:
- user_friendly_names_enabled
- 'y'
- 'n'
FM:
if:
- find_multipaths_enabled
- 'y'
- 'n'
config_image: {get_param: ContainerMultipathdConfigImage}
volumes:
- /etc/multipath.conf:/etc/multipath.conf:z
kolla_config:
/var/lib/kolla/config_files/multipathd.json:
command: /usr/sbin/multipathd -d
config_files:
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
- source: "/var/lib/kolla/config_files/src-iscsid/*"
dest: "/etc/iscsi/"
merge: true
preserve_properties: true
docker_config:
step_3:
multipathd:
start_order: 1
image: {get_param: ContainerMultipathdImage}
net: host
privileged: true
restart: always
healthcheck:
test: /openstack/healthcheck
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/multipathd.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/multipathd:/var/lib/kolla/config_files/src:ro
- /etc/iscsi:/var/lib/kolla/config_files/src-iscsid:ro
- /dev/:/dev/
- /run/:/run/
- /sys:/sys
- /lib/modules:/lib/modules:ro
- /var/lib/iscsi:/var/lib/iscsi:z
- /etc/multipath:/etc/multipath:z
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
host_prep_tasks:
- name: Check if multipathd is deployed on the host
command: systemctl is-enabled --quiet multipathd
failed_when: false
register: multipathd_enabled_result
- name: Set fact multipathd_enabled
set_fact:
multipathd_enabled: "{{ multipathd_enabled_result.rc == 0 }}"
- name: Stop multipathd on the host
service: name=multipathd state=stopped enabled=no
when: multipathd_enabled|bool
- name: load dm-multipath
import_role:
name: tripleo_module_load
vars:
modules:
- name: dm-multipath
- name: prepare /etc/multipath
file:
path: /etc/multipath
state: directory
setype: container_file_t
- name: ensure /etc/multipath.conf exists
file:
path: /etc/multipath.conf
state: touch
setype: container_file_t
upgrade_tasks: []