Skip to content

Commit

Permalink
Move variables to role defaults in order to use inventory group_vars
Browse files Browse the repository at this point in the history
  • Loading branch information
mkjpryor-stfc committed Apr 30, 2020
1 parent 1d16d85 commit 9d4706c
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 48 deletions.
53 changes: 31 additions & 22 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'json'

# Vagrant configuration
Vagrant.configure(2) do |config|
config.vm.box = "cedadev/centos7"
Expand Down Expand Up @@ -31,29 +33,36 @@ Vagrant.configure(2) do |config|
# Provision the VM with our Ansible playbook
config.vm.provision :ansible do |ansible|
ansible.playbook = "deploy/ansible/playbook.yml"
ansible.groups = { data: ["default"] }
# Configure the datasets from mini-esgf-data
# Use group_vars to simulate
ansible.extra_vars = {
hostname: "192.168.100.100.nip.io",
data_mounts: [
{
host_path: "/test_data",
mount_path: "/test_data"
}
],
data_datasets: [
{
name: "CMIP5",
path: "esg_cmip5",
location: "/test_data/badc/cmip5/data"
},
{
name: "CORDEX",
path: "esg_cordex",
location: "/test_data/group_workspaces/jasmin2/cp4cds1/data/c3s-cordex"
}
]
# Use group_vars to simulate the advice in the documentation
# However, because the Ansible provisioner doesn't have a native group_vars
# property, like it does for {extra,host}_vars, we need to convert to JSON
data_mounts = [
{
host_path: "/test_data",
mount_path: "/test_data"
}
]
data_datasets = [
{
name: "CMIP5",
path: "esg_cmip5",
location: "/test_data/badc/cmip5/data"
},
{
name: "CORDEX",
path: "esg_cordex",
location: "/test_data/group_workspaces/jasmin2/cp4cds1/data/c3s-cordex"
}
]
ansible.groups = {
"data" => ["default"],
"data:vars" => {
"hostname" => "192.168.100.100.nip.io",
"image_tag" => "issue-112-nginx-data-node",
"data_mounts" => "#{data_mounts.to_json}",
"data_datasets" => "#{data_datasets.to_json}"
}
}
end
end
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
---

###
# The hostname to use - by default, use the FQDN of the host
###
hostname: "{{ ansible_fqdn }}"


###
# Configuration for private registries that require authentication
###
docker_registries: []
# - registry: my.registry.org
# username: registryuser
# password: registrypassword


###
# Default values used for all images
# Each of these values can be overidden on a per-image basis if required
Expand Down Expand Up @@ -85,14 +70,3 @@ fileserver_image_prefix: "{{ image_prefix }}"
fileserver_image_tag: "{{ image_tag }}"
fileserver_image_pull: "{{ image_pull }}"
fileserver_image_repository: nginx


###
# Proxy configuration
###

# Settings for the proxy image
proxy_image_prefix: "{{ image_prefix }}"
proxy_image_tag: "{{ image_tag }}"
proxy_image_pull: "{{ image_pull }}"
proxy_image_repository: nginx
9 changes: 9 additions & 0 deletions deploy/ansible/roles/docker/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

###
# Configuration for private registries that require authentication
###
docker_registries: []
# - registry: my.registry.org
# username: registryuser
# password: registrypassword
39 changes: 39 additions & 0 deletions deploy/ansible/roles/proxy/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---

###
# The hostname to use - by default, use the FQDN of the host
###
hostname: "{{ ansible_fqdn }}"


###
# Default values used for all images
# Each of these values can be overidden on a per-image basis if required
###

# The image prefix to use
# If using a private registry, change this, e.g. registry.ceda.ac.uk/esgfdeploy
image_prefix: esgfdeploy
# The image tag to use
image_tag: latest
# Indicates whether images should be pulled every time the playbook runs
# When using mutable tags, like latest or branch names, this should be true
# When using immutable tags, like commit shas or release tags, this can be false
image_pull: true


###
# Proxy configuration
###

# Settings for the proxy image
proxy_image_prefix: "{{ image_prefix }}"
proxy_image_tag: "{{ image_tag }}"
proxy_image_pull: "{{ image_pull }}"
proxy_image_repository: nginx

# Indicates if THREDDS is enabled or not
thredds_enabled: true

# Indicates if the Nginx file server should be deployed or not
fileserver_enabled: true

0 comments on commit 9d4706c

Please sign in to comment.