Browse Source

init setup

pull/2/head
Karan Sharma 4 months ago
parent
commit
f18497c5dd
  1. 3
      .gitignore
  2. 9
      README.md
  3. 14
      TODO.md
  4. 0
      floyd/ansible/Makefile
  5. 36
      floyd/ansible/playbook.yml
  6. 23
      floyd/ansible/roles/gantsign.antigen/.editorconfig
  7. 25
      floyd/ansible/roles/gantsign.antigen/.gitattributes
  8. 297
      floyd/ansible/roles/gantsign.antigen/.gitignore
  9. 1
      floyd/ansible/roles/gantsign.antigen/.moleculew/ansible_version
  10. 1
      floyd/ansible/roles/gantsign.antigen/.moleculew/docker_lib_version
  11. 1
      floyd/ansible/roles/gantsign.antigen/.moleculew/molecule_version
  12. 1
      floyd/ansible/roles/gantsign.antigen/.moleculew/python_version
  13. 76
      floyd/ansible/roles/gantsign.antigen/.travis.yml
  14. 13
      floyd/ansible/roles/gantsign.antigen/.yamllint
  15. 21
      floyd/ansible/roles/gantsign.antigen/LICENSE
  16. 198
      floyd/ansible/roles/gantsign.antigen/README.md
  17. 15
      floyd/ansible/roles/gantsign.antigen/defaults/main.yml
  18. 4
      floyd/ansible/roles/gantsign.antigen/handlers/main.yml
  19. 2
      floyd/ansible/roles/gantsign.antigen/meta/.galaxy_install_info
  20. 33
      floyd/ansible/roles/gantsign.antigen/meta/main.yml
  21. 14
      floyd/ansible/roles/gantsign.antigen/molecule/centos/Dockerfile.j2
  22. 26
      floyd/ansible/roles/gantsign.antigen/molecule/centos/INSTALL.rst
  23. 29
      floyd/ansible/roles/gantsign.antigen/molecule/centos/molecule.yml
  24. 14
      floyd/ansible/roles/gantsign.antigen/molecule/debian_max/Dockerfile.j2
  25. 26
      floyd/ansible/roles/gantsign.antigen/molecule/debian_max/INSTALL.rst
  26. 29
      floyd/ansible/roles/gantsign.antigen/molecule/debian_max/molecule.yml
  27. 14
      floyd/ansible/roles/gantsign.antigen/molecule/debian_min/Dockerfile.j2
  28. 26
      floyd/ansible/roles/gantsign.antigen/molecule/debian_min/INSTALL.rst
  29. 29
      floyd/ansible/roles/gantsign.antigen/molecule/debian_min/molecule.yml
  30. 14
      floyd/ansible/roles/gantsign.antigen/molecule/default/Dockerfile.j2
  31. 26
      floyd/ansible/roles/gantsign.antigen/molecule/default/INSTALL.rst
  32. 26
      floyd/ansible/roles/gantsign.antigen/molecule/default/molecule.yml
  33. 68
      floyd/ansible/roles/gantsign.antigen/molecule/default/playbook.yml
  34. 16
      floyd/ansible/roles/gantsign.antigen/molecule/default/tests/console-setup.sh
  35. 272
      floyd/ansible/roles/gantsign.antigen/molecule/default/tests/test_role.py
  36. 14
      floyd/ansible/roles/gantsign.antigen/molecule/fedora/Dockerfile.j2
  37. 26
      floyd/ansible/roles/gantsign.antigen/molecule/fedora/INSTALL.rst
  38. 29
      floyd/ansible/roles/gantsign.antigen/molecule/fedora/molecule.yml
  39. 14
      floyd/ansible/roles/gantsign.antigen/molecule/opensuse/Dockerfile.j2
  40. 26
      floyd/ansible/roles/gantsign.antigen/molecule/opensuse/INSTALL.rst
  41. 29
      floyd/ansible/roles/gantsign.antigen/molecule/opensuse/molecule.yml
  42. 14
      floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_max/Dockerfile.j2
  43. 26
      floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_max/INSTALL.rst
  44. 29
      floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_max/molecule.yml
  45. 14
      floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_min/Dockerfile.j2
  46. 26
      floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_min/INSTALL.rst
  47. 29
      floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_min/molecule.yml
  48. 792
      floyd/ansible/roles/gantsign.antigen/moleculew
  49. 27
      floyd/ansible/roles/gantsign.antigen/tasks/configure-debian-console.yml
  50. 98
      floyd/ansible/roles/gantsign.antigen/tasks/configure.yml
  51. 26
      floyd/ansible/roles/gantsign.antigen/tasks/install-oh-my-zsh.yml
  52. 50
      floyd/ansible/roles/gantsign.antigen/tasks/install.yml
  53. 4
      floyd/ansible/roles/gantsign.antigen/tasks/main.yml
  54. 21
      floyd/ansible/roles/gantsign.antigen/templates/antigenrc.j2
  55. 33
      floyd/ansible/roles/gantsign.antigen/templates/bundle.zsh.j2
  56. 11
      floyd/ansible/roles/gantsign.antigen/templates/theme.zsh.j2
  57. 14
      floyd/ansible/roles/gantsign.antigen/templates/use.zsh.j2
  58. 10
      floyd/ansible/roles/gantsign.antigen/vars/main.yml
  59. 24
      floyd/ansible/roles/setup-caddy/tasks/main.yml
  60. 6
      floyd/ansible/roles/setup-caddy/templates/Caddyfile.j2
  61. 17
      floyd/ansible/roles/setup-caddy/templates/caddy-docker-compose.yml.j2
  62. 14
      floyd/ansible/roles/setup-gitea/tasks/main.yml
  63. 21
      floyd/ansible/roles/setup-gitea/templates/gitea-docker-compose.yml.j2
  64. 92
      floyd/terraform/.terraform.lock.hcl
  65. 40
      floyd/terraform/bookstack/container.tf
  66. 17
      floyd/terraform/bookstack/image.tf
  67. 28
      floyd/terraform/bookstack/mariadb.tf
  68. 5
      floyd/terraform/bookstack/network.tf
  69. 8
      floyd/terraform/bookstack/variables.tf
  70. 8
      floyd/terraform/bookstack/versions.tf
  71. 50
      floyd/terraform/caddy/conf/Caddyfile-internal.tpl
  72. 13
      floyd/terraform/caddy/conf/Caddyfile-public.tpl
  73. 83
      floyd/terraform/caddy/container.tf
  74. 13
      floyd/terraform/caddy/data.tf
  75. 8
      floyd/terraform/caddy/image.tf
  76. 11
      floyd/terraform/caddy/network.tf
  77. 7
      floyd/terraform/caddy/output.tf
  78. 9
      floyd/terraform/caddy/variables.tf
  79. 8
      floyd/terraform/caddy/versions.tf
  80. 139
      floyd/terraform/cloudflare/records.tf
  81. 36
      floyd/terraform/digitalocean-infra/main.tf
  82. 16
      floyd/terraform/env.sample
  83. 43
      floyd/terraform/firefly/container.tf
  84. 17
      floyd/terraform/firefly/image.tf
  85. 5
      floyd/terraform/firefly/network.tf
  86. 25
      floyd/terraform/firefly/postgres.tf
  87. 12
      floyd/terraform/firefly/variables.tf
  88. 8
      floyd/terraform/firefly/versions.tf
  89. 122
      floyd/terraform/gitea/conf/app.ini.tpl
  90. 36
      floyd/terraform/gitea/container.tf
  91. 9
      floyd/terraform/gitea/data.tf
  92. 8
      floyd/terraform/gitea/image.tf
  93. 5
      floyd/terraform/gitea/network.tf
  94. 9
      floyd/terraform/gitea/variables.tf
  95. 8
      floyd/terraform/gitea/versions.tf
  96. 105
      floyd/terraform/main.tf
  97. 51
      floyd/terraform/monitoring/cadviser.tf
  98. 32
      floyd/terraform/monitoring/conf/prometheus.yml
  99. 0
      floyd/terraform/monitoring/data.tf
  100. 31
      floyd/terraform/monitoring/grafana.tf

3
.gitignore

@ -10,4 +10,5 @@ inventory
*.backup
*.env
AdGuardHome.yaml
.ci-vault-pass
.ci-vault-pass
consul-keys.txt

9
README.md

@ -3,12 +3,3 @@
> Setup scripts for my home server setup named "Hydra"
## Overview
TODO.
## Services Hosted
- Pihole + Unbound
- Tailscale for networking
- Gitea
- Bookstack

14
TODO.md

@ -0,0 +1,14 @@
## Baby Steps
- [x] Setup Tailscale in Floyd/Gilmour.
- [x] Configure Nomad and Consul to bind on Tailscale Address.
- [ ] Deploy Caddy as a Nomad Job which
- [ ] binds to 80/443 on host
- [ ] mounts the cert directory
- [ ] template file (caddy.tpl)
- [ ] Configure `nomad.mrkaran.dev` and `consul.mrkaran.dev`.
## Hands on by deploying more workloads
- [ ] Deploy `shynet.mrkaran.dev`
- [ ] Deploy `grafana.mrkaran.dev`

0
floyd/ansible/Makefile

36
floyd/ansible/playbook.yml

@ -1,36 +0,0 @@
---
- hosts: all
roles:
- role: bootstrap-node
tags:
- bootstrap
- role: setup-docker
become: true
tags:
- docker
- role: setup-tailscale
become: yes
tags:
- tailscale
- role: gantsign.antigen
tags:
- zsh
users:
- username: "{{username}}"
antigen_libraries:
- name: oh-my-zsh
antigen_theme:
name: agnoster
antigen_bundles:
# Bundles from the default repo (robbyrussell's oh-my-zsh).
- name: git
- name: pip
- name: fzf
- name: command-not-found
# Syntax highlighting bundle.
- name: zsh-syntax-highlighting # `name` is required (any valid file name will do so long as it's unique for the bundles)
url: zsh-users/zsh-syntax-highlighting

23
floyd/ansible/roles/gantsign.antigen/.editorconfig

@ -1,23 +0,0 @@
# EditorConfig: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Defaults for all editor files
[*]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
# YAML is fussy about indenting and charset
[*.yml]
indent_style = space
indent_size = 2
continuation_indent_size = unset
charset = utf-8
# Markdown is fussy about indenting
[*.md]
indent_style = space
indent_size = 4

25
floyd/ansible/roles/gantsign.antigen/.gitattributes

@ -1,25 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
LICENSE text
.editorconfig text
.gitattributes text
.gitignore text
.yamllint text
*.cfg text
*.j2 text
*.md text
*.py text
*.yml text
# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf
# Denote all files that are truly binary and should not be modified.
*.gif binary
*.jpeg binary
*.jpg binary
*.png binary

297
floyd/ansible/roles/gantsign.antigen/.gitignore

@ -1,297 +0,0 @@
# Created by https://www.gitignore.io/api/windows,linux,osx,vim,emacs,intellij,eclipse,visualstudiocode,ansible
### Ansible ###
*.retry
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Annotation Processing
.apt_generated
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
### Linux ###
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### OSX ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/windows,linux,osx,vim,emacs,intellij,eclipse,visualstudiocode,ansible
####################
### Custom rules ###
####################
### Molecule ###
__pycache__
.cache
.molecule

1
floyd/ansible/roles/gantsign.antigen/.moleculew/ansible_version

@ -1 +0,0 @@
2.7.0

1
floyd/ansible/roles/gantsign.antigen/.moleculew/docker_lib_version

@ -1 +0,0 @@
3.5.0

1
floyd/ansible/roles/gantsign.antigen/.moleculew/molecule_version

@ -1 +0,0 @@
2.17.0

1
floyd/ansible/roles/gantsign.antigen/.moleculew/python_version

@ -1 +0,0 @@
2.7.15

76
floyd/ansible/roles/gantsign.antigen/.travis.yml

@ -1,76 +0,0 @@
---
language: python
python: '2.7'
env:
global:
- MOLECULEW_USE_SYSTEM=true
# Spin off separate builds for each of the following versions
# of Ansible and Linux.
matrix:
include:
- env:
- MOLECULEW_ANSIBLE=2.5.10
- MOLECULE_SCENARIO=centos
- env:
- MOLECULEW_ANSIBLE=2.5.10
- MOLECULE_SCENARIO=debian_max
- env:
- MOLECULEW_ANSIBLE=2.5.10
- MOLECULE_SCENARIO=debian_min
- env:
- MOLECULEW_ANSIBLE=2.5.10
- MOLECULE_SCENARIO=ubuntu_max
- env:
- MOLECULEW_ANSIBLE=2.5.10
- MOLECULE_SCENARIO=ubuntu_min
- env:
- MOLECULEW_ANSIBLE=2.5.10
- MOLECULE_SCENARIO=opensuse
- env:
- MOLECULEW_ANSIBLE=2.7.0
- MOLECULE_SCENARIO=centos
- env:
- MOLECULEW_ANSIBLE=2.7.0
- MOLECULE_SCENARIO=debian_max
- env:
- MOLECULEW_ANSIBLE=2.7.0
- MOLECULE_SCENARIO=debian_min
- env:
- MOLECULEW_ANSIBLE=2.7.0
- MOLECULE_SCENARIO=ubuntu_max
- env:
- MOLECULEW_ANSIBLE=2.7.0
- MOLECULE_SCENARIO=ubuntu_min
- env:
- MOLECULEW_ANSIBLE=2.7.0
- MOLECULE_SCENARIO=opensuse
# Require the standard build environment
sudo: required
# Require Ubuntu 14.04
dist: trusty
# Require Docker
services:
- docker
install:
# Install dependencies
- ./moleculew wrapper-install
# Display versions
- ./moleculew wrapper-versions
script:
- ./moleculew test --scenario-name=$MOLECULE_SCENARIO
branches:
only:
- master
- /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([\.\-].*)?$/
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

13
floyd/ansible/roles/gantsign.antigen/.yamllint

@ -1,13 +0,0 @@
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
# NOTE(retr0h): Templates no longer fail this lint rule.
# Uncomment if running old Molecule templates.
truthy: disable

21
floyd/ansible/roles/gantsign.antigen/LICENSE

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2018 GantSign Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

198
floyd/ansible/roles/gantsign.antigen/README.md

@ -1,198 +0,0 @@
Ansible Role: Antigen
=====================
[![Build Status](https://travis-ci.com/gantsign/ansible_role_antigen.svg?branch=master)](https://travis-ci.com/gantsign/ansible_role_antigen)
[![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-gantsign.antigen-blue.svg)](https://galaxy.ansible.com/gantsign/antigen)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/gantsign/ansible_role_antigen/master/LICENSE)
Role to install the [Antigen](http://antigen.sharats.me/) plugin manger for Zsh
and use it to configure Zsh.
This role has a companion role that enables you to conditionally install
particular Antigen bundles. You can find details of that role at
[gantsign.antigen_budles](https://galaxy.ansible.com/gantsign/antigen_bundles).
Requirements
------------
* Ansible >= 2.5
* Linux Distribution
* Debian Family
* Debian
* Jessie (8)
* Stretch (9)
* Ubuntu
* Trusty (14.04)
* Xenial (16.04)
* Bionic (18.04)
* RedHat Family
* CentOS
* 7
* Fedora
* 28
* SUSE Family
* openSUSE
* 15.0
* Note: other versions are likely to work but have not been tested.
Role Variables
--------------
The following variables will change the behavior of this role:
```yaml
# Antigen version number
antigen_version: '2.0.2'
# SHA256 sum for the redistributable package
antigen_redis_sha256sum: 'f47ec933b32c578abe8cb39b24e0ddd114ef5cc01b3c05bcb634859ead31493f'
# Should Oh-My-Zsh be installed with Antigen (doesn't call `antigen use`)
antigen_install_oh_my_zsh: yes
# Mirror location for Antigen download
antigen_redis_mirror: 'https://github.com/zsh-users/antigen/releases/download/v{{ antigen_version }}'
# Directory to store files downloaded for Antigen installation on the remote box
antigen_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"
# Antigen is installed per user so you need to specify the users to install it for
users:
- username: # The username of the user to install Antigen for
antigen_libraries:
- name: # The name of the library (e.g. oh-my-zsh or prezto) must be unique
url: # Optional. If you're using a custom library you must specify the Git URL
args: # Optional. Command line arguments to pass to Antigen
- '--exampleParam1'
- 'paramValue1' # example with value passed as a separate arg
- '--exampleParam2=paramValue2' # example with value passed in the same arg
env: # Optional. Environnement variables to set
EXAMPLE_ENV1: 'envValue1'
EXAMPLE_ENV2: '"${HOME}/.example"' # the single quotes are for YAML the double quotes are for the shell
# more libraries here
antigen_theme:
name: # The name of the library (e.g. one of the themes that come with Oh-My-Zsh)
url: # Optional. If the theme doesn't come with Oh-My-Zsh you must specify the Git URL
env: {} # Optional. Environnement variables to set
antigen_bundles:
- name: # The name of the Antigen bundle (e.g. one of the plugins that come with Oh-My-Zsh)
url: # Optional. If the it's not one of the Oh-My-Zsh plugins you must specify the URL (use owner/repo shorthand for GitHub)
location: # Optional. The directory in the repository containing the plugin
branch: # Optional. Git branch to checkout.
tag: # Optional. Git tag to checkout (takes preference over branch)
args: [] # Optional. Command line arguments to pass to Antigen
env: {} # Optional. Environnement variables to set
# more bundles here
# more users here
```
Example Playbooks
-----------------
The following achieves the same as the example in the Antigen
[README.mkd](https://github.com/zsh-users/antigen/blob/develop/README.mkd#usage).
```yaml
- hosts: servers
roles:
- role: gantsign.antigen
users:
- username: example
antigen_libraries:
- name: oh-my-zsh
antigen_theme:
name: robbyrussell
antigen_bundles:
# Bundles from the default repo (robbyrussell's oh-my-zsh).
- name: git
- name: heroku
- name: pip
- name: lein
- name: command-not-found
# Syntax highlighting bundle.
- name: zsh-syntax-highlighting # `name` is required (any valid file name will do so long as it's unique for the bundles)
url: zsh-users/zsh-syntax-highlighting
```
The following achieves the same as the example in the `gantsign.oh-my-zsh` role
[README.md](https://github.com/gantsign/ansible-role-oh-my-zsh/blob/master/README.md#example-playbook)
```yaml
- hosts: servers
roles:
- role: gantsign.antigen
users:
- username: example
antigen_libraries:
- name: oh-my-zsh
env:
DISABLE_AUTO_UPDATE: '"true"' # Optional (this was hard-coded in the .zshrc of the `gantsign.oh-my-zsh` role)
antigen_theme:
name: robbyrussell # This role has no default theme (unlike the `gantsign.oh-my-zsh` role)
antigen_bundles:
- name: git # This role has no default bundles/plugins (unlike the `gantsign.oh-my-zsh` role)
```
More Roles From GantSign
------------------------
You can find more roles from GantSign on
[Ansible Galaxy](https://galaxy.ansible.com/gantsign).
Development & Testing
---------------------
This project uses [Molecule](http://molecule.readthedocs.io/) to aid in the
development and testing; the role is unit tested using
[Testinfra](http://testinfra.readthedocs.io/) and
[pytest](http://docs.pytest.org/).
To develop or test you'll need to have installed the following:
* Linux (e.g. [Ubuntu](http://www.ubuntu.com/))
* [Docker](https://www.docker.com/)
* [Python](https://www.python.org/) (including python-pip)
* [Ansible](https://www.ansible.com/)
* [Molecule](http://molecule.readthedocs.io/)
Because the above can be tricky to install, this project includes
[Molecule Wrapper](https://github.com/gantsign/molecule-wrapper). Molecule
Wrapper is a shell script that installs Molecule and it's dependencies (apart
from Linux) and then executes Molecule with the command you pass it.
To test this role using Molecule Wrapper run the following command from the
project root:
```bash
./moleculew test
```
Note: some of the dependencies need `sudo` permission to install.
License
-------
MIT
Author Information
------------------
John Freeman
GantSign Ltd.
Company No. 06109112 (registered in England)

15
floyd/ansible/roles/gantsign.antigen/defaults/main.yml

@ -1,15 +0,0 @@
---
# Antigen version number
antigen_version: '2.0.2'
# SHA256 sum for the redistributable package
antigen_redis_sha256sum: 'f47ec933b32c578abe8cb39b24e0ddd114ef5cc01b3c05bcb634859ead31493f'
# Should Oh-My-Zsh be installed with Antigen (doesn't call `antigen use`)
antigen_install_oh_my_zsh: yes
# Mirror location for Antigen download
antigen_redis_mirror: 'https://github.com/zsh-users/antigen/releases/download/v{{ antigen_version }}'
# Directory to store files downloaded for Antigen installation on the remote box
antigen_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"

4
floyd/ansible/roles/gantsign.antigen/handlers/main.yml

@ -1,4 +0,0 @@
---
- name: dpkg-reconfigure console-setup
become: yes
command: /usr/sbin/dpkg-reconfigure -f noninteractive console-setup

2
floyd/ansible/roles/gantsign.antigen/meta/.galaxy_install_info

@ -1,2 +0,0 @@
install_date: Fri Jul 31 19:26:13 2020
version: 1.3.2

33
floyd/ansible/roles/gantsign.antigen/meta/main.yml

@ -1,33 +0,0 @@
---
galaxy_info:
author: John Freeman
role_name: antigen
description: Role for installing the Antigen plugin manger for Zsh and using it to configure Zsh.
company: GantSign Ltd.
license: MIT
min_ansible_version: 2.5
platforms:
- name: EL
versions:
- 7
- name: Fedora
versions:
- 28
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- name: Debian
versions:
- jessie
- stretch
- name: opensuse
versions:
- '15.0'
galaxy_tags:
- antigen
- ohmyzsh
- zsh
- shell
dependencies: []

14
floyd/ansible/roles/gantsign.antigen/molecule/centos/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/centos/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

29
floyd/ansible/roles/gantsign.antigen/molecule/centos/molecule.yml

@ -1,29 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_centos
image: centos:7
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: centos
verifier:
name: testinfra
directory: ../default/tests/
lint:
name: flake8

14
floyd/ansible/roles/gantsign.antigen/molecule/debian_max/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/debian_max/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

29
floyd/ansible/roles/gantsign.antigen/molecule/debian_max/molecule.yml

@ -1,29 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_debian_max
image: debian:9
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: debian_max
verifier:
name: testinfra
directory: ../default/tests/
lint:
name: flake8

14
floyd/ansible/roles/gantsign.antigen/molecule/debian_min/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/debian_min/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

29
floyd/ansible/roles/gantsign.antigen/molecule/debian_min/molecule.yml

@ -1,29 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_debian_min
image: debian:8
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: debian_min
verifier:
name: testinfra
directory: ../default/tests/
lint:
name: flake8

14
floyd/ansible/roles/gantsign.antigen/molecule/default/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/default/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

26
floyd/ansible/roles/gantsign.antigen/molecule/default/molecule.yml

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_default
image: ubuntu:18.04
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8

68
floyd/ansible/roles/gantsign.antigen/molecule/default/playbook.yml

@ -1,68 +0,0 @@
---
- name: Converge
hosts: all
pre_tasks:
- name: create test users
become: yes
user:
name: '{{ item }}'
home: '/home/{{ item }}'
createhome: yes
with_items:
- test_usr1
- test_usr2
- test_usr3
- name: install console-setup file
become: yes
copy:
src: tests/console-setup.sh
dest: /etc/default/console-setup
force: no
owner: root
group: root
mode: 'u=rwx,go=r'
roles:
- role: ansible_role_antigen
users:
- username: test_usr1
antigen_libraries:
- name: oh-my-zsh
antigen_theme:
name: robbyrussell
antigen_bundles:
- name: git
- name: ant
url: robbyrussell/oh-my-zsh
location: plugins/ant
- username: test_usr2
antigen_libraries:
- name: prezto
args:
- '--verbose'
env:
ENV_TEST1: 'testValue1'
antigen_theme:
name: testTheme1
url: https://example.com/testTeme1.git
antigen_bundles:
- name: mvn
args:
- '--no-local-clone'
env:
ENV_TEST2: 'testValue2'
- name: gradle
url: https://example.com/gradle.git
branch: master
tag: '1.0'
args:
- '--no-local-clone'
env:
ENV_TEST3: 'testValue3'
- name: sdkman
url: '$HOME/.sdkman-zsh'
- name: escape
url: 't\e"s"ti\ng`pwd`test2$(pwd)'
- username: test_usr3

16
floyd/ansible/roles/gantsign.antigen/molecule/default/tests/console-setup.sh

@ -1,16 +0,0 @@
# CONFIGURATION FILE FOR SETUPCON
# Consult the console-setup(5) manual page.
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="ISO-8859-1"
CODESET="Lat15"
FONTFACE="VGA"
FONTSIZE="8x16"
VIDEOMODE=
# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'

272
floyd/ansible/roles/gantsign.antigen/molecule/default/tests/test_role.py

@ -1,272 +0,0 @@
import pytest
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize('username', [
'test_usr1',
'test_usr2',
])
def test_antigen_install(host, username):
antigen = host.file('/home/' + username + '/.antigen')
assert antigen.exists
assert antigen.is_directory
assert antigen.user == username
assert antigen.group in [username, 'users']
@pytest.mark.parametrize('username', [
'test_usr1',
'test_usr2',
])
def test_antigen_install_file(host, username):
antigen = host.file('/home/' + username + '/.antigen/antigen.zsh')
assert antigen.exists
assert antigen.is_file
assert antigen.user == username
@pytest.mark.parametrize('username', [
'test_usr1',
'test_usr2',
])
def test_oh_my_zsh_install(host, username):
antigen = host.file('/home/' + username +
'/.antigen/bundles/robbyrussell/oh-my-zsh')
assert antigen.exists
assert antigen.is_directory
assert antigen.user == username
assert antigen.group in [username, 'users']
@pytest.mark.parametrize('username', [
'test_usr1',
'test_usr2',
])
def test_zsh_config(host, username):
zshrc = host.file('/home/' + username + '/.zshrc')
assert zshrc.exists
assert zshrc.is_file
assert zshrc.user == username
assert zshrc.group in [username, 'users']
assert zshrc.contains('source ~/.antigenrc')
@pytest.mark.parametrize('username', [
'test_usr1',
'test_usr2',
])
def test_antigen_config(host, username):
antigenrc = host.file('/home/' + username + '/.antigenrc')
assert antigenrc.exists
assert antigenrc.is_file
assert antigenrc.user == username
assert antigenrc.group in [username, 'users']
assert antigenrc.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
source $HOME/.antigen/antigen.zsh
for i in ~/.antigen-etc/use.d/*.zsh; do
if [ -r $i ]; then
source $i
fi
done
unset i
for i in ~/.antigen-etc/bundle.d/*.zsh; do
if [ -r $i ]; then
source $i
fi
done
unset i
source ~/.antigen-etc/theme.zsh
antigen apply
'''.strip()
def test_simple_theme_config(host):
theme = host.file('/home/test_usr1/.antigen-etc/theme.zsh')
assert theme.exists
assert theme.is_file
assert theme.user == 'test_usr1'
assert theme.group in ['test_usr1', 'users']
assert theme.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
antigen theme robbyrussell
'''.strip()
def test_sinple_library_config(host):
library = host.file('/home/test_usr1/.antigen-etc/use.d/oh-my-zsh.zsh')
assert library.exists
assert library.is_file
assert library.user == 'test_usr1'
assert library.group in ['test_usr1', 'users']
assert library.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
antigen use oh-my-zsh
'''.strip()
def test_bundle_with_url_config(host):
bundle = host.file('/home/test_usr1/.antigen-etc/bundle.d/git.zsh')
assert bundle.exists
assert bundle.is_file
assert bundle.user == 'test_usr1'
assert bundle.group in ['test_usr1', 'users']
assert bundle.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
antigen bundle \
--url=git
'''.strip()
def test_bundle_with_location_config(host):
bundle = host.file('/home/test_usr1/.antigen-etc/bundle.d/ant.zsh')
assert bundle.exists
assert bundle.is_file
assert bundle.user == 'test_usr1'
assert bundle.group in ['test_usr1', 'users']
assert bundle.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
antigen bundle \
"--url=robbyrussell/oh-my-zsh" \
--loc=plugins/ant
'''.strip()
def test_theme_with_url_config(host):
theme = host.file('/home/test_usr2/.antigen-etc/theme.zsh')
assert theme.exists
assert theme.is_file
assert theme.user == 'test_usr2'
assert theme.group in ['test_usr2', 'users']
assert theme.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
antigen theme https://example.com/testTeme1.git
'''.strip()
def test_advanced_library_config(host):
library = host.file('/home/test_usr2/.antigen-etc/use.d/prezto.zsh')
assert library.exists
assert library.is_file
assert library.user == 'test_usr2'
assert library.group in ['test_usr2', 'users']
assert library.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
ENV_TEST1=testValue1
antigen use prezto \
--verbose
'''.strip()
def test_bundle_with_args_and_env_config(host):
bundle = host.file('/home/test_usr2/.antigen-etc/bundle.d/mvn.zsh')
assert bundle.exists
assert bundle.is_file
assert bundle.user == 'test_usr2'
assert bundle.group in ['test_usr2', 'users']
assert bundle.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
ENV_TEST2=testValue2
antigen bundle \
--url=mvn \
--no-local-clone
'''.strip()
def test_bundle_with_tag_config(host):
bundle = host.file('/home/test_usr2/.antigen-etc/bundle.d/gradle.zsh')
assert bundle.exists
assert bundle.is_file
assert bundle.user == 'test_usr2'
assert bundle.group in ['test_usr2', 'users']
assert bundle.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
ENV_TEST3=testValue3
antigen bundle \
"--url=https://example.com/gradle.git" \
--branch=1.0 \
--no-local-clone
'''.strip()
def test_bundle_with_env_in_value(host):
bundle = host.file('/home/test_usr2/.antigen-etc/bundle.d/sdkman.zsh')
assert bundle.exists
assert bundle.is_file
assert bundle.user == 'test_usr2'
assert bundle.group in ['test_usr2', 'users']
assert bundle.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
antigen bundle \
"--url=$HOME/.sdkman-zsh"
'''.strip()
def test_bundle_url_escaping(host):
bundle = host.file('/home/test_usr2/.antigen-etc/bundle.d/escape.zsh')
assert bundle.exists
assert bundle.is_file
assert bundle.user == 'test_usr2'
assert bundle.group in ['test_usr2', 'users']
assert bundle.content_string.strip() == r'''
#
# Ansible managed: Do NOT edit this file manually!
#
antigen bundle \
"--url=t\\e\"s\"ti\\ng\`pwd\`test2\$(pwd)"
'''.strip()
def test_console_setup(host):
# console-setup is Debian family specific
if host.file('/etc/debian_version').exists:
setup = host.file('/etc/default/console-setup')
assert setup.exists
assert setup.is_file
assert setup.user == 'root'
assert setup.group == 'root'
assert setup.contains('CHARMAP="UTF-8"')

14
floyd/ansible/roles/gantsign.antigen/molecule/fedora/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/fedora/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

29
floyd/ansible/roles/gantsign.antigen/molecule/fedora/molecule.yml

@ -1,29 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_fedora
image: fedora:28
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: fedora
verifier:
name: testinfra
directory: ../default/tests/
lint:
name: flake8

14
floyd/ansible/roles/gantsign.antigen/molecule/opensuse/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/opensuse/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

29
floyd/ansible/roles/gantsign.antigen/molecule/opensuse/molecule.yml

@ -1,29 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_opensuse
image: opensuse/leap:15.0
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: opensuse
verifier:
name: testinfra
directory: ../default/tests/
lint:
name: flake8

14
floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_max/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_max/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

29
floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_max/molecule.yml

@ -1,29 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_ubuntu_max
image: ubuntu:18.04
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: ubuntu_max
verifier:
name: testinfra
directory: ../default/tests/
lint:
name: flake8

14
floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_min/Dockerfile.j2

@ -1,14 +0,0 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

26
floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_min/INSTALL.rst

@ -1,26 +0,0 @@
*******
Docker driver installation guide
*******
Requirements
============
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
* Docker Engine
* docker-py
* docker
Install
=======
Ansible < 2.6
.. code-block:: bash
$ sudo pip install docker-py
Ansible >= 2.6
.. code-block:: bash
$ sudo pip install docker

29
floyd/ansible/roles/gantsign.antigen/molecule/ubuntu_min/molecule.yml

@ -1,29 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: ansible_role_antigen_ubuntu_min
image: ubuntu:14.04
provisioner:
name: ansible
playbooks:
converge: ../default/playbook.yml
lint:
name: ansible-lint
scenario:
name: ubuntu_min
verifier:
name: testinfra
directory: ../default/tests/
lint:
name: flake8

792
floyd/ansible/roles/gantsign.antigen/moleculew

@ -1,792 +0,0 @@
#!/usr/bin/env bash
# MIT License
#
# Copyright (c) 2018 GantSign Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Molecule Wrapper the wrapper script for Molecule
# https://github.com/gantsign/molecule-wrapper
set -e
WRAPPER_VERSION=0.9.9
VERSION_DIR='.moleculew'
PYTHON_VERSION_FILE="$VERSION_DIR/python_version"
ANSIBLE_VERSION_FILE="$VERSION_DIR/ansible_version"
DOCKER_LIB_VERSION_FILE="$VERSION_DIR/docker_lib_version"
MOLECULE_VERSION_FILE="$VERSION_DIR/molecule_version"
BUILD_DEPENDENCIES_INSTALLLED=false
PYENV_INSTALLED=false
ANSIBLE_VERSION=''
DOCKER_LIB_VERSION=''
MOLECULE_VERSION=''
PYTHON_VERSION=''
USE_SYSTEM_DEPENDENCIES=false
PRE_ARGS=()
MOLECULE_CMD=''
POST_ARGS=()
export PATH="$HOME/.pyenv/bin:$HOME/.local/bin:$PATH"
hr() {
for ((i = 1; i <= 80; i++)); do
printf '*'
done
echo ''
}
banner() {
hr
echo "$1"
hr
}
run_as_root() {
if [[ $EUID -eq 0 ]]; then
"[email protected]"
elif [ -x "$(command -v sudo)" ]; then
sudo "[email protected]"
else
echo "Error: sudo is not installed" >&2
exit 1
fi
}
build_dependencies_present() {
if [[ $BUILD_DEPENDENCIES_INSTALLLED == true ]]; then
return
fi
if [[ $USE_SYSTEM_DEPENDENCIES == true ]]; then
return
fi
# https://github.com/pyenv/pyenv/wiki/common-build-problems
if [[ -x "$(command -v apt-get)" ]]; then
banner 'Installing build dependencies'
run_as_root apt-get update
run_as_root apt-get install --assume-yes \
make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev \
git jq
echo ''
elif [[ -x "$(command -v dnf)" ]]; then
banner 'Installing build dependencies'
run_as_root dnf install \
zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel \
openssl-devel xz xz-devel libffi-devel \
git which curl jq
echo ''
elif [[ -x "$(command -v yum)" ]]; then
banner 'Installing build dependencies'
run_as_root yum install \
zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel \
openssl-devel xz xz-devel libffi-devel \
git which curl jq
echo ''
elif [[ -x "$(command -v zypper)" ]]; then
banner 'Installing build dependencies'
run_as_root zypper install \
zlib-devel bzip2 libbz2-devel readline-devel sqlite3 sqlite3-devel \
libopenssl-devel xz xz-devel \
git which curl jq
echo ''
fi
BUILD_DEPENDENCIES_INSTALLLED=true
}
pyenv_present() {
if [[ $PYENV_INSTALLED == true ]]; then
return
fi
if [[ $USE_SYSTEM_DEPENDENCIES == true ]]; then
return
fi
if [[ -x "$(command -v pyenv)" ]]; then
PYENV_INSTALLED=true
return
fi
build_dependencies_present
banner "Installing pyenv for user $USER"
bash <(curl --location https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)
echo ''
PYENV_INSTALLED=true
}
query_latest_python_version2() {
pyenv_present
PYTHON_VERSION="$(~/.pyenv/plugins/python-build/bin/python-build --definitions | grep --color=never '^2\.' | grep --invert-match '\-dev$' | tail -1)"
}
query_latest_python_version3() {
pyenv_present
PYTHON_VERSION="$(~/.pyenv/plugins/python-build/bin/python-build --definitions | grep --color=never '^3\.' | grep --invert-match '\-dev$' | tail -1)"
}