1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_ntp.git synced 2024-08-16 12:59:49 +02:00

Merge pull request #9 from roles-ansible/lint

improve linting and adding requirements
This commit is contained in:
L3D 2023-10-28 16:48:56 +02:00 committed by GitHub
commit 8ca3af23e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 16 deletions

View file

@ -1,4 +1,4 @@
[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.ntp.svg)](https://galaxy.ansible.com/l3d/ntp)
[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.ntp.svg)](https://galaxy.ansible.com/ui/standalone/roles/l3d/ntp/)
[![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.ntp_license.svg)](LICENSE)
[![Maintainance](https://ansible.l3d.space/svg/l3d.ntp_maintainance.svg)](https://ansible.l3d.space/#l3d.ntp)
@ -74,9 +74,15 @@ git clone https://github.com/roles-ansible/ansible_role_ntp.git l3d.ntp
## Resources
[ntp on ubuntu](https://doc.ubuntu-fr.org/ntp)
## Requirements
The ``community.general`` collection is required for some parts of this ansible role.
You can install it with this command:
```bash
ansible-galaxy collection install -r requirements.yml --upgrade
```
## Author Information
+ This role was created in 2018 by diodonfrost.

4
requirements.yml Normal file
View file

@ -0,0 +1,4 @@
---
collections:
- name: 'community.general'
version: ">=7.5.0,<=8.0.0"

View file

@ -1,17 +1,22 @@
---
- name: Optionally run versionscheck if enabled
ansible.builtin.include_tasks: versioncheck.yml
ansible.builtin.include_tasks:
file: versioncheck.yml
when: submodules_versioncheck | bool
- name: Include OS specific variables.
ansible.builtin.include_vars: "{{ lookup('first_found', ntp__vars) }}"
ansible.builtin.include_vars:
file: "{{ lookup('first_found', ntp__vars) }}"
- name: Install ntp
ansible.builtin.include_tasks: "{{ lookup('first_found', ntp__install) }}"
ansible.builtin.include_tasks:
file: "{{ lookup('first_found', ntp__install) }}"
- name: Configure ntp
ansible.builtin.include_tasks: config.yml
ansible.builtin.include_tasks:
file: config.yml
- name: Optionally set NTP Timezone
ansible.builtin.include_tasks: set_time_zone.yml
ansible.builtin.include_tasks:
file: set_time_zone.yml
when: ntp_set_time_zone | bool

View file

@ -13,18 +13,17 @@
- name: Check playbook version
become: true
ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ ntp__playbook_version_path }}"
register: ntp__playbook_version
src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version
when: submodules_versioncheck | bool
ignore_errors: true
failed_when: false
- name: Print remote role version
- name: Print remote role version # noqa: H500
ansible.builtin.debug:
msg: "Remote role version: {{ ntp__playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck | bool
- name: Print locale role version
- name: Print locale role version # noqa: H500
ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck | bool
@ -33,13 +32,13 @@
ansible.builtin.fail:
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
when:
- ntp__playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck | bool
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck | bool
- name: Write new version to remote disk
become: true
ansible.builtin.copy:
content: "{{ playbook_version_number }}"
dest: "/etc/.ansible-version/{{ ntp__playbook_version_path }}"
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
mode: '0644'
when: submodules_versioncheck | bool
tags: skip_ansible_lint_template-instead-of-copy

View file

@ -1,5 +1,5 @@
---
playbook_version_number: 2057
playbook_version_number: 2058
ntp__playbook_version_path: 'role-ntp_chaos-bodensee_github.com.version'
ntp__vars: