Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
streampunk
ansible
Commits
6e34d2a3
Commit
6e34d2a3
authored
4 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Update README with reference to test.sh
parent
64f02bed
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+36
-64
36 additions, 64 deletions
README.md
with
36 additions
and
64 deletions
README.md
+
36
−
64
View file @
6e34d2a3
...
...
@@ -6,53 +6,6 @@ This playbook will install
machines, along with the necessary infrastructure (etcd, logging,
monitoring and alerting).
# Setup
Before running the playbook against test or production environments,
you'll need to ensure Ansible is set up properly.
## ansible.cfg
Use
*ansible-playbook -i hosts.ini*
to control the production
hosts. But first you're going to need a proper ansible.cfg file. There
are a few important settings that need to be present:
*
since some templates use facts from other hosts, if you ever want to
run the playbook on a subset of hosts you're going to need a fact
cache
*
preferably install Mitogen and set the
*strategy*
to
*mitogen_linear*
Something like the following should do (change the Mitogen path to
reflect your own installation):
```
[defaults]
nocows = 1
strategy_plugins = /usr/local/mitogen-0.2.9/ansible_mitogen/plugins/strategy
strategy = mitogen_linear
force_handlers = True
fact_caching = jsonfile
fact_caching_connection = .fact-cachs
[ssh_connection]
ssh_args = -C -o ControlMaster=auto -o ControlPersist=120s
control_path_dir = ~/.ansible/cp
control_path = %(directory)s/%%h-%%r
pipelining = True
```
## ANSIBLE\_VAULT\_PASSWORD\_FILE
Decrypt the ansible-vault passphrase from the secrets storage, and
write it into a file named
*.ansible_vault_pw*
in this same directory.
Then
```
shell
$
export
ANSIBLE_VAULT_PASSWORD_FILE
=
.ansible_vault_pw
```
# Configuration
There are some mandatory configuration variables that need to be set
...
...
@@ -100,31 +53,50 @@ in the *monitor* group (for redundancy).
# Testing
To test locally (with Vagrant and Virtualbox):
This repository contains a script to build dynamic, ephemeral test
environments using virtual machines, so that different combinations of
Ansible / autoradio / other packages can be tested before deploying
them to production.
```
shell
$
vagrant up
$
export
ANSIBLE_HOST_KEY_CHECKING
=
False
$
ansible-playbook
-i
hosts-vagrant.ini site.yml
$
test.sh my-test
```
This will start a 3-node autoradio cluster, with IPs
10.
236.82.10-12. The cluster will be using autoradio packages from the
default Debian repository.
## Testing with local autoradio builds
If the
*source_repository_path*
Ansible variable is defined to point
at the autoradio source repository, the playbook will install
locally-built autoradio binaries. This can be very useful to quickly
test local uncommitted changes:
The above command will generate an Ansible configuration in the
*my-test*
directory, it will start some VMs, and it will run Ansible
on them deploying the configuration from this repository.
The test environment can be customized by setting environment
variables when calling test.sh:
*
`DIST`
: select the Debian distribution to use (default "buster")
*
`LIBVIRT_USER`
,
`LIBVIRT_HOST`
: use libvirt-over-SSH, needs SSH
passwordless authentication to be set up.
*
`APT_PROXY`
: set to the
*host:port*
address of apt-cacher-ng. When
using this directive, ensure that the apt-cacher-ng configuration has
a permissive PassThroughPattern to allow access to https://
repositories.
*
`VM`
: select the VM manager to use, one of "vagrant" (default) or
"vmine" (used in CI setups).
*
`VERBOSE`
: set to a non-empty value to run ansible-playbook with
increased verbosity.
*
`AUTORADIO_SRC`
: if set, points at a local copy of the autoradio
source repository which will be compiled and installed instead of
using the default packages from the autoradio Debian repository.
So, for example, if you have a copy of the
*autoradio*
source
repository with some local changes that you want to test, you can use:
```
shell
$
ansible-playbook
-i
hosts.ini
\
-e
source_repository_path
=
$HOME
/go/src/git.autistici.org/ale/autoradio
\
site.yml
$ AUTORADIO_SRC
=
/path/to/git.autistici.org/ale/autoradio test.sh my-test
```
and the test environment in
*my-test*
will be set up to build
autoradio from your local sources.
Check the
*hosts.ini*
file in the my-test directory to find out the IP
addresses of the virtual machines (which are randomly generated).
## Test stream
The
*test-source.yml*
Ansible playbook can be used to quickly setup a
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment