Skip to content

Commit

Permalink
Merge pull request #4 from Oefenweb/consistency-changes
Browse files Browse the repository at this point in the history
Consistency changes
  • Loading branch information
tersmitten authored Sep 28, 2022
2 parents 9856cf6 + 9bed5c3 commit 6070287
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 42 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
warn_list:
- role-name
- name[casing]
- yaml[comments-indentation]
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install ansible-lint[community,yamllint]
run: |
pip install ansible-lint
ansible-galaxy install -r requirements.yml
- name: Lint code
run: |
Expand All @@ -43,11 +45,8 @@ jobs:
matrix:
include:
- distro: debian8
ansible-version: '<2.10'
- distro: debian9
- distro: debian10
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
Expand Down
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM ubuntu:16.04
FROM ubuntu:18.04
MAINTAINER Mischa ter Smitten <[email protected]>

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

# python
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-dev curl && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal python3-dev curl && \
apt-get clean
RUN curl -sL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python -
RUN curl -sL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3 -
RUN rm -rf $HOME/.cache

# ansible
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-apt && \
apt-get clean
RUN pip install ansible==2.9.15
RUN pip3 install ansible==2.10.7
RUN rm -rf $HOME/.cache

# provision
Expand Down
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# handlers file
---
- name: update font cache
command: >
ansible.builtin.command: >
fc-cache -f -v
5 changes: 2 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# meta file
---
galaxy_info:
namespace: oefenweb
author: oefenweb
role_name: fonts
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
description: Set up fonts in Debian-like systems
license: MIT
min_ansible_version: 2.9.0
min_ansible_version: 2.10.0
platforms:
- name: Ubuntu
versions:
Expand Down
6 changes: 6 additions & 0 deletions molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
collections:
- name: community.docker
version: '>=1.2.0,<2'
- name: community.general
version: '>=2,<3'
6 changes: 3 additions & 3 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/_molecule.yml"
# - name: include vars
# include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/_molecule.yml"
# - name: include vars
# ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
roles:
- ../../../
10 changes: 5 additions & 5 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/_molecule.yml"
# - name: include vars
# include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
# - name: include tasks
# include: "{{ playbook_dir }}/../../tests/tasks/pre.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/_molecule.yml"
# - name: include vars
# ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
# - name: include tasks
# ansible.builtin.import_tasks: "{{ playbook_dir }}/../../tests/tasks/pre.yml"
4 changes: 4 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# requirements file
---
collections:
- name: ansible.posix
24 changes: 12 additions & 12 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: install dependencies
apt:
ansible.builtin.apt:
name: "{{ fonts_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
Expand All @@ -12,7 +12,7 @@
- fonts-dependencies

- name: create (font) directories
file:
ansible.builtin.file:
path: "{{ item.dest }}"
state: directory
owner: root
Expand All @@ -28,7 +28,7 @@
- fonts-directories-create

- name: remove (font) directories
file:
ansible.builtin.file:
path: "{{ item.dest }}"
state: absent
with_items: "{{ fonts_font_paths }}"
Expand All @@ -42,10 +42,16 @@
- fonts-directories
- fonts-directories-remove

- block:
- name: synchronize
tags:
- configuration
- fonts
- fonts-directories
- fonts-directories-synchronize
block:

- name: synchronize (font) directories (remote)
synchronize:
ansible.posix.synchronize:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
archive: true
Expand All @@ -63,7 +69,7 @@
notify: update font cache

- name: synchronize (font) directories (local)
shell: >
ansible.builtin.shell: >
{{ fonts_rsync_path | default('rsync') }} -ai --delete --no-owner --no-group --exclude=.uuid --checksum {{ item.src }} {{ item.dest }}
args:
warn: false
Expand All @@ -74,9 +80,3 @@
- ansible_connection == 'local'
- (item.state is undefined or item.state == 'present')
notify: update font cache

tags:
- configuration
- fonts
- fonts-directories
- fonts-directories-synchronize
6 changes: 3 additions & 3 deletions tests/tasks/pre.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# pre test file
---
- name: set fact
command: >
ansible.builtin.command: >
echo "{{ ansible_connection }}"
register: _ansible_connection
changed_when: false

- name: install dependencies
apt:
ansible.builtin.apt:
name:
- wget
- unzip
Expand All @@ -18,7 +18,7 @@
when: _ansible_connection.stdout != 'ssh'

- name: download font
shell: >
ansible.builtin.shell: >
true
&& cd {{ fonts_files_paths }}
&& wget 'https://fonts.google.com/download?family=Ubuntu' -O ubuntu-font-family.zip
Expand Down
6 changes: 3 additions & 3 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/_test.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/_test.yml"
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../
6 changes: 3 additions & 3 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/_vagrant.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/_vagrant.yml"
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../

0 comments on commit 6070287

Please sign in to comment.