Initial commit

This commit is contained in:
Tim Dittler
2020-01-13 14:51:16 +01:00
commit 7c454c1ed4
127 changed files with 7674 additions and 0 deletions

10
roles/ontic.fonts/.gitignore vendored Executable file
View File

@@ -0,0 +1,10 @@
# IDE
/.cache/
/.externalToolBuilders/
/.idea/
/.settings/
/.buildpath
/.project
# Vagrant
/.vagrant/

30
roles/ontic.fonts/.travis.yml Executable file
View File

@@ -0,0 +1,30 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
services: 'docker'
env:
- distribution: 'centos'
version: '7'
- distribution: 'debian'
version: '9'
- distribution: 'ubuntu'
version: '16.04'
- distribution: 'ubuntu'
version: '18.04'
before_install:
- 'export container_id=$(date +%s)'
- 'export cleanup=false'
- 'wget -O ${PWD}/tests/docker.sh https://raw.githubusercontent.com/ontic/ansible-role-test/master/docker.sh'
- 'chmod +x ${PWD}/tests/docker.sh'
- '${PWD}/tests/docker.sh build'
script:
- '${PWD}/tests/docker.sh test'
- '${PWD}/tests/docker.sh verify'
notifications:
webhooks: 'https://galaxy.ansible.com/api/v1/notifications/'

5
roles/ontic.fonts/COPYING Executable file
View File

@@ -0,0 +1,5 @@
Copyright (c) 2010-2018 Ontic. (http://www.ontic.com.au). All rights reserved.
Each Ontic source file included in this distribution is subject to the New BSD license
that is bundled with this package in the LICENSE file. To understand any restrictions on
the use and redistribution of this package please see the LICENSE file for precise details.

26
roles/ontic.fonts/LICENSE Executable file
View File

@@ -0,0 +1,26 @@
Copyright (c) 2010-2018 Ontic. (http://www.ontic.com.au). All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Ontic (http://www.ontic.com.au). nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

81
roles/ontic.fonts/README.md Executable file
View File

@@ -0,0 +1,81 @@
# Ontic Fonts ![Status](https://img.shields.io/badge/project-maintained-brightgreen.svg)
| Branch | Build | Galaxy | Release |
| :----------------- | :------------------ | :------------------ | :------------------- |
| **master** | [![Build](https://img.shields.io/travis/ontic/ansible-role-fonts/master.svg)](https://travis-ci.org/ontic/ansible-role-fonts) | [![Galaxy](https://img.shields.io/badge/galaxy-ontic.fonts-blue.svg)](https://galaxy.ansible.com/ontic/fonts) | [![Release](https://img.shields.io/github/release/ontic/ansible-role-fonts.svg)](https://github.com/ontic/ansible-role-fonts/releases) |
## Introduction
This role installs fonts on RedHat/CentOS and Debian/Ubuntu Linux servers.
## Requirements
| Name | Version |
| :-------------------------------------------------------------------------------------------- | :------------ |
None | N/A |
## Installation
We strongly suggest installing this role using [Ansible Galaxy](https://galaxy.ansible.com) so that any dependencies
will get resolved and downloaded automatically. However, we've listed a few other alternatives.
### 1.1 Downloading
Download the project files as a `.zip` archive, extracting them into your `./roles/` directory.
### 1.2 Cloning
Clone the project it into your `./roles/` directory.
### 1.3 Ansible Galaxy
The easiest way to install this module is via the command line:
```
$ ansible-galaxy install ontic.fonts
```
If you have multiple roles to install, the ansible-galaxy CLI can be fed a `requirements.yml` file.
```yml
- src: ontic.fonts
```
```
$ ansible-galaxy install -r requirements.yml
```
Alternatively you could download the source by setting the repository in your `requirements.yml` file:
```yml
- src: git+https://github.com/ontic/ansible-role-fonts.git
version: master
name: ontic.fonts
```
### 2.1 Enabling
Enable the role in your playbook file.
```yml
- name: Example web server
hosts: web_servers
roles:
- { role: ontic.fonts }
```
## Documentation
Full documentation is available in the [docs](/docs) directory.
## Contributors
Below lists all individuals having contributed to the repository. If you would like to get involved, we encourage
you to do so by making a [pull](../../pulls) request or submitting an [issue](../../issues).
* [Adam Dyson](https://github.com/adamdyson)
## License
Licensed under the BSD License. See the [LICENSE](/LICENSE) file for details.

View File

@@ -0,0 +1,7 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
fonts_shared:
fonts_user:

View File

@@ -0,0 +1,20 @@
# Documentation
## Example
```
fonts_shared:
- type: 'truetype'
src: 'Fabulous.ttf'
dest: 'dafont/Fabulous.ttf'
fonts_user:
- name: 'johndoe'
type: 'opentype'
src: 'Aulyars.otf'
dest: 'dafont/Aulyars.otf'
```
## Role Variables
Available variables are listed below, along with default values (see [defaults/main.yml](/defaults/main.yml)):

View File

@@ -0,0 +1,8 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
- name: 'rebuild fonts cache'
become: yes
shell: 'fc-cache -v -f'

View File

@@ -0,0 +1 @@
{install_date: 'Fri Jan 10 18:39:38 2020', version: v2.4.0}

31
roles/ontic.fonts/meta/main.yml Executable file
View File

@@ -0,0 +1,31 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
dependencies: []
galaxy_info:
author: 'Adam Dyson'
description: 'This role installs fonts on RedHat/CentOS and Debian/Ubuntu Linux servers.'
company: 'Ontic'
license: 'BSD-3-Clause'
min_ansible_version: '2.4'
platforms:
- name: 'Ubuntu'
versions:
- 'xenial'
- 'bionic'
- name: 'Debian'
versions:
- 'stretch'
- name: 'EL'
versions:
- '7'
galaxy_tags:
- 'ontic'
- 'system'
- 'typography'
- 'font'
- 'truetype'
- 'opentype'

View File

@@ -0,0 +1,52 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
- name: 'Fonts | Configure shared font directories.'
become: yes
file:
path: '/usr/local/share/fonts/{{ item.type }}/{{ item.dest | dirname }}'
state: 'directory'
group: 'root'
owner: 'root'
mode: '0755'
with_items: '{{ fonts_shared }}'
when: 'fonts_shared | default(None) != None'
- name: 'Fonts | Configure shared fonts.'
become: yes
copy:
src: '{{ item.src }}'
dest: '/usr/local/share/fonts/{{ item.type }}/{{ item.dest }}'
owner: 'root'
group: 'root'
mode: '0644'
register: 'fonts_shared_installed'
notify: 'rebuild fonts cache'
with_items: '{{ fonts_shared }}'
when: 'fonts_shared | default(None) != None'
- name: 'Fonts | Configure user font directories.'
become: yes
file:
path: '/home/{{ item.name }}/.fonts/{{ item.type }}/{{ item.dest | dirname }}'
state: 'directory'
owner: '{{ item.owner | default(item.name) }}'
group: '{{ item.group | default(omit) }}'
mode: '0755'
with_items: '{{ fonts_user }}'
when: 'fonts_user | default(None) != None'
- name: 'Fonts | Configure user fonts.'
become: yes
copy:
src: '{{ item.src }}'
dest: '/home/{{ item.name }}/.fonts/{{ item.type }}/{{ item.dest }}'
owner: '{{ item.owner | default(item.name) }}'
group: '{{ item.group | default(omit) }}'
mode: '{{ item.mode | default(omit) }}'
register: 'fonts_user_installed'
notify: 'rebuild fonts cache'
with_items: '{{ fonts_user }}'
when: 'fonts_user | default(None) != None'

View File

@@ -0,0 +1,28 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
- name: 'Fonts | Include OS-specific variables.'
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
tags:
- 'fonts'
- 'fonts-package'
- 'fonts-configure'
- 'package'
- 'configure'
- import_tasks: 'package.yml'
tags:
- 'fonts'
- 'fonts-package'
- 'package'
- import_tasks: 'configure.yml'
tags:
- 'fonts'
- 'fonts-configure'
- 'configure'

View File

@@ -0,0 +1,78 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
- name: 'Fonts | Debian | Install HTTPS transport.'
become: yes
apt:
name: 'apt-transport-https'
state: 'latest'
when: 'ansible_os_family == "Debian"'
- name: 'Fonts | Debian | Update repository list.'
become: yes
apt_repository:
repo: '{{ item }}'
state: 'present'
update_cache: false
register: 'fonts_multiverse_installed'
notify: 'rebuild fonts cache'
with_items: '{{ fonts_repositories }}'
when: 'ansible_distribution == "Debian"'
- name: 'Fonts | Debian | Update APT cache.'
become: yes
apt:
update_cache: yes
when: 'ansible_os_family == "Debian" and fonts_multiverse_installed.changed'
- name: 'Fonts | Debian | Install Microsoft Core Fonts prerequisites.'
become: yes
apt:
name: '{{ item }}'
state: 'present'
with_items:
- 'libfreetype6'
- 'libfreetype6-dev'
- 'fontconfig'
when: 'ansible_os_family == "Debian"'
- name: 'Fonts | Debian | Accept Microsoft Core Fonts EULA.'
become: yes
debconf:
name: 'ttf-mscorefonts-installer'
question: 'msttcorefonts/accepted-mscorefonts-eula'
value: 'true'
vtype: 'select'
when: 'ansible_os_family == "Debian"'
- name: 'Fonts | Debian | Install Microsoft Core Fonts.'
become: yes
apt:
name: 'ttf-mscorefonts-installer'
state: 'present'
register: 'fonts_microsoft_installed'
notify: 'rebuild fonts cache'
when: 'ansible_os_family == "Debian"'
- name: 'Fonts | RedHat | Install Microsoft Core Fonts prerequisites.'
become: yes
yum:
name: '{{ item }}'
state: 'present'
with_items:
- 'curl'
- 'cabextract'
- 'xorg-x11-font-utils'
- 'fontconfig'
when: 'ansible_os_family == "RedHat"'
- name: 'Fonts | RedHat | Install Microsoft Core Fonts.'
become: yes
yum:
name: 'https://raw.githubusercontent.com/therevoman/mscorefonts2-code/master/RPMS/noarch/msttcore-fonts-installer-2.6-1.noarch.rpm'
state: 'present'
validate_certs: no
notify: 'rebuild fonts cache'
when: 'ansible_os_family == "RedHat"'

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
# Verify the installed fonts.
docker exec --tty ${container_id} env TERM=xterm fc-list | grep true | sed -e "s|^.*/||" -e "s/:style=\(\<.*\>\).*$/ - \1/" -e "s/,.*$//" | sort

View File

@@ -0,0 +1,18 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
- hosts: 'localhost'
vars:
fonts_shared:
- type: 'truetype'
src: '{{ role_path }}/tests/fonts/Fabulous.ttf'
dest: 'dafont/Fabulous.ttf'
fonts_user:
- name: 'root'
type: 'opentype'
src: '{{ role_path }}/tests/fonts/Aulyars.otf'
dest: 'dafont/Aulyars.otf'
roles:
- { role: 'role_under_test' }

View File

@@ -0,0 +1,8 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
fonts_repositories:
- 'deb http://ftp.debian.org/debian/ stable main non-free contrib'
- 'deb-src http://ftp.debian.org/debian/ stable main non-free contrib'

View File

@@ -0,0 +1,5 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---

View File

@@ -0,0 +1,10 @@
# Copyright (c) Ontic. (http://www.ontic.com.au). All rights reserved.
# See the COPYING file bundled with this package for license details.
---
fonts_repositories:
- 'deb http://archive.ubuntu.com/ubuntu {{ ansible_distribution_release }} multiverse'
- 'deb-src http://archive.ubuntu.com/ubuntu {{ ansible_distribution_release }} multiverse'
- 'deb http://archive.ubuntu.com/ubuntu {{ ansible_distribution_release }}-updates multiverse'
- 'deb-src http://archive.ubuntu.com/ubuntu {{ ansible_distribution_release }}-updates multiverse'