mirror of
https://github.com/roles-ansible/ansible_role_ntp.git
synced 2024-08-16 12:59:49 +02:00
use modern ansible name scheme and remove travis
This commit is contained in:
parent
fcd83491f8
commit
3974bd6500
16 changed files with 76 additions and 231 deletions
|
@ -1,2 +0,0 @@
|
|||
skip_list:
|
||||
- '305'
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
- name: install and test this ntp role
|
||||
hosts: localhost
|
||||
tags:
|
||||
- default
|
||||
roles:
|
||||
- './'
|
||||
vars:
|
||||
- submodules_versioncheck: false
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.cache
|
81
.travis.yml
81
.travis.yml
|
@ -1,81 +0,0 @@
|
|||
---
|
||||
version: "~> 1.0"
|
||||
|
||||
os: linux
|
||||
|
||||
language: python
|
||||
|
||||
python:
|
||||
- '3.8'
|
||||
- '3.7'
|
||||
- '3.6'
|
||||
|
||||
services: docker
|
||||
|
||||
cache:
|
||||
pip: true
|
||||
directories:
|
||||
- ".tox"
|
||||
|
||||
install:
|
||||
- pip install tox-travis
|
||||
env:
|
||||
jobs:
|
||||
- TOX_DISTRO=archlinuxlatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=alpinelatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=alpine310 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=alpine39 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=centoslatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=centos8 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=centos7 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=clearlinuxlatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=debianlatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=debianstable TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=debian10 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=debian9 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=debian8 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=fedoralatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=fedora31 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=fedora30 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=fedora29 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=fedora28 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=opensuselatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=opensuse15 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=ubuntulatest TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=ubuntu2004 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=ubuntu1904 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=ubuntu1804 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=ubuntu1604 TOX_ANSIBLE=latest
|
||||
- TOX_DISTRO=alpinelatest TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=alpine310 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=alpine39 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=centoslatest TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=centos8 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=centos7 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=clearlinuxlatest TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=debianlatest TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=debianstable TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=debian10 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=debian9 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=debian8 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=fedoralatest TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=fedora31 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=fedora30 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=fedora29 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=fedora28 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=opensuselatest TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=opensuse15 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=ubuntulatest TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=ubuntu2004 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=ubuntu1904 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=ubuntu1804 TOX_ANSIBLE={29,28}
|
||||
- TOX_DISTRO=ubuntu1604 TOX_ANSIBLE={29,28}
|
||||
script:
|
||||
- tox -e $(echo py${TRAVIS_PYTHON_VERSION} | tr -d .)-ansible${TOX_ANSIBLE}-${TOX_DISTRO}
|
||||
- |
|
||||
rm -r .tox/py*/log/*
|
||||
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
|
|
@ -19,8 +19,7 @@ ntp_servers:
|
|||
- 3.pool.ntp.org iburst
|
||||
|
||||
# Enable or disable ntp statistics
|
||||
# Default is false
|
||||
ntp_statistics: false
|
||||
|
||||
# version check for this playbook
|
||||
submodules_versioncheck: true
|
||||
# version check for this playbook (true is recomended)
|
||||
submodules_versioncheck: false
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
---
|
||||
# handlers file for ansible-role-ntp
|
||||
|
||||
- name: Restart ntp daemons on Linux
|
||||
become: yes
|
||||
become: true
|
||||
service:
|
||||
name: "{{ ntp_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: Restart ntp daemons on FreeBSD
|
||||
become: yes
|
||||
become: true
|
||||
service:
|
||||
name: "{{ ntp_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: Restart ntp daemons on OpenBSD
|
||||
become: yes
|
||||
become: true
|
||||
service:
|
||||
name: "{{ ntp_service }}"
|
||||
state: restarted
|
||||
|
|
|
@ -1,46 +1,24 @@
|
|||
galaxy_info:
|
||||
role_name: ntp
|
||||
author: L3D
|
||||
author: do1jlr
|
||||
description: Ansible role for manage ntp daemon
|
||||
license: "Apache"
|
||||
|
||||
min_ansible_version: 2.7
|
||||
min_ansible_version: 2.8
|
||||
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
versions: all
|
||||
- name: Alpine
|
||||
version:
|
||||
- latest
|
||||
- 3.10
|
||||
- 3.9
|
||||
- 3.8
|
||||
version: all
|
||||
- name: Clearlinux
|
||||
version:
|
||||
- latest
|
||||
version: all
|
||||
- name: Debian
|
||||
versions:
|
||||
- latest
|
||||
- stable
|
||||
- 10
|
||||
- 9
|
||||
- 8
|
||||
versions: all
|
||||
- name: EL
|
||||
versions:
|
||||
- latest
|
||||
- 8
|
||||
- 7
|
||||
versions: all
|
||||
- name: Fedora
|
||||
versions:
|
||||
- latest
|
||||
- 31
|
||||
- 30
|
||||
- 29
|
||||
- 28
|
||||
- name: Suse
|
||||
versions:
|
||||
- latest
|
||||
- 15
|
||||
versions: all
|
||||
|
||||
galaxy_tags:
|
||||
- system
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# Tasks file for config ntp daemon
|
||||
|
||||
- name: seting-up ntp config
|
||||
become: yes
|
||||
template:
|
||||
src: ntp.conf.j2
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: templates/ntp.conf.j2
|
||||
dest: "{{ ntp_configfile }}"
|
||||
owner: "{{ ntp_configfile_user }}"
|
||||
group: "{{ ntp_configfile_group }}"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
- include_tasks: versioncheck.yml
|
||||
- name: run versionscheck if enabled
|
||||
ansible.builtin.include_tasks: versioncheck.yml
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Include OS specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', ntp__vars) }}"
|
||||
|
||||
- name: Install ntp
|
||||
include_tasks: "packages/setup-{{ ansible_system }}.yml"
|
||||
|
||||
ansible.builtin.include_tasks: "{{ lookup('first_found', ntp__install) }}"
|
||||
- name: Configure ntp
|
||||
include_tasks: config.yml
|
||||
ansible.builtin.include_tasks: config.yml
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Tasks file for install ntp daemon on MacOSX system
|
||||
|
||||
- name: Service ntp on MacOSX
|
||||
become: yes
|
||||
service:
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: "{{ ntp_service }}"
|
||||
enabled: yes
|
||||
enabled: true
|
||||
state: started
|
||||
|
|
|
@ -1,21 +1,29 @@
|
|||
---
|
||||
# Tasks file for install ntp daemon on Linux system
|
||||
|
||||
- name: Update apt cache
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
cache_valid_time: 3600
|
||||
update_cache: true
|
||||
when:
|
||||
- ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: Update emerge cache on Gentoo
|
||||
become: yes
|
||||
shell: emerge-webrsync
|
||||
become: true
|
||||
ansible.builtin.shell: emerge-webrsync
|
||||
changed_when: false
|
||||
when: ansible_os_family == "Gentoo"
|
||||
|
||||
- name: Install ntp daemon on Linux
|
||||
become: yes
|
||||
package:
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: "{{ ntp_package }}"
|
||||
state: present
|
||||
|
||||
- name: Service ntp on Linux
|
||||
become: yes
|
||||
service:
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: "{{ ntp_service }}"
|
||||
enabled: yes
|
||||
enabled: true
|
||||
state: started
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
# Tasks file for install ntp daemon on OpenBSD system
|
||||
|
||||
- name: Install ntp daemon on OpenBSD
|
||||
become: yes
|
||||
package:
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: "{{ ntp_package }}"
|
||||
state: present
|
||||
|
||||
- name: Service ntp on OpenBSD
|
||||
become: yes
|
||||
service:
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: "{{ ntp_service }}"
|
||||
enabled: yes
|
||||
enabled: true
|
||||
state: started
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
- name: Create directory for versionscheck
|
||||
become: true
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: '/etc/.ansible-version'
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
@ -9,38 +9,38 @@
|
|||
|
||||
- name: check playbook version
|
||||
become: true
|
||||
slurp:
|
||||
ansible.builtin.slurp:
|
||||
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||
register: playbook_version
|
||||
when: submodules_versioncheck|bool
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
failed_when: false
|
||||
|
||||
- name: Print remote role version
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Print locale role version
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "Local role version: '{{ playbook_version_number|string }}'."
|
||||
when: submodules_versioncheck|bool
|
||||
|
||||
- name: Check if your version is outdated
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
||||
when:
|
||||
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
||||
|
||||
- name: check if '/etc/ansible-version/' is empty
|
||||
find:
|
||||
ansible.builtin.find:
|
||||
paths: '/etc/ansible-version/'
|
||||
register: filesFound
|
||||
|
||||
- name: write new version to remote disk
|
||||
become: true
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: "{{ playbook_version_number }}"
|
||||
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||
mode: 0644
|
||||
mode: '0644'
|
||||
when: submodules_versioncheck|bool
|
||||
|
|
68
tox.ini
68
tox.ini
|
@ -1,68 +0,0 @@
|
|||
[tox]
|
||||
minversion = 3.7
|
||||
envlist = py{3}-ansible{latest,29,28}-{ alpinelatest,alpine310,alpine39,alpine38, centoslatest,centos8,centos7, debianlatest,debian10,debian9,debian8, fedoralatest,fedora30,fedora29,fedora28, ubuntulatest,ubuntu2004,ubuntu1904,ubuntu1804,ubuntu1604 }
|
||||
|
||||
# only test currently supported ansible versions
|
||||
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#release-status
|
||||
|
||||
skipsdist = true
|
||||
|
||||
[base]
|
||||
passenv = *
|
||||
deps =
|
||||
-r.requirements.txt
|
||||
ansible25: ansible==2.5
|
||||
ansible26: ansible==2.6
|
||||
ansible27: ansible==2.7
|
||||
ansible28: ansible==2.8
|
||||
ansible29: ansible==2.9
|
||||
ansiblelatest: ansible
|
||||
commands =
|
||||
ansible-playbook .ansible-test.yml -i localhost
|
||||
setenv =
|
||||
TOX_ENVNAME={envname}
|
||||
MOLECULE_EPHEMERAL_DIRECTORY=/tmp/{envname}
|
||||
|
||||
[testenv]
|
||||
passenv =
|
||||
{[base]passenv}
|
||||
deps =
|
||||
{[base]deps}
|
||||
commands =
|
||||
{[base]commands}
|
||||
setenv =
|
||||
archlinuxlatest: MOLECULE_DISTRO="archlinux:latest"
|
||||
|
||||
alpinelatest: MOLECULE_DISTRO="alpine:latest"
|
||||
alpine310: MOLECULE_DISTRO="alpine:3.10"
|
||||
alpine39: MOLECULE_DISTRO="alpine:3.9"
|
||||
alpine38: MOLECULE_DISTRO="alpine:3.8"
|
||||
|
||||
centoslatest: MOLECULE_DISTRO="centos:latest"
|
||||
centos8: MOLECULE_DISTRO="centos:8"
|
||||
centos7: MOLECULE_DISTRO="centos:7"
|
||||
|
||||
clearlinuxlatest: MOLECULE_DISTRO="clearlinux:latest"
|
||||
|
||||
debianlatest: MOLECULE_DISTRO="debian:latest"
|
||||
debianstable: MOLECULE_DISTRO="debian:stable"
|
||||
debian10: MOLECULE_DISTRO="debian:10"
|
||||
debian9: MOLECULE_DISTRO="debian:9"
|
||||
debian8: MOLECULE_DISTRO="debian:8"
|
||||
|
||||
fedoralatest: MOLECULE_DISTRO="fedora:latest"
|
||||
fedora31: MOLECULE_DISTRO="fedora:31"
|
||||
fedora30: MOLECULE_DISTRO="fedora:30"
|
||||
fedora29: MOLECULE_DISTRO="fedora:29"
|
||||
fedora28: MOLECULE_DISTRO="fedora:28"
|
||||
|
||||
opensuselatest: MOLECULE_DISTRO="opensuse/leap:latest"
|
||||
opensuse15: MOLECULE_DISTRO="opensuse/leap:15"
|
||||
|
||||
ubuntulatest: MOLECULE_DISTRO="ubuntu:latest"
|
||||
ubuntu2004: MOLECULE_DISTRO="ubuntu:20.04"
|
||||
ubuntu1904: MOLECULE_DISTRO="ubuntu:19.04"
|
||||
ubuntu1804: MOLECULE_DISTRO="ubuntu:18.04"
|
||||
ubuntu1604: MOLECULE_DISTRO="ubuntu:16.04"
|
||||
|
||||
{[base]setenv}
|
7
vars/fallback.yml
Normal file
7
vars/fallback.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
ntp_package: ntp
|
||||
ntp_service: ntp
|
||||
|
||||
ntp_configfile: /etc/ntp.conf
|
||||
ntp_configfile_user: root
|
||||
ntp_configfile_group: root
|
||||
ntp_driftfile: /var/lib/ntp/drift
|
|
@ -1,3 +1,17 @@
|
|||
---
|
||||
playbook_version_number: 2049 # should be over ninethousand
|
||||
playbook_version_path: 'role-ntp_chaos-bodensee_github.com.version'
|
||||
playbook_version_number: 2050 # should be int
|
||||
playbook_version_path: 'role-ntp_chaos-bodensee_github.com.version'
|
||||
|
||||
ntp__vars:
|
||||
files:
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
- 'fallback.yml'
|
||||
paths:
|
||||
- 'vars'
|
||||
|
||||
ntp__install:
|
||||
files:
|
||||
- "setup-{{ ansible_system }}.yml"
|
||||
- 'setup-Linux.yml'
|
||||
paths:
|
||||
- 'tasks/packages'
|
||||
|
|
Loading…
Reference in a new issue