![Build Status](https://camo.githubusercontent.com/b96d1fe581b840939a70cd398b8057786d3129421eb360cef480c14ca69effc9/68747470733a2f2f7472617669732d63692e636f6d2f74726f6d62696b2f74726f6d62696b2e6a656b796c6c2e7376673f6272616e63683d6d6173746572)
ansible
role to manage jekyll
sites. This role does:
- checkout or update repositories
- install required gems using
bundler
- rebuild sites
Variable |
Description |
Default |
jekyll_user |
User name of jekyll site owner |
"" |
jekyll_repositories |
See below |
[] |
jekyll_extra_packages |
List of extra packages to install |
[] |
This is a list of dict. Each element of the list describes a site.
Key |
Description |
Mandatory? |
name |
Name of the site |
No |
module |
ansible module name to checkout the site (currently, only git is supported) |
Yes |
config |
a dict, passed to the ansible module |
Yes |
bundler |
a dict of bundler module arguments |
No |
state |
Either present or absent , default is present |
No |
In addition, config
key must have the following keys:
Key |
Description |
dest |
The path to the repository |
jekyll_repositories:
- name: demo
module: git
config:
repo: https://github.com/trombik/startbootstrap-coming-soon.git
dest: /home/vagrant/demo
version: "{{ os_branch[ansible_os_family] }}"
bundler:
deployment_mode: yes
user_install: yes
---
- hosts: localhost
roles:
- role: trombik.git
- role: trombik.language_ruby
- role: trombik.bundler
- role: trombik.redhat_repo
when: ansible_os_family == 'RedHat'
- role: ansible-role-jekyll
pre_tasks:
- name: Dump all hostvars
debug:
var: hostvars[inventory_hostname]
post_tasks:
- name: List all services (systemd)
# workaround ansible-lint: [303] service used in place of service module
shell: "echo; systemctl list-units --type service"
changed_when: false
when:
# in docker, init is not systemd
- ansible_virtualization_type != 'docker'
- ansible_os_family == 'RedHat' or ansible_os_family == 'Debian'
- name: list all services (FreeBSD service)
# workaround ansible-lint: [303] service used in place of service module
shell: "echo; service -l"
changed_when: false
when:
- ansible_os_family == 'FreeBSD'
vars:
os_language_ruby_package:
FreeBSD: "{{ __language_ruby_package }}"
# XXX ruby26 for OpenBSD 6.5 does not have bundler
OpenBSD: "{% if ansible_distribution_version is version_compare('6.6', '>=') %}ruby%2.6{% else %}ruby%2.5{% endif %}"
Debian: "{{ __language_ruby_package }}"
RedHat: "{{ __language_ruby_package }}"
language_ruby_package: "{{ os_language_ruby_package[ansible_os_family] }}"
os_bundler_package:
FreeBSD: "{{ __bundler_package }}"
OpenBSD: "ruby{{ language_ruby_version.short }}-bundler"
Debian: "{{ __bundler_package }}"
RedHat: "{{ __bundler_package }}"
bundler_package: "{{ os_bundler_package[ansible_os_family] }}"
os_branch:
FreeBSD: demo
OpenBSD: demo_bundler_1_2
Debian: demo_bundler_1_2
RedHat: demo_bundler_1_2
os_jekyll_extra_packages:
FreeBSD: []
OpenBSD: []
Debian:
- ruby-dev
RedHat:
- gcc-c++
- ruby-devel
jekyll_extra_packages: "{{ os_jekyll_extra_packages[ansible_os_family] }}"
jekyll_user: vagrant
project_jekyll_bundler_bin:
OpenBSD: "bundle{{ language_ruby_version.short }}"
Debian: "bundle"
FreeBSD: "bundle"
RedHat: "bundle"
jekyll_repositories:
- name: demo
module: git
config:
repo: https://github.com/trombik/startbootstrap-coming-soon.git
dest: /home/vagrant/demo
version: "{{ os_branch[ansible_os_family] }}"
bundler:
deployment_mode: no
user_install: yes
extra_args: ""
executable: "{{ project_jekyll_bundler_bin[ansible_os_family] }}"
- name: removeme
config:
dest: /home/vagrant/removeme
state: absent
redhat_repo_extra_packages:
- epel-release
redhat_repo:
epel:
mirrorlist: "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-{{ ansible_distribution_major_version }}&arch={{ ansible_architecture }}"
gpgcheck: yes
enabled: yes
Copyright (c) 2020 Tomoyuki Sakurai <[email protected]>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Tomoyuki Sakurai [email protected]