tripleo_timezone: update for standalone roles

Refactors the role into separate configure.yml and run.yml task
files so that the tasks can be run separately. main.yml includes both
new task files for backwards compatibility.

Change-Id: I48c86a62d897eb3c77935600905d72f256b6b99a
Signed-off-by: James Slagle <jslagle@redhat.com>
This commit is contained in:
James Slagle 2022-05-17 16:46:50 -04:00
parent a895c7ee94
commit dc00ba7b9b
3 changed files with 57 additions and 17 deletions

View File

@ -0,0 +1,25 @@
---
# Copyright 2022 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: Set timezone
timezone:
name: "{{ tripleo_timezone }}"
register: _timezone_result
- name: Set fact for timezone result
set_fact:
_timezone_result_changed: _timezone_result.changed

View File

@ -15,21 +15,8 @@
# under the License.
# "tripleo_timezone" will search for and load any operating system variable file
- name: Configure timezone
import_tasks: configure.yml
- name: Set timezone
timezone:
name: "{{ tripleo_timezone }}"
register: _timezone_result
- name: Restart time services
systemd:
name: "{{ time_svc }}"
state: restarted
loop_control:
loop_var: time_svc
loop:
- rsyslog
- crond
when:
- _timezone_result.changed
- name: Run timezone
import_tasks: run.yml

View File

@ -0,0 +1,28 @@
---
# Copyright 2022 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: Restart time services
systemd:
name: "{{ time_svc }}"
state: restarted
loop_control:
loop_var: time_svc
loop:
- rsyslog
- crond
when:
- _timezone_result_changed|default(false)