openstack-ansible-ops/multi-node-aio/playbooks/deploy-dhcp.yml
Jesse Pretorius d0b0668657 MNAIO: Resolve all Ansible 2.5-related deprecation warnings
To resolve the warnings, we:

1. Use import_playbook instead of include for the conditional
   playbook inclusions in site.yml. TIL that using include_playbook
   does not work with conditionals.

2. Use include_tasks instead of include for the openstack-image-setup
   task set inclusion.

3. Switch to using 'is' instead of '|' for tests.

Change-Id: I6d68bd4fecda122a77f7934842c3479a4c0792fd
2018-06-27 07:47:08 +01:00

73 lines
2.4 KiB
YAML

---
# 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: Gather facts
hosts: dhcp_hosts
gather_facts: "{{ gather_facts | default(true) }}"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- deploy-dhcpd
tasks:
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}.yml"
- "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}.yml"
tags:
- always
- name: Install all required packages for dhcpd_install
package:
name: "{{ mnaio_dhcp_distro_packages }}"
state: "latest"
update_cache: yes
cache_valid_time: 600
register: _install_host_packages
until: _install_host_packages is success
retries: 3
delay: 15
- name: Enable services
service:
name: "{{ item }}"
enabled: yes
with_items: "{{ mnaio_dhcp_distro_packages }}"
- name: Create a template in /etc/dhcp/dhcpd.conf
template:
src: dhcp/dhcpd.conf.j2
dest: /etc/dhcp/dhcpd.conf
mode: 0644
owner: root
group: root
notify: restart dhcpd
- name: Create a template in /etc/dhcp/dhcpd.conf
template:
src: dhcp/isc-dhcp-server
dest: /etc/default/isc-dhcp-server
mode: 0644
owner: root
group: root
notify: restart dhcpd
handlers:
- name: restart dhcpd
service:
name: "{{ item }}"
state: restarted
with_items: "{{ mnaio_dhcp_distro_packages }}"