---
- name: Post Undercloud Run Tasks
  hosts: undercloud
  tags: post
  gather_facts: no
  become: yes
  any_errors_fatal: true
  vars:
    ironic_conductor: ironic_conductor
  tasks:
    - name: Set selinux state
      selinux:
          policy: "targeted"
          state: "{{ install.selinux|default('enforcing') }}"
      when: install.selinux is defined

    - name: increase iscsi verify attempts in ironic conductor
      block:
        - name: "get {{ ironic_conductor }} container ID"
          command: 'docker ps -f name={{ ironic_conductor }} --format {% raw %}"{{ .ID }}"{% endraw %}'
          register: conductor_id
        - name: set the iscsi verify attempt count
          lineinfile:
            path: /var/lib/config-data/puppet-generated/ironic/etc/ironic/ironic.conf
            insertafter: '^#iscsi_verify_attempts'
            line: 'iscsi_verify_attempts = 30'
          notify: restart ironic conductor
      when: "'vqfx-0' in hostvars"
  handlers:
    - name: restart ironic conductor
      command: docker restart "{{ conductor_id.stdout }}"

---
- name: Post Undercloud Run Tasks
  hosts: undercloud
  tags: post
  gather_facts: no
  become: yes
  any_errors_fatal: true
  tasks:
    - name: Set selinux state
      selinux:
          policy: "targeted"
          state: "{{ install.selinux|default('enforcing') }}"
      when: install.selinux is defined

    - name: increase iscsi verify attempts in ironic conductor
      block:
        - name: set the iscsi verify attempt count in container
          lineinfile:
            path: /var/lib/config-data/puppet-generated/ironic/etc/ironic/ironic.conf
            insertafter: '^#iscsi_verify_attempts'
            line: 'iscsi_verify_attempts = 30'
          notify: restart ironic conductor container
          when: "install.version|openstack_release > 13"
        - name: set the iscsi verify attempt count in ironic service
          lineinfile:
            path: /etc/ironic/ironic.conf
            insertafter: '^#iscsi_verify_attempts'
            line: 'iscsi_verify_attempts = 30'
          notify: restart ironic conductor service
          when: "install.version|openstack_release <= 13"
      when:
        - "'vqfx-0' in hostvars"
        - "install.version is defined"
  handlers:
    - name: restart ironic conductor container
      command: docker restart ironic_conductor
    - name: restart ironic conductor service
      command: systemctl restart openstack-ironic-conductor.service

Add support for ironic config on non-containerized UC
Add support for ironic config on non-containerized UC

Containerized and non-containerized undercloud use different paths to
config files and different names for services. This patch treats
workarounds for ironic conductor in the undercloud differently on
non-containerized undercloud.

Change-Id: Ied2c246f5e6a9abe5baf43637b61643578b6aa30
