Skip to content
Permalink
Browse files

Redesign of the 'debops.golang' Ansible role

  • Loading branch information...
drybjed committed Feb 12, 2019
1 parent f44ef12 commit 1f3f4898de4a272e755a74a907a873640d67d28b
@@ -75,6 +75,14 @@ General

- Support Debian Buster in :ref:`apt_preferences__list`.

:ref:`debops.golang` role
'''''''''''''''''''''''''

- The role has been redesigned from the ground up, and can be used to install
Go applications either from APT packages, build them from source, or download
precompiled binaries from remote resources. See the role documentation for
more details.

:ref:`debops.resolvconf` role
'''''''''''''''''''''''''''''

@@ -10,6 +10,12 @@

roles:

- role: debops.keyring
tags: [ 'role::keyring', 'skip::keyring', 'role::golang' ]
keyring__dependent_gpg_user: '{{ golang__keyring__dependent_gpg_user }}'
keyring__dependent_gpg_keys:
- '{{ golang__keyring__dependent_gpg_keys }}'

- role: debops.apt_preferences
tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
apt_preferences__dependent_list:
@@ -1,8 +1,8 @@
debops.golang - Manage Go environment using Ansible
debops.golang - Manage Go environment and applications using Ansible

Copyright (C) 2015 Nick Janetakis <nickjanetakis@gmail.com>
Copyright (C) 2016 Maciej Delmanowski <drybjed@gmail.com>
Copyright (C) 2015-2016 DebOps https://debops.org/
Copyright (C) 2015 Nick Janetakis <nickjanetakis@gmail.com>
Copyright (C) 2016-2019 Maciej Delmanowski <drybjed@gmail.com>
Copyright (C) 2015-2019 DebOps https://debops.org/

This Ansible role is part of DebOps.

This file was deleted.

@@ -0,0 +1,47 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker

# Configuration for other Ansible roles
# =====================================

# .. include:: ../../../../../includes/global.rst


# .. envvar:: golang__keyring__dependent_gpg_user [[[
#
# Configuration for the :ref:`debops.keyring` Ansible role (all GPG keys should
# be imported into a specific UNIX account keyring).
golang__keyring__dependent_gpg_user: '{{ golang__user }}'

# ]]]
# .. envvar:: golang__keyring__dependent_gpg_keys [[[
#
# Configuration for the :ref:`debops.keyring` Ansible role (list of GPG keys to
# import to the keyring).
golang__keyring__dependent_gpg_keys:

- user: '{{ golang__user }}'
group: '{{ golang__group }}'
home: '{{ golang__home }}'
state: '{{ "present"
if (golang__combined_packages | parse_kv_items
| selectattr("gpg", "defined") | selectattr("state", "equalto", "present")
| map(attribute="gpg") | list)
else "absent" }}'

- '{{ golang__combined_packages | parse_kv_items
| selectattr("gpg", "defined") | selectattr("state", "equalto", "present")
| map(attribute="gpg") | list }}'

# ]]]
# .. envvar:: golang__apt_preferences__dependent_list [[[
#
# Configuration for the :ref:`debops.apt_preferences` role.
golang__apt_preferences__dependent_list:

- packages: [ 'golang', 'golang-*', 'dh-golang' ]
backports: [ 'wheezy', 'jessie', 'stretch', 'precise', 'trusty' ]
reason: 'Closer feature parity with upstream'
by_role: 'debops.golang'

# ]]]
@@ -0,0 +1,105 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker

# UNIX and build environment
# ==========================

# .. contents::
# :local:
#
# .. include:: ../../../../../includes/global.rst


# Go UNIX environment [[[
# -----------------------

# .. envvar:: golang__user [[[
#
# Name of an unprivileged UNIX system account which will host the Go build
# environment.
golang__user: '_golang'

# ]]]
# .. envvar:: golang__group [[[
#
# Name of the primary UNIX group of the Go UNIX account.
golang__group: '_golang'

# ]]]
# .. envvar:: golang__home [[[
#
# Absolute path to the home directory of the Go UNIX account.
golang__home: '{{ (ansible_local.root.home
if (ansible_local|d() and ansible_local.root|d() and
ansible_local.root.home|d())
else "/var/local") + "/" + golang__user }}'

# ]]]
# .. envvar:: golang__shell [[[
#
# The default shell used by the Go UNIX account.
golang__shell: '/usr/sbin/nologin'

# ]]]
# .. envvar:: golang__comment [[[
#
# The value of the GECOS field of the Go UNIX account.
golang__comment: 'Go build environment'
# ]]]
# ]]]
# Go source builds and binaries [[[
# ---------------------------------

# .. envvar:: golang__apt_dev_packages [[[
#
# List of base APT packages installed when a source build is required.
golang__apt_dev_packages: [ 'golang-go', 'make' ]

# ]]]
# .. envvar:: golang__env_gopath [[[
#
# The value of the ``$GOPATH`` environment variable, which defines a list of
# directories outside of the current Go environment that contain Go sources and
# packages, separated by colons.
golang__env_gopath: '{{ golang__home + "/go" }}:/usr/share/gocode'

# ]]]
# .. envvar:: golang__env_gocache [[[
#
# The value of the ``$GOCACHE`` environment variable used during Go builds.
# This variable specifies the directory which holds the Go build cache.
golang__env_gocache: '{{ golang__home + "/.cache/go" }}'

# ]]]
# .. envvar:: golang__env_path [[[
#
# The value of the ``$PATH`` environment variable used during Go builds. This
# value allows access to the binaries on the Go UNIX account installed by the
# :command:`go install` command, which are usually not needed in the normal
# host environment.
golang__env_path: '{{ golang__home + "/go/bin:" + ansible_env.PATH }}'

# ]]]
# .. envvar:: golang__gosrc [[[
#
# Absolute path to the directory where Go application sources will be cloned
# using the :command:`git` command, as the unprivileged Go UNIX account.
golang__gosrc: '{{ golang__home + "/go/src" }}'

# ]]]
# .. envvar:: golang__git_depth [[[
#
# The default depth used to create a "shallow clone" of the :command:`git`
# repositories if not specified otherwise, minimum 1. If not specified, entire
# :command:`git` repository is cloned.
golang__git_depth: '0'

# ]]]
# .. envvar:: golang__bin_database [[[
#
# Absolute path to a file which tracks what Go binaries have been installed by
# the :ref:`debops.golang` role and is used by the Ansible local fact to
# resolve the paths to preferred binaries.
golang__bin_database: '/usr/local/etc/golang-binaries'
# ]]]
# ]]]
@@ -0,0 +1,67 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker

# .. _golang__ref_packages:

# Go packages
# ===========

# The ``golang__*_packages`` default variables define what Go packages should
# be installed by the :ref:`debops.golang` role.

# .. Check the role documentation for examples and configuration syntax.

# .. contents::
# :local:
#
# .. include:: ../../../../../includes/global.rst

# .. include:: ../../includes/defaults-packages.rst


# .. envvar:: golang__default_packages [[[
#
# List of default Go packages to install, defined by the role.
golang__default_packages:

# The Go environment will be installed if no dependent Go packages are defined
- name: 'golang-go'
apt_packages: 'golang-go'
state: '{{ "ignore" if golang__dependent_packages|d() else "present" }}'

# ]]]
# .. envvar:: golang__packages [[[
#
# List of Go packages to install on all hosts in Ansible inventory.
golang__packages: []

# ]]]
# .. envvar:: golang__group_packages [[[
#
# List of Go packages to install on a group of hosts in Ansible inventory.
golang__group_packages: []

# ]]]
# .. envvar:: golang__host_packages [[[
#
# List of Go packages to install on specific hosts in Ansible inventory.
golang__host_packages: []

# ]]]
# .. envvar:: golang__dependent_packages [[[
#
# List of Go packages to install specified by other Ansible roles.
golang__dependent_packages: []

# ]]]
# .. envvar:: golang__combined_packages [[[
#
# List of Go packages which combines all other lists and is used in the role
# tasks.
golang__combined_packages: '{{ golang__default_packages
+ golang__dependent_packages
+ golang__packages
+ golang__group_packages
+ golang__host_packages }}'

# ]]]
@@ -1,24 +1,28 @@
---

dependencies: []
dependencies:

- role: debops.ansible_plugins

galaxy_info:

role_name: 'golang'
author: 'Nick Janetakis'
description: 'Install Go language (golang) support using Debian packages'
author: 'Nick Janetakis, Maciej Delmanowski'
description: 'Install Go language support and build Go applications from sources'
company: 'DebOps'
license: 'GPLv3'
min_ansible_version: '2.0.0'
min_ansible_version: '2.7.0'
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- bionic
- name: Debian
versions:
- wheezy
- jessie
- stretch
- buster
galaxy_tags:
- development
- programming

0 comments on commit 1f3f489

Please sign in to comment.
You can’t perform that action at this time.