tripleo-ansible/tripleo_ansible/roles/tripleo_image_serve/tasks/main.yml
Alex Schultz 768e33e12b Additional handler cleanup
Remove empty handler files and move image serve handler to the tasks.

Change-Id: I454d8a8b87476e833a96beaf18b17047aee500f6
Related-Bug: #1888853
2020-08-03 07:55:34 -06:00

65 lines
1.7 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: ensure apache is installed
package:
name: httpd
state: present
register: tripleo_image_serve_pkg_result
- name: create image data directory
file:
state: directory
path: "{{ tripleo_image_data_dir }}/v2"
mode: 0755
owner: root
group: root
setype: httpd_sys_content_t
- name: create /v2/ response file
copy:
content: "{}"
dest: "{{ tripleo_image_data_dir }}/v2/index.json"
mode: 0644
owner: root
group: root
setype: httpd_sys_content_t
- name: Add listen line
lineinfile:
path: /etc/httpd/conf/httpd.conf
regexp: '^\s*Listen(.*)$'
line: '# Listen \1'
register: tripleo_image_serve_httpd_config_result
- name: manage /etc/httpd/conf.d/image-serve.conf
template:
src: image-serve.conf.j2
dest: /etc/httpd/conf.d/image-serve.conf
register: tripleo_image_serve_config_result
- name: Image-Serve | restart httpd
systemd:
name: httpd
state: restarted
enabled: true
daemon_reload: true
when:
- (tripleo_image_serve_pkg_result.changed or
tripleo_image_serve_httpd_config_result.changed or
tripleo_image_serve_config_result.changed)