Separate tripleo-time into two distinct roles

This change converts the tripleo time role into two roles:

  - tripleo-ptp
  - tripleo-timezone

This change will ensure we're able to cleanly install and setup
ptp when needed while also providing a well defined interface
for setting the timezone on systems.

Change-Id: I0a2b2241a38f3d98ac421e6106fb81210961c1f5
Signed-off-by: Kevin Carter <kecarter@redhat.com>
changes/32/674932/3
Kevin Carter 3 years ago
parent 81029211d4
commit 3d4093672a
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
  1. 8
      doc/source/roles/role-tripleo-time.rst
  2. 6
      doc/source/roles/role-tripleo-timezone.rst
  3. 2
      tripleo_ansible/roles/tripleo-ptp/defaults/main.yml
  4. 8
      tripleo_ansible/roles/tripleo-ptp/handlers/main.yml
  5. 45
      tripleo_ansible/roles/tripleo-ptp/meta/main.yml
  6. 0
      tripleo_ansible/roles/tripleo-ptp/molecule/default/Dockerfile
  7. 0
      tripleo_ansible/roles/tripleo-ptp/molecule/default/molecule.yml
  8. 2
      tripleo_ansible/roles/tripleo-ptp/molecule/default/playbook.yml
  9. 0
      tripleo_ansible/roles/tripleo-ptp/molecule/default/prepare.yml
  10. 0
      tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/Dockerfile
  11. 0
      tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/molecule.yml
  12. 2
      tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/playbook.yml
  13. 0
      tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/prepare.yml
  14. 11
      tripleo_ansible/roles/tripleo-ptp/tasks/main.yml
  15. 0
      tripleo_ansible/roles/tripleo-ptp/tasks/tripleo_ntp_stop.yml
  16. 0
      tripleo_ansible/roles/tripleo-ptp/tasks/tripleo_phc2sys.yml
  17. 0
      tripleo_ansible/roles/tripleo-ptp/tasks/tripleo_ptp.yml
  18. 0
      tripleo_ansible/roles/tripleo-ptp/templates/ptp4l.conf.j2
  19. 0
      tripleo_ansible/roles/tripleo-ptp/vars/redhat.yml
  20. 20
      tripleo_ansible/roles/tripleo-timezone/defaults/main.yml
  21. 24
      tripleo_ansible/roles/tripleo-timezone/handlers/main.yml
  22. 2
      tripleo_ansible/roles/tripleo-timezone/meta/main.yml
  23. 37
      tripleo_ansible/roles/tripleo-timezone/molecule/default/Dockerfile
  24. 68
      tripleo_ansible/roles/tripleo-timezone/molecule/default/molecule.yml
  25. 21
      tripleo_ansible/roles/tripleo-timezone/molecule/default/playbook.yml
  26. 21
      tripleo_ansible/roles/tripleo-timezone/molecule/default/prepare.yml
  27. 27
      tripleo_ansible/roles/tripleo-timezone/tasks/main.yml
  28. 21
      zuul.d/molecule.yaml

@ -1,6 +1,6 @@
===================
Role - tripleo-time
===================
=======================
Role - tripleo-timezone
=======================
.. ansibleautoplugin::
:role: tripleo_ansible/roles/tripleo-time
:role: tripleo_ansible/roles/tripleo-timezone

@ -0,0 +1,6 @@
=======================
Role - tripleo-timezone
=======================
.. ansibleautoplugin::
:role: tripleo_ansible/roles/tripleo-timezone

@ -17,8 +17,6 @@
# All variables intended for modification should place placed in this file.
tripleo_timezone: 'UTC'
tripleo_ptp_slave_mode: 1
tripleo_ptp_interfaces: ["{{ ansible_default_ipv4.interface }}"]
tripleo_ptp_transport: UDPv4

@ -25,11 +25,3 @@
name: phc2sys
state: restarted
enabled: true
- name: Restart time services
service:
name: "{{ item }}"
state: restarted
with_items:
- rsyslog
- crond

@ -0,0 +1,45 @@
---
# 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.
galaxy_info:
author: OpenStack
description: TripleO OpenStack Role -- tripleo-ptp
company: Red Hat
license: Apache-2.0
min_ansible_version: 2.7
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
platforms:
- name: Fedora
versions:
- 28
- name: CentOS
versions:
- 7
galaxy_tags:
- tripleo
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
dependencies:
- role: tripleo-timezone

@ -20,5 +20,5 @@
tasks:
- name: Run ntp stop
include_role:
name: tripleo-time
name: tripleo-ptp
tasks_from: tripleo_ntp_stop.yml

@ -15,7 +15,7 @@
# under the License.
# "tripleo-time" will search for and load any operating system variable file
# "tripleo-ptp" will search for and load any operating system variable file
# found within the "vars/" path. If no OS files are found the task will skip.
- name: Gather variables for each operating system
@ -32,14 +32,11 @@
tags:
- always
- name: Set timezone
timezone:
name: "{{ tripleo_timezone }}"
notify:
- Restart time services
- name: Run ptp tasks
include_tasks: tripleo_ptp.yml
- name: Run phc2sys tasks
include_tasks: tripleo_phc2sys.yml
- name: Force all notified handlers to run at this point
meta: flush_handlers

@ -0,0 +1,20 @@
---
# 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.
# All variables intended for modification should place placed in this file.
tripleo_timezone: 'UTC'

@ -0,0 +1,24 @@
---
# 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: Restart time services
systemd:
name: "{{ item }}"
state: restarted
with_items:
- rsyslog
- crond

@ -17,7 +17,7 @@
galaxy_info:
author: OpenStack
description: TripleO OpenStack Role -- tripleo-time
description: TripleO OpenStack Role -- tripleo-timezone
company: Red Hat
license: Apache-2.0
min_ansible_version: 2.7

@ -0,0 +1,37 @@
# Molecule managed
# 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.
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

@ -0,0 +1,68 @@
---
driver:
name: docker
log: true
platforms:
- name: centos7
hostname: centos7
image: centos:7
dockerfile: Dockerfile
pkg_extras: python-setuptools cronie rsyslog
easy_install:
- pip
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
command: /sbin/init
tmpfs:
- /run
- /tmp
capabilities:
- ALL # CENT7 requires all due to the age of the software
volumes:
- /run/udev:/run/udev:ro
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: fedora28
hostname: fedora28
image: fedora:28
dockerfile: Dockerfile
pkg_extras: python*-setuptools cronie rsyslog
environment:
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
command: /sbin/init
privileged: true
tmpfs:
- /run
- /tmp
capabilities:
- SYS_ADMIN
volumes:
- /run/udev:/run/udev:ro
- /sys/fs/cgroup:/sys/fs/cgroup:ro
provisioner:
name: ansible
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
lint:
enabled: false
verifier:
name: testinfra
lint:
name: flake8

@ -0,0 +1,21 @@
---
# 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: Converge
hosts: all
roles:
- role: "tripleo-timezone"

@ -0,0 +1,21 @@
---
# 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: Prepare
hosts: all
roles:
- role: test_deps

@ -0,0 +1,27 @@
---
# 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.
# "tripleo-timezone" will search for and load any operating system variable file
- name: Set timezone
timezone:
name: "{{ tripleo_timezone }}"
notify:
- Restart time services
- name: Force all notified handlers to run at this point
meta: flush_handlers

@ -20,7 +20,8 @@
- tripleo-ansible-centos-7-molecule-tripleo-persist
- tripleo-ansible-centos-7-molecule-tripleo-ceph-run-ansible
- tripleo-ansible-centos-7-molecule-login-defs
- tripleo-ansible-centos-7-molecule-tripleo-time
- tripleo-ansible-centos-7-molecule-tripleo-ptp
- tripleo-ansible-centos-7-molecule-tripleo-timezone
- tripleo-ansible-centos-7-molecule-tripleo-config
gate:
jobs:
@ -42,7 +43,8 @@
- tripleo-ansible-centos-7-molecule-tripleo-persist
- tripleo-ansible-centos-7-molecule-tripleo-ceph-run-ansible
- tripleo-ansible-centos-7-molecule-login-defs
- tripleo-ansible-centos-7-molecule-tripleo-time
- tripleo-ansible-centos-7-molecule-tripleo-ptp
- tripleo-ansible-centos-7-molecule-tripleo-timezone
- tripleo-ansible-centos-7-molecule-tripleo-config
name: tripleo-ansible-molecule-jobs
- job:
@ -168,8 +170,8 @@
name: tripleo-ansible-centos-7-molecule-tripleo-ceph-run-ansible
parent: tripleo-ansible-centos-7-base
vars:
tripleo_job_ansible_args: -v --skip-tags=run_uuid_ansible,run_ceph_ansible
tripleo_role_name: tripleo-ceph-run-ansible
tripleo_job_ansible_args: '-v --skip-tags=run_uuid_ansible,run_ceph_ansible'
- job:
files:
- ^tripleo_ansible/roles/login-defs/.*
@ -179,11 +181,18 @@
tripleo_role_name: login-defs
- job:
files:
- ^tripleo_ansible/roles/tripleo-time/.*
name: tripleo-ansible-centos-7-molecule-tripleo-time
- ^tripleo_ansible/roles/tripleo-ptp/.*
name: tripleo-ansible-centos-7-molecule-tripleo-ptp
parent: tripleo-ansible-centos-7-base
vars:
tripleo_role_name: tripleo-time
tripleo_role_name: tripleo-ptp
- job:
files:
- ^tripleo_ansible/roles/tripleo-timezone/.*
name: tripleo-ansible-centos-7-molecule-tripleo-timezone
parent: tripleo-ansible-centos-7-base
vars:
tripleo_role_name: tripleo-timezone
- job:
files:
- ^tripleo_ansible/roles/tripleo-config/.*

Loading…
Cancel
Save