diff --git a/EXAMPLE/cluster.yml b/EXAMPLE/cluster.yml index ef716260..fb05d3c6 100644 --- a/EXAMPLE/cluster.yml +++ b/EXAMPLE/cluster.yml @@ -1,9 +1,19 @@ --- +- name: clusterverse | Set up the environment + hosts: localhost:all + connection: local + gather_facts: no + tasks: + - { import_role: { name: 'clusterverse/_dependencies' }, tags: ["clusterverse_environment"] } + - { name: "clusterverse | Set env vars", set_fact: { envvars: "{{ cluster_vars.env_setup.vars | default({}) }}" }, tags: ["clusterverse_environment"] } + - { name: "clusterverse | Copy env files", local_action: "copy content={{item.value}} dest={{item.key}}", with_dict: "{{ cluster_vars.env_setup.files | ternary(cluster_vars.env_setup.files, {}) }}", run_once: yes, tags: ["clusterverse_environment"] } + - name: clusterverse | Deploy the cluster hosts: localhost connection: local gather_facts: no + environment: "{{envvars}}" tasks: - { name: "Get dependent roles via ansible-galaxy", local_action: "command ansible-galaxy install -fr requirements.yml", tags: ["always"] } @@ -14,15 +24,18 @@ - name: clusterverse | Wait for SSH connections hosts: all gather_facts: no + environment: "{{envvars}}" tasks: [ {wait_for_connection: "", tags: ["always"] } ] - name: clusterverse | Configure the cluster hosts: all + environment: "{{envvars}}" tasks: [ { include_role: { name: "clusterverse/config", apply: { tags: ["clusterverse_config"]} }, tags: ["clusterverse_config"] } ] ## Application roles - name: Application roles hosts: all + environment: "{{envvars}}" tasks: - { include_role: { name: "testrole", apply: { tags: ["testrole"]} }, tags: ["testrole"] } ## @@ -30,4 +43,5 @@ - name: clusterverse | Perform cluster readiness operations hosts: localhost connection: local + environment: "{{envvars}}" tasks: [ { include_role: { name: "clusterverse/readiness", apply: { tags: ["clusterverse_readiness"]} }, tags: ["clusterverse_readiness"] } ] diff --git a/EXAMPLE/cluster_defs/aws/cluster_vars.yml b/EXAMPLE/cluster_defs/aws/cluster_vars.yml index 97458acc..cfde67b7 100644 --- a/EXAMPLE/cluster_defs/aws/cluster_vars.yml +++ b/EXAMPLE/cluster_defs/aws/cluster_vars.yml @@ -1,6 +1,14 @@ --- cluster_vars: +# env_setup: +# vars: +# ANSIBLE_SSH_ARGS: '-o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s -o ProxyCommand="ssh -i ./id_rsa_bastion -W %h:%p -q ansible@bastion.clusterversetest.com"' +# files: +# id_rsa_bastion: | +# -----BEGIN RSA PRIVATE KEY----- +# M8fBuCjd/wbIi8uDGMGe8ezJKgIBAA3UNuiXK1H3DCXaCCA5QmASFhQhUlgIIEAv + -----END RSA PRIVATE KEY----- dns_cloud_internal_domain: "{{region}}.compute.internal" # The cloud-internal zone as defined by the cloud provider (e.g. GCP, AWS) dns_nameserver_zone: &dns_nameserver_zone "" # The zone that dns_server will operate on. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only) dns_server: "" # Specify DNS server. nsupdate, route53 or clouddns. If empty string is specified, no DNS will be added. diff --git a/EXAMPLE/cluster_defs/gcp/cluster_vars.yml b/EXAMPLE/cluster_defs/gcp/cluster_vars.yml index 8aa5471c..034f40d6 100644 --- a/EXAMPLE/cluster_defs/gcp/cluster_vars.yml +++ b/EXAMPLE/cluster_defs/gcp/cluster_vars.yml @@ -4,6 +4,14 @@ _ubuntu2004image: "projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v202 _centos7image: "projects/centos-cloud/global/images/centos-7-v20201216" cluster_vars: +# env_setup: +# vars: +# ANSIBLE_SSH_ARGS: '-o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s -o ProxyCommand="ssh -i ./id_rsa_bastion -W %h:%p -q ansible@bastion.clusterversetest.com"' +# files: +# id_rsa_bastion: | +# -----BEGIN RSA PRIVATE KEY----- +# M8fBuCjd/wbIi8uDGMGe8ezJKgIBAA3UNuiXK1H3DCXaCCA5QmASFhQhUlgIIEAv +# -----END RSA PRIVATE KEY----- image: "{{_ubuntu2004image}}" dns_cloud_internal_domain: "c.{{ (_service_account_rawtext | string | from_json).project_id }}.internal" # The cloud-internal zone as defined by the cloud provider (e.g. GCP, AWS) dns_nameserver_zone: &dns_nameserver_zone "zepkey.com." # The zone that dns_server will operate on. gcloud dns needs a trailing '.'. Leave blank if no external DNS (use IPs only) diff --git a/EXAMPLE/jenkinsfiles/Jenkinsfile_ops b/EXAMPLE/jenkinsfiles/Jenkinsfile_ops index 5955d778..5107b653 100644 --- a/EXAMPLE/jenkinsfiles/Jenkinsfile_ops +++ b/EXAMPLE/jenkinsfiles/Jenkinsfile_ops @@ -87,7 +87,7 @@ node { sh 'ls -l' println("currentBuild.getBuildCauses: " + currentBuild.getBuildCauses()) - if (currentBuild.getBuildCauses('hudson.model.Cause$SCMTriggerCause').size() > 0) { + if (currentBuild.getBuildCauses('hudson.model.Cause$SCMTriggerCause').size() > 0 || currentBuild.getBuildCauses('hudson.model.Cause$UpstreamCause').size() > 0) { println("Checking out default scm: " + scm.userRemoteConfigs + " -- " + scm.branches) checkout(scm) } else {