Skip to content

Commit 9cfc435

Browse files
authored
Merge pull request #1 from derFreitag/refactor
Major update on the syntax and CI!
2 parents 602b38f + f4cace3 commit 9cfc435

File tree

8 files changed

+117
-35
lines changed

8 files changed

+117
-35
lines changed

.github/workflows/ci.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
9+
jobs:
10+
11+
yaml:
12+
name: YAML lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Install dependencies
24+
run: pip3 install yamllint
25+
26+
- name: Lint the code
27+
run: |
28+
yamllint */*.yml
29+
30+
playbook:
31+
name: ansible-playbook lint
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Check out
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.x'
41+
42+
- name: Install dependencies
43+
run: pip3 install ansible
44+
45+
- name: Lint
46+
run: |
47+
ansible-galaxy role install geerlingguy.ntp
48+
ansible-playbook --syntax-check ansible.yml
49+
50+
ansible-lint:
51+
name: ansible-lint
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Check out
55+
uses: actions/checkout@v4
56+
57+
- name: Set up Python
58+
uses: actions/setup-python@v5
59+
with:
60+
python-version: '3.x'
61+
62+
- name: Install dependencies
63+
run: pip3 install ansible-lint
64+
65+
- name: Lint
66+
run: |
67+
ansible-lint .

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
venv

README.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
freitag.base
2-
============
1+
# freitag.base
2+
33
Ansible role to install system wide utilities.
44

5-
Requirements
6-
------------
5+
## Requirements
6+
77
None
88

9-
Role Variables
10-
--------------
9+
## Role Variables
10+
1111
None
1212

13-
Dependencies
14-
------------
13+
## Dependencies
14+
1515
Depends on ``geerlingguy.ntp``.
1616

17-
Example Playbook
18-
----------------
17+
## Example Playbook
18+
19+
```yml
1920
- hosts: servers
2021
roles:
2122
- { role: freitag.base }
23+
```
24+
25+
## License
2226
23-
License
24-
-------
2527
GPLv3
2628
27-
Author Information
28-
------------------
29+
## Author Information
30+
2931
Gil Forcada Codinachs (der Freitag)

ansible.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
roles_path = ..

ansible.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- hosts: all
3+
roles:
4+
- freitag.base

meta/main.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
---
2+
3+
dependencies:
4+
- role: geerlingguy.ntp
5+
16
galaxy_info:
2-
author: Gil Forcada
3-
description: Ansible role to install system wide utilities
7+
author: Gil Forcada Codinachs
8+
description: Install system wide utilities
49
company: der Freitag
10+
role_name: base
11+
namespace: freitag
512
license: license (GPLv3)
6-
min_ansible_version: 2.1
13+
min_ansible_version: '2.2'
714
platforms:
815
- name: Ubuntu
916
versions:
10-
- xenial
17+
- jammy
1118
galaxy_tags:
1219
- system
1320
- development
14-
dependencies:
15-
- { role: geerlingguy.ntp, ntp_timezone: Europe/Berlin }

tasks/main.yml

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22

33
- name: Update
4-
become: yes
5-
apt:
6-
update_cache=yes
4+
become: true
5+
ansible.builtin.apt:
6+
update_cache: true
77

88
- name: Install system dependencies
9-
become: yes
10-
apt:
11-
name: "{{item}}"
9+
become: true
10+
ansible.builtin.apt:
11+
name: "{{ item }}"
1212
state: present
1313
with_items:
1414
- vim
@@ -19,14 +19,12 @@
1919
- strace
2020

2121
- name: Install German locale
22-
become: yes
23-
locale_gen:
24-
name=de_DE.UTF-8
25-
state=present
22+
become: true
23+
community.general.locale_gen:
24+
name: de_DE.UTF-8
25+
state: present
2626

27-
# XXX use the newer synatx on ansible >= 2.2.0
2827
- name: Set timezone to Europe/Berlin
29-
become: yes
30-
shell: timedatectl set-timezone Europe/Berlin
31-
# timezone:
32-
# name=Europe/Berlin
28+
become: true
29+
community.general.timezone:
30+
name: Europe/Berlin

vars/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
3+
ntp_timezone: Europe/Berlin

0 commit comments

Comments
 (0)