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:
commit
8ca3af23e2
5 changed files with 30 additions and 16 deletions
10
README.md
10
README.md
|
@ -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)
|
[![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)
|
[![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
|
## Resources
|
||||||
|
|
||||||
[ntp on ubuntu](https://doc.ubuntu-fr.org/ntp)
|
[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
|
## Author Information
|
||||||
|
|
||||||
+ This role was created in 2018 by diodonfrost.
|
+ This role was created in 2018 by diodonfrost.
|
||||||
|
|
4
requirements.yml
Normal file
4
requirements.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
collections:
|
||||||
|
- name: 'community.general'
|
||||||
|
version: ">=7.5.0,<=8.0.0"
|
|
@ -1,17 +1,22 @@
|
||||||
---
|
---
|
||||||
- name: Optionally run versionscheck if enabled
|
- name: Optionally run versionscheck if enabled
|
||||||
ansible.builtin.include_tasks: versioncheck.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: versioncheck.yml
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Include OS specific variables.
|
- 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
|
- 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
|
- name: Configure ntp
|
||||||
ansible.builtin.include_tasks: config.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: config.yml
|
||||||
|
|
||||||
- name: Optionally set NTP Timezone
|
- 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
|
when: ntp_set_time_zone | bool
|
||||||
|
|
|
@ -13,18 +13,17 @@
|
||||||
- name: Check playbook version
|
- name: Check playbook version
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.slurp:
|
ansible.builtin.slurp:
|
||||||
src: "/etc/.ansible-version/{{ ntp__playbook_version_path }}"
|
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
register: ntp__playbook_version
|
register: playbook_version
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
ignore_errors: true
|
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Print remote role version
|
- name: Print remote role version # noqa: H500
|
||||||
ansible.builtin.debug:
|
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
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Print locale role version
|
- name: Print locale role version # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Local role version: '{{ playbook_version_number | string }}'."
|
msg: "Local role version: '{{ playbook_version_number | string }}'."
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
|
@ -33,13 +32,13 @@
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
||||||
when:
|
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
|
- name: Write new version to remote disk
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: "{{ playbook_version_number }}"
|
content: "{{ playbook_version_number }}"
|
||||||
dest: "/etc/.ansible-version/{{ ntp__playbook_version_path }}"
|
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
tags: skip_ansible_lint_template-instead-of-copy
|
tags: skip_ansible_lint_template-instead-of-copy
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
playbook_version_number: 2057
|
playbook_version_number: 2058
|
||||||
ntp__playbook_version_path: 'role-ntp_chaos-bodensee_github.com.version'
|
ntp__playbook_version_path: 'role-ntp_chaos-bodensee_github.com.version'
|
||||||
|
|
||||||
ntp__vars:
|
ntp__vars:
|
||||||
|
|
Loading…
Reference in a new issue