diff --git a/ansible.cfg b/ansible.cfg index d24c9bed11b..3e03e5e6eb5 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,15 +1,12 @@ [defaults] -nocow = 1 +nocows = 1 roles_path = ansible/roles forks = 50 become = False gathering = smart -fact_caching = jsonfile -fact_caching_connection = .ansible_facts host_key_checking = False # dealing with escalation prompt errors on slow links timeout = 60 callback_whitelist = profile_tasks -# Use the YAML callback plugin. stdout_callback = yaml # Use the stdout_callback when running ad-hoc commands. bin_ansible_callbacks = True diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 00000000000..162d1607f5e --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,19 @@ +[defaults] +nocows = 1 +roles_path = roles +forks = 50 +become = false +gathering = smart +host_key_checking = False # dealing with escalation prompt errors on slow links +timeout = 60 +callback_whitelist = profile_tasks +stdout_callback = yaml +# Use the stdout_callback when running ad-hoc commands. +bin_ansible_callbacks = True + +[privilege_escalation] +become = false + +# override ssh_config ControlPath to use hashed value to handle long node names +[ssh_connection] +control_path = /tmp/%%h-%%r diff --git a/ansible/cloud_providers/azure_destroy_env.yml b/ansible/cloud_providers/azure_destroy_env.yml index fbfa33f4dd3..49f58ba43dc 100644 --- a/ansible/cloud_providers/azure_destroy_env.yml +++ b/ansible/cloud_providers/azure_destroy_env.yml @@ -6,91 +6,8 @@ connection: local gather_facts: False become: no - environment: - AZURE_CLIENT_ID: "{{azure_service_principal}}" - AZURE_TENANT: "{{azure_tenant}}" - AZURE_SECRET: "{{azure_password}}" - AZURE_SUBSCRIPTION_ID: "{{azure_subscription_id}}" - # AZURE_CONFIG_DIR: create a specific config dir for this stack to allow concurrent access for 'az' command - AZURE_CONFIG_DIR: "/tmp/.azure-{{project_tag}}" tasks: - - name: Delete delegation for NS to the main DNSZone - azure_rm_dnsrecordset: - resource_group: "{{az_dnszone_resource_group|default('dns')}}" - relative_name: "{{guid}}" - zone_name: "{{HostedZoneId}}" - record_type: NS - state: absent + - name: Run infra-azure-template-destroy + include_role: + name: infra-azure-template-destroy - - name: Destroy method resourceGroup (standalone ResourceGroup) - when: az_destroy_method|default('resource_group') == 'resource_group' - block: - - name: Delete the resource group - azure_rm_resourcegroup: - name: "{{az_resource_group}}" - state: absent - force: true - tags: - - destroying - - destroy_cloud_deployment - - destroy_azure_deployment - register: azure_result - until: azure_result|succeeded - retries: 6 - delay: 10 - ignore_errors: yes - when: - - cloud_provider == 'azure' - - - name: report azure error - fail: - msg: "FAIL {{ az_resource_group }} Azure delete group" - when: - - not azure_result|succeeded - - cloud_provider == 'azure' - tags: - - destroying - - destroy_cloud_deployment - - destroy_azure_deployment - - - name: Method destroy deployment (shared ResourceGroup) - when: az_destroy_method|default('resource_group') == 'deployment' - environment: - AZURE_CLIENT_ID: "{{azure_service_principal}}" - AZURE_TENANT: "{{azure_tenant}}" - AZURE_SECRET: "{{azure_password}}" - AZURE_SUBSCRIPTION_ID: "{{azure_subscription_id}}" - # AZURE_CONFIG_DIR: create a specific config dir for this stack to allow concurrent access - AZURE_CONFIG_DIR: "/tmp/.azure-{{project_tag}}" - block: - - set_fact: - t_dest: "{{workdir_dir}}/{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" - - - name: Get all resources from the deployment - command: az group deployment show --name {{env_type}}.{{guid}} --resource-group {{az_resource_group}} - changed_when: false - register: az_dep - until: az_dep|succeeded - retries: 5 - - - debug: - var: az_dep - verbosity: 2 - - - name: Get all resources from tag - command: az resource list --tag 'Project={{project_tag}}' - register: az_tag - retries: 5 - until: az_tag|succeeded - changed_when: false - - - name: delete all resources - vars: - ids_tags: "{{ az_tag.stdout|from_json|json_query('[*].id')}}" - ids_deployment: "{{ az_dep.stdout|from_json|json_query('properties.additionalProperties.outputResources[*].id')}}" - ids: "{{ids_deployment|union(ids_tags)}}" - command: "az resource delete --ids {{ids|join(' ')}} --resource-group {{az_resource_group}}" - register: az_delete - until: az_delete|succeeded - retries: 5 - when: ids|length > 0 diff --git a/ansible/cloud_providers/azure_infrastructure_deployment.yml b/ansible/cloud_providers/azure_infrastructure_deployment.yml index 03d80916db8..9b4c160b4e9 100644 --- a/ansible/cloud_providers/azure_infrastructure_deployment.yml +++ b/ansible/cloud_providers/azure_infrastructure_deployment.yml @@ -33,8 +33,8 @@ - must - set_fact: - t_dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" - params_dest: "{{workdir_dir}}/{{project_tag}}-cloud_template_parameters.json" + t_dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" + params_dest: "{{output_dir}}/{{project_tag}}-cloud_template_parameters.json" tags: - azure_infrastructure_deployment - validate_azure_template @@ -255,8 +255,9 @@ var: hostvars verbosity: 2 +# TODO: use common infra role instead of this playbook - name: Configure local ssh config for bastion proxy use - import_playbook: "{{ANSIBLE_REPO_PATH | default('.')}}/cloud_providers/{{cloud_provider}}_ssh_config_setup.yml" + import_playbook: "{{cloud_provider}}_ssh_config_setup.yml" when: groups['bastions'] tags: - must diff --git a/ansible/cloud_providers/azure_ssh_config_setup.yml b/ansible/cloud_providers/azure_ssh_config_setup.yml index 289ab9da8fe..e10610d14f7 100644 --- a/ansible/cloud_providers/azure_ssh_config_setup.yml +++ b/ansible/cloud_providers/azure_ssh_config_setup.yml @@ -1,3 +1,3 @@ --- - name: Configure local ssh config for bastion proxy use - import_playbook: "{{ANSIBLE_REPO_PATH | default('.')}}/cloud_providers/common_ssh_config_setup.yml" + import_playbook: common_ssh_config_setup.yml diff --git a/ansible/cloud_providers/common_ssh_config_setup.yml b/ansible/cloud_providers/common_ssh_config_setup.yml index 92270e36903..9a24507fa81 100644 --- a/ansible/cloud_providers/common_ssh_config_setup.yml +++ b/ansible/cloud_providers/common_ssh_config_setup.yml @@ -19,8 +19,8 @@ bastion_hostname: "{{groups['bastions'].0 }}" # This is where the ssh_config file will be created, this file is used to # define the communication method to all the hosts in the deployment - ansible_ssh_config: "{{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" - ansible_known_host: "{{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_known_hosts" + ansible_ssh_config: "{{output_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_known_host: "{{output_dir}}/{{ env_type }}_{{ guid }}_ssh_known_hosts" - name: Delete dedicated known_host if it exists (new deployment) file: diff --git a/ansible/cloud_providers/ec2_destroy_env.yml b/ansible/cloud_providers/ec2_destroy_env.yml index 05d1be7b1cc..63c2ed4af8e 100644 --- a/ansible/cloud_providers/ec2_destroy_env.yml +++ b/ansible/cloud_providers/ec2_destroy_env.yml @@ -7,34 +7,6 @@ gather_facts: False become: no tasks: - - name: Destroy cloudformation template - cloudformation: - aws_access_key: "{{ aws_access_key_id }}" - aws_secret_key: "{{ aws_secret_access_key }}" - stack_name: "{{project_tag}}" - state: "absent" - region: "{{aws_region_final|d(aws_region)}}" - disable_rollback: false - tags: - Stack: "project {{env_type}}-{{ guid }}" - tags: - - destroying - - destroy_cf_deployment - - destroy_cloud_deployment - register: cloudformation_result - until: cloudformation_result|succeeded - retries: "{{cloudformation_retries|d(3)}}" - delay: "{{ cloudformation_retry_delay | default(60) }}" - ignore_errors: yes - when: cloud_provider == 'ec2' - - - name: report Cloudformation error - fail: - msg: "FAIL {{ project_tag }} Destroy Cloudformation" - when: - - not cloudformation_result is succeeded - - cloud_provider == 'ec2' - tags: - - destroying - - destroy_cf_deployment - - destroy_cloud_deployment + - name: Run infra-ec2-template-destroy + include_role: + name: infra-ec2-template-destroy diff --git a/ansible/cloud_providers/ec2_infrastructure_deployment.yml b/ansible/cloud_providers/ec2_infrastructure_deployment.yml index 67e0bb31fb3..874f08ba12c 100644 --- a/ansible/cloud_providers/ec2_infrastructure_deployment.yml +++ b/ansible/cloud_providers/ec2_infrastructure_deployment.yml @@ -82,7 +82,7 @@ - create_inventory set_fact: aws_region_final: "{{hostvars['localhost'].aws_region_final}}" - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{output_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" - name: Run infra-ec2-wait_for_linux_hosts Role import_role: diff --git a/ansible/configs/ans-tower-lab/README.adoc b/ansible/configs/ans-tower-lab/README.adoc index e465437d502..77c30c247b3 100644 --- a/ansible/configs/ans-tower-lab/README.adoc +++ b/ansible/configs/ans-tower-lab/README.adoc @@ -60,7 +60,7 @@ DEPLOYER_REPO_PATH=`pwd` ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" \ -e "env_type=${ENVTYPE}" \ -e "key_name=${KEYNAME}" \ @@ -91,7 +91,7 @@ DEPLOYER_REPO_PATH=`pwd` ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" \ -e "env_type=${ENVTYPE}" \ -e "key_name=${KEYNAME}" \ diff --git a/ansible/configs/ans-tower-lab/destroy_env.yml b/ansible/configs/ans-tower-lab/destroy_env.yml index df6859ecc2a..2207c9a9e63 100644 --- a/ansible/configs/ans-tower-lab/destroy_env.yml +++ b/ansible/configs/ans-tower-lab/destroy_env.yml @@ -1,12 +1,11 @@ +--- +- import_playbook: ../../include_vars.yml + - name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - name: Destroy cloudformation template cloudformation: diff --git a/ansible/configs/ans-tower-lab/pre_infra.yml b/ansible/configs/ans-tower-lab/pre_infra.yml index 71657f9385e..4e7e9aefcd9 100644 --- a/ansible/configs/ans-tower-lab/pre_infra.yml +++ b/ansible/configs/ans-tower-lab/pre_infra.yml @@ -14,7 +14,7 @@ block: - name: Stat workdir/[...]_windows_password.txt file stat: - path: "{{workdir_dir}}/{{ env_type }}_{{guid}}_windows_password.txt" + path: "{{output_dir}}/{{ env_type }}_{{guid}}_windows_password.txt" register: passwordfile # This task needs to be "ansibled", we cannot assume tr exists # This also doesn't work on MAC, that does have tr. @@ -24,7 +24,7 @@ when: not passwordfile.stat.exists - name: Read windows password from workdir/[...]_windows_password.txt file - command: "cat '{{workdir_dir}}/{{ env_type }}_{{guid}}_windows_password.txt'" + command: "cat '{{output_dir}}/{{ env_type }}_{{guid}}_windows_password.txt'" register: password_get_r changed_when: false when: passwordfile.stat.exists @@ -43,5 +43,5 @@ - name: Save windows_password or generated_windows_password into workdir/ copy: content: "{{ windows_password | default(generated_windows_password) }}" - dest: "{{workdir_dir}}/{{ env_type }}_{{guid}}_windows_password.txt" + dest: "{{output_dir}}/{{ env_type }}_{{guid}}_windows_password.txt" mode: 0600 diff --git a/ansible/configs/ans-tower-lab/pre_software.yml b/ansible/configs/ans-tower-lab/pre_software.yml index ec0b58b2f72..b92a75478b6 100644 --- a/ansible/configs/ans-tower-lab/pre_software.yml +++ b/ansible/configs/ans-tower-lab/pre_software.yml @@ -12,9 +12,9 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/ansible-cicd-lab/README.adoc b/ansible/configs/ansible-cicd-lab/README.adoc index 4ce0d6e0776..90c574aeb15 100644 --- a/ansible/configs/ansible-cicd-lab/README.adoc +++ b/ansible/configs/ansible-cicd-lab/README.adoc @@ -75,14 +75,14 @@ ENVTYPE="ansible-cicd-lab" CLOUDPROVIDER=ec2 HOSTZONEID='Z3IHLWJZOU9SRT' REPO_PATH='http://admin.example.com/repos/ocp/3.9.33/' -ANSIBLE_REPO_PATH | default('.')=`pwd` +ANSIBLE_REPO_PATH=`pwd` BASESUFFIX='.example.opentlc.com' DEPLOYER_REPO_PATH=`pwd` ADMIN_PASSWORD=somepassword LICENSE_URL="https://admin.example.com/download/ansible_bootcamp/tower/licenses/license.txt" ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" \ -e "env_type=${ENVTYPE}" \ -e "key_name=${KEYNAME}" \ @@ -114,7 +114,7 @@ DEPLOYER_REPO_PATH=`pwd` ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" \ -e "env_type=${ENVTYPE}" \ -e "key_name=${KEYNAME}" \ @@ -142,7 +142,7 @@ HOSTZONEID='Z3IHLWJZOU9SRT' BASESUFFIX='.example.opentlc.com' #To Destroy an Env ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" \ -e "HostedZoneId=${HOSTZONEID}" -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" ---- diff --git a/ansible/configs/ansible-cicd-lab/destroy_env.yml b/ansible/configs/ansible-cicd-lab/destroy_env.yml index 86429d20705..6af8600d1d9 100644 --- a/ansible/configs/ansible-cicd-lab/destroy_env.yml +++ b/ansible/configs/ansible-cicd-lab/destroy_env.yml @@ -1,12 +1,11 @@ +--- +- import_playbook: ../../include_vars.yml + - name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - name: Run infra-ec2-template-destroy include_role: diff --git a/ansible/configs/ansible-cicd-lab/env_vars.yml b/ansible/configs/ansible-cicd-lab/env_vars.yml index 53e9a1c23a9..3fc43988e60 100644 --- a/ansible/configs/ansible-cicd-lab/env_vars.yml +++ b/ansible/configs/ansible-cicd-lab/env_vars.yml @@ -35,7 +35,7 @@ project_tag: "{{ env_type }}-{{ guid }}" # This is where the ssh_config file will be created, this file is used to # define the communication method to all the hosts in the deployment -deploy_local_ssh_config_location: "{{workdir_dir}}/" +deploy_local_ssh_config_location: "{{output_dir}}/" install_bastion: true install_common: true diff --git a/ansible/configs/ansible-cicd-lab/pre_infra.yml b/ansible/configs/ansible-cicd-lab/pre_infra.yml index 48c59733999..89fd2e4626d 100644 --- a/ansible/configs/ansible-cicd-lab/pre_infra.yml +++ b/ansible/configs/ansible-cicd-lab/pre_infra.yml @@ -15,19 +15,19 @@ msg: "Step 000 Pre Infrastructure" - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key diff --git a/ansible/configs/ansible-provisioner/README.adoc b/ansible/configs/ansible-provisioner/README.adoc index 5224c412da4..29d410d822f 100644 --- a/ansible/configs/ansible-provisioner/README.adoc +++ b/ansible/configs/ansible-provisioner/README.adoc @@ -49,7 +49,7 @@ github_token: "" ---- -For managing users on the ansible provisioner, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : +For managing users on the ansible provisioner, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : .Default mgr_users.yml [source,yaml] diff --git a/ansible/configs/ansible-provisioner/destroy_env.yml b/ansible/configs/ansible-provisioner/destroy_env.yml index e2116da7d3f..08a5cc3f0a0 100644 --- a/ansible/configs/ansible-provisioner/destroy_env.yml +++ b/ansible/configs/ansible-provisioner/destroy_env.yml @@ -1,3 +1,3 @@ --- - name: Import default CloudFormation (aws) destroy playbook - import_playbook: "{{workdir_dir}}/cloud_providers/{{cloud_provider}}_destroy_env.yml" + import_playbook: "../../cloud_providers/{{cloud_provider}}_destroy_env.yml" diff --git a/ansible/configs/ansible-provisioner/env_secret_vars.yml b/ansible/configs/ansible-provisioner/env_secret_vars.yml deleted file mode 100644 index f5cc50f7ed4..00000000000 --- a/ansible/configs/ansible-provisioner/env_secret_vars.yml +++ /dev/null @@ -1,14 +0,0 @@ -# ## Logon credentials for Red Hat Network -# ## Required if using the subscription component -# ## of this playbook. - -# ## LDAP Bind Password - -# -# ## Desired openshift admin name and password -# admin_user: "" -# admin_user_password: "" -# -# ## AWS Credentials. This is required. -# aws_access_key_id: "" -# aws_secret_access_key: "" diff --git a/ansible/configs/archive/linklight-demo/README.adoc b/ansible/configs/archive/linklight-demo/README.adoc index bc0b806e432..032b0eabac7 100644 --- a/ansible/configs/archive/linklight-demo/README.adoc +++ b/ansible/configs/archive/linklight-demo/README.adoc @@ -42,7 +42,7 @@ $ mydeploy-script.sh --student_workloads=linklight_engine --more_args ... [source,bash] ---- ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ ..... args omitted for brevity -e @configs/linklight/linklight_all_vars.yml \ @@ -111,10 +111,10 @@ EC2_KEYNAME=${GUID}-link STUDENT_TOTAL=2 -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ -e env_type=${ENV_TYPE} \ -e project_tag=${ENV_TYPE}-${GUID} \ @@ -155,10 +155,10 @@ ENV_TYPE=linklight EC2_NAME_PREFIX=${GUID} EC2_REGION=us-east-1 -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) -ansible-playbook ${ANSIBLE_REPO_PATH | default('.')}/configs/${ENV_TYPE}/destroy_env.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ +ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e ec2_name_prefix=${GUID} \ -e ec2_region=${EC2_REGION} \ -e @configs/linklight/linklight_all_vars.yml \ diff --git a/ansible/configs/archive/linklight-demo/destroy_env.yml b/ansible/configs/archive/linklight-demo/destroy_env.yml index 8489463e5ea..45e8b7f3afe 100644 --- a/ansible/configs/archive/linklight-demo/destroy_env.yml +++ b/ansible/configs/archive/linklight-demo/destroy_env.yml @@ -3,8 +3,8 @@ connection: local gather_facts: False become: no + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" - - - -- import_playbook: "{{workdir_dir}}/linklight/provisioner/teardown_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight/provisioner/teardown_lab.yml" diff --git a/ansible/configs/archive/linklight-demo/post_infra.yml b/ansible/configs/archive/linklight-demo/post_infra.yml index eeac335d82a..79266a58866 100644 --- a/ansible/configs/archive/linklight-demo/post_infra.yml +++ b/ansible/configs/archive/linklight-demo/post_infra.yml @@ -3,9 +3,9 @@ hosts: localhost connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -44,9 +44,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -104,19 +104,19 @@ - name: Run infra-ec2-create-inventory Role include_role: - name: "infra-ec2-create-inventory" + name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" - name: Run Common SSH Config Generator Role include_role: - name: "infra-common-ssh-config-generate" + name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" - name: ssh workaround thing hosts: all connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -124,5 +124,5 @@ - name: set facts for remote access set_fact: - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf" diff --git a/ansible/configs/archive/linklight-demo/post_software.yml b/ansible/configs/archive/linklight-demo/post_software.yml index ddaa7fc1aa7..2b419864371 100644 --- a/ansible/configs/archive/linklight-demo/post_software.yml +++ b/ansible/configs/archive/linklight-demo/post_software.yml @@ -2,8 +2,8 @@ hosts: support gather_facts: False become: yes - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - debug: msg: "Post-Software tasks Started" @@ -14,11 +14,11 @@ become: yes tags: - opentlc_bastion_tasks - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - import_role: - name: "bastion-opentlc-ipa" + name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" when: install_ipa_client|bool # sssd bug, fixed by restart @@ -33,9 +33,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/linklight-demo/pre_infra.yml b/ansible/configs/archive/linklight-demo/pre_infra.yml index bab001ad56b..f8a927b2725 100644 --- a/ansible/configs/archive/linklight-demo/pre_infra.yml +++ b/ansible/configs/archive/linklight-demo/pre_infra.yml @@ -3,9 +3,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -18,19 +18,19 @@ - name: Generate SSH keys when set_env_authorized_key block: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{ env_authorized_key }}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" -q -N "" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" - name: fix permission file: - path: "{{workdir_dir}}/{{ env_authorized_key }}" + path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" mode: 0400 - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{ env_authorized_key }}" > "{{workdir_dir}}/{{ env_authorized_key }}.pub" + shell: ssh-keygen -y -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" > "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}.pub" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" when: set_env_authorized_key - name: PreSoftware flight-check @@ -38,16 +38,16 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: - debug: msg: "Pre-Software checks completed successfully" -- import_playbook: "{{workdir_dir}}/linklight/provisioner/provision_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight/provisioner/provision_lab.yml" tags: - linklight_provision @@ -57,9 +57,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check @@ -75,9 +75,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/linklight-demo/pre_software.yml b/ansible/configs/archive/linklight-demo/pre_software.yml index 0a7e8221c1b..1ac16bec2d3 100644 --- a/ansible/configs/archive/linklight-demo/pre_software.yml +++ b/ansible/configs/archive/linklight-demo/pre_software.yml @@ -5,25 +5,25 @@ - all:!windows become: true gather_facts: False - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step004 - common_tasks roles: - - { role: "set-repositories", when: 'repo_method is defined' } - - { role: "common", when: 'install_common' } - - { role: "set_env_authorized_key", when: 'set_env_authorized_key' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' } - name: Configuring Bastion Hosts hosts: bastions become: true - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" roles: - - { role: "bastion", when: 'install_bastion' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/bastion", when: 'install_bastion' } tags: - step004 - bastion_tasks @@ -34,9 +34,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: diff --git a/ansible/configs/archive/linklight-engine/README.adoc b/ansible/configs/archive/linklight-engine/README.adoc index 93348553681..1d1e88a17f3 100644 --- a/ansible/configs/archive/linklight-engine/README.adoc +++ b/ansible/configs/archive/linklight-engine/README.adoc @@ -79,10 +79,10 @@ EMAIL_USERS=no CREATE_LOGIN_PAGE=false STUDENT_TOTAL=1 USERS='{"users":[{ "name": "Alice", "username": "alice", "email": "alice@example.com" }, { "name": "Bob", "username":"bob", "email": "bob@example.com" }]}' -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ -e env_type=${ENV_TYPE} \ -e networking=${NETWORKING} \ @@ -133,10 +133,10 @@ EC2_NAME_PREFIX=${GUID} EC2_REGION=us-east-1 EC2_AVAILABILITY_ZONE=us-east-1a -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) -ansible-playbook ${ANSIBLE_REPO_PATH | default('.')}/configs/${ENV_TYPE}/destroy_env.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ +ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e ec2_name_prefix=${GUID} \ -e ec2_region=${EC2_REGION} \ -e s3_state=absent \ diff --git a/ansible/configs/archive/linklight-engine/destroy_env.yml b/ansible/configs/archive/linklight-engine/destroy_env.yml index 61687b3353e..58420b03140 100644 --- a/ansible/configs/archive/linklight-engine/destroy_env.yml +++ b/ansible/configs/archive/linklight-engine/destroy_env.yml @@ -3,8 +3,8 @@ connection: local gather_facts: False become: no + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" - - - -- import_playbook: "{{workdir_dir}}/linklight-engine/provisioner/teardown_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-engine/provisioner/teardown_lab.yml" diff --git a/ansible/configs/archive/linklight-engine/post_infra.yml b/ansible/configs/archive/linklight-engine/post_infra.yml index 7dadff7703a..79266a58866 100644 --- a/ansible/configs/archive/linklight-engine/post_infra.yml +++ b/ansible/configs/archive/linklight-engine/post_infra.yml @@ -3,9 +3,9 @@ hosts: localhost connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -44,9 +44,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -104,19 +104,19 @@ - name: Run infra-ec2-create-inventory Role include_role: - name: "infra-ec2-create-inventory" + name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" - name: Run Common SSH Config Generator Role include_role: - name: "infra-common-ssh-config-generate" + name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" - name: ssh workaround thing hosts: all connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -124,5 +124,5 @@ - name: set facts for remote access set_fact: - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf" diff --git a/ansible/configs/archive/linklight-engine/post_software.yml b/ansible/configs/archive/linklight-engine/post_software.yml index b168ad6d99d..2b419864371 100644 --- a/ansible/configs/archive/linklight-engine/post_software.yml +++ b/ansible/configs/archive/linklight-engine/post_software.yml @@ -2,8 +2,8 @@ hosts: support gather_facts: False become: yes - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - debug: msg: "Post-Software tasks Started" @@ -14,11 +14,11 @@ become: yes tags: - opentlc_bastion_tasks - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - import_role: - name: "bastion-opentlc-ipa" + name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" when: install_ipa_client|bool # sssd bug, fixed by restart @@ -33,9 +33,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/linklight-engine/pre_infra.yml b/ansible/configs/archive/linklight-engine/pre_infra.yml index 432a5427b9d..be0f3db7e7f 100644 --- a/ansible/configs/archive/linklight-engine/pre_infra.yml +++ b/ansible/configs/archive/linklight-engine/pre_infra.yml @@ -3,9 +3,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -18,28 +18,28 @@ - name: Generate SSH keys when set_env_authorized_key block: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{ env_authorized_key }}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" -q -N "" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" - name: fix permission file: - path: "{{workdir_dir}}/{{ env_authorized_key }}" + path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" mode: 0400 - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{ env_authorized_key }}" > "{{workdir_dir}}/{{ env_authorized_key }}.pub" + shell: ssh-keygen -y -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" > "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}.pub" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" when: set_env_authorized_key # tested version on 2018-07-24 fc86de92080165b72906a1477e389cf0298bd499 # - name: Clone Ansible linklight repo locally - specfic commit #git: # repo: https://github.com/network-automation/linklight.git - # dest: "{{workdir_dir}}/linklight" + # dest: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight" # version: fc86de92080165b72906a1477e389cf0298bd499 -- import_playbook: "{{workdir_dir}}/linklight-engine/provisioner/provision_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-engine/provisioner/provision_lab.yml" tags: - linklight_provision diff --git a/ansible/configs/archive/linklight-engine/pre_software.yml b/ansible/configs/archive/linklight-engine/pre_software.yml index a358b70d8cb..1ac16bec2d3 100644 --- a/ansible/configs/archive/linklight-engine/pre_software.yml +++ b/ansible/configs/archive/linklight-engine/pre_software.yml @@ -5,25 +5,25 @@ - all:!windows become: true gather_facts: False - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step004 - common_tasks roles: - - { role: "set-repositories", when: 'repo_method is defined' } - - { role: "common", when: 'install_common' } - - { role: "set_env_authorized_key", when: 'set_env_authorized_key' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' } - name: Configuring Bastion Hosts hosts: bastions become: true - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" roles: - - { role: "bastion", when: 'install_bastion' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/bastion", when: 'install_bastion' } tags: - step004 - bastion_tasks @@ -34,9 +34,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: diff --git a/ansible/configs/archive/linklight-networking-allcisco/README.adoc b/ansible/configs/archive/linklight-networking-allcisco/README.adoc index cf200e652e5..247c9728776 100644 --- a/ansible/configs/archive/linklight-networking-allcisco/README.adoc +++ b/ansible/configs/archive/linklight-networking-allcisco/README.adoc @@ -81,10 +81,10 @@ CREATE_LOGIN_PAGE=false STUDENT_TOTAL=1 USERS='{"users":[{ "name": "Alice", "username": "alice", "email": "alice@example.com" }, { "name": "Bob", "username":"bob", "email": "bob@example.com" }]}' -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e host_key_checking=False \ -e guid=${GUID} \ -e env_type=${ENV_TYPE} \ @@ -137,10 +137,10 @@ EC2_NAME_PREFIX=${GUID} EC2_REGION=us-east-1 EC2_AVAILABILITY_ZONE=us-east-1a -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) -ansible-playbook ${ANSIBLE_REPO_PATH | default('.')}/configs/${ENV_TYPE}/destroy_env.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ +ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e 'host_key_checking=False \ -e ec2_name_prefix=${GUID} \ -e ec2_region=${EC2_REGION} \ diff --git a/ansible/configs/archive/linklight-networking-allcisco/destroy_env.yml b/ansible/configs/archive/linklight-networking-allcisco/destroy_env.yml index 881048e0f2a..c816bbed201 100644 --- a/ansible/configs/archive/linklight-networking-allcisco/destroy_env.yml +++ b/ansible/configs/archive/linklight-networking-allcisco/destroy_env.yml @@ -3,8 +3,8 @@ connection: local gather_facts: False become: no + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" - - - -- import_playbook: "{{workdir_dir}}/linklight-networking-allcisco/provisioner/teardown_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-networking-allcisco/provisioner/teardown_lab.yml" diff --git a/ansible/configs/archive/linklight-networking-allcisco/post_infra.yml b/ansible/configs/archive/linklight-networking-allcisco/post_infra.yml index 7dadff7703a..79266a58866 100644 --- a/ansible/configs/archive/linklight-networking-allcisco/post_infra.yml +++ b/ansible/configs/archive/linklight-networking-allcisco/post_infra.yml @@ -3,9 +3,9 @@ hosts: localhost connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -44,9 +44,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -104,19 +104,19 @@ - name: Run infra-ec2-create-inventory Role include_role: - name: "infra-ec2-create-inventory" + name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" - name: Run Common SSH Config Generator Role include_role: - name: "infra-common-ssh-config-generate" + name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" - name: ssh workaround thing hosts: all connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -124,5 +124,5 @@ - name: set facts for remote access set_fact: - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf" diff --git a/ansible/configs/archive/linklight-networking-allcisco/post_software.yml b/ansible/configs/archive/linklight-networking-allcisco/post_software.yml index b168ad6d99d..2b419864371 100644 --- a/ansible/configs/archive/linklight-networking-allcisco/post_software.yml +++ b/ansible/configs/archive/linklight-networking-allcisco/post_software.yml @@ -2,8 +2,8 @@ hosts: support gather_facts: False become: yes - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - debug: msg: "Post-Software tasks Started" @@ -14,11 +14,11 @@ become: yes tags: - opentlc_bastion_tasks - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - import_role: - name: "bastion-opentlc-ipa" + name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" when: install_ipa_client|bool # sssd bug, fixed by restart @@ -33,9 +33,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/linklight-networking-allcisco/pre_infra.yml b/ansible/configs/archive/linklight-networking-allcisco/pre_infra.yml index 150fe30b289..f727549d226 100644 --- a/ansible/configs/archive/linklight-networking-allcisco/pre_infra.yml +++ b/ansible/configs/archive/linklight-networking-allcisco/pre_infra.yml @@ -3,9 +3,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -18,41 +18,41 @@ - name: Generate SSH keys when set_env_authorized_key block: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{ env_authorized_key }}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" -q -N "" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" - name: fix permission file: - path: "{{workdir_dir}}/{{ env_authorized_key }}" + path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" mode: 0400 - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{ env_authorized_key }}" > "{{workdir_dir}}/{{ env_authorized_key }}.pub" + shell: ssh-keygen -y -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" > "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}.pub" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" when: set_env_authorized_key # tested version on 2018-07-24 fc86de92080165b72906a1477e389cf0298bd499 # - name: Clone Ansible linklight repo locally - specfic commit #git: # repo: https://github.com/network-automation/linklight.git - # dest: "{{workdir_dir}}/linklight" + # dest: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight" # version: fc86de92080165b72906a1477e389cf0298bd499 - name: PreSoftware flight-check hosts: localhost connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: - debug: msg: "Pre-Software checks completed successfully" -- import_playbook: "{{workdir_dir}}/linklight-networking-allcisco/provisioner/provision_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-networking-allcisco/provisioner/provision_lab.yml" tags: - linklight_provision @@ -62,9 +62,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/linklight-networking-allcisco/pre_software.yml b/ansible/configs/archive/linklight-networking-allcisco/pre_software.yml index a358b70d8cb..1ac16bec2d3 100644 --- a/ansible/configs/archive/linklight-networking-allcisco/pre_software.yml +++ b/ansible/configs/archive/linklight-networking-allcisco/pre_software.yml @@ -5,25 +5,25 @@ - all:!windows become: true gather_facts: False - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step004 - common_tasks roles: - - { role: "set-repositories", when: 'repo_method is defined' } - - { role: "common", when: 'install_common' } - - { role: "set_env_authorized_key", when: 'set_env_authorized_key' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' } - name: Configuring Bastion Hosts hosts: bastions become: true - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" roles: - - { role: "bastion", when: 'install_bastion' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/bastion", when: 'install_bastion' } tags: - step004 - bastion_tasks @@ -34,9 +34,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: diff --git a/ansible/configs/archive/linklight-networking/README.adoc b/ansible/configs/archive/linklight-networking/README.adoc index 10eb23d7b03..8b9aa289496 100644 --- a/ansible/configs/archive/linklight-networking/README.adoc +++ b/ansible/configs/archive/linklight-networking/README.adoc @@ -81,10 +81,10 @@ CREATE_LOGIN_PAGE=false STUDENT_TOTAL=1 USERS='{"users":[{ "name": "Alice", "username": "alice", "email": "alice@example.com" }, { "name": "Bob", "username":"bob", "email": "bob@example.com" }]}' -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e host_key_checking=False \ -e guid=${GUID} \ -e env_type=${ENV_TYPE} \ @@ -137,10 +137,10 @@ EC2_NAME_PREFIX=${GUID} EC2_REGION=us-east-1 EC2_AVAILABILITY_ZONE=us-east-1a -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) -ansible-playbook ${ANSIBLE_REPO_PATH | default('.')}/configs/${ENV_TYPE}/destroy_env.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ +ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e 'host_key_checking=False \ -e ec2_name_prefix=${GUID} \ -e ec2_region=${EC2_REGION} \ diff --git a/ansible/configs/archive/linklight-networking/destroy_env.yml b/ansible/configs/archive/linklight-networking/destroy_env.yml index cef9acbd150..57e0bd8c89e 100644 --- a/ansible/configs/archive/linklight-networking/destroy_env.yml +++ b/ansible/configs/archive/linklight-networking/destroy_env.yml @@ -3,8 +3,8 @@ connection: local gather_facts: False become: no + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" - - - -- import_playbook: "{{workdir_dir}}/linklight-networking/provisioner/teardown_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-networking/provisioner/teardown_lab.yml" diff --git a/ansible/configs/archive/linklight-networking/post_infra.yml b/ansible/configs/archive/linklight-networking/post_infra.yml index 7dadff7703a..79266a58866 100644 --- a/ansible/configs/archive/linklight-networking/post_infra.yml +++ b/ansible/configs/archive/linklight-networking/post_infra.yml @@ -3,9 +3,9 @@ hosts: localhost connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -44,9 +44,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -104,19 +104,19 @@ - name: Run infra-ec2-create-inventory Role include_role: - name: "infra-ec2-create-inventory" + name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" - name: Run Common SSH Config Generator Role include_role: - name: "infra-common-ssh-config-generate" + name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" - name: ssh workaround thing hosts: all connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -124,5 +124,5 @@ - name: set facts for remote access set_fact: - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf" diff --git a/ansible/configs/archive/linklight-networking/post_software.yml b/ansible/configs/archive/linklight-networking/post_software.yml index b168ad6d99d..2b419864371 100644 --- a/ansible/configs/archive/linklight-networking/post_software.yml +++ b/ansible/configs/archive/linklight-networking/post_software.yml @@ -2,8 +2,8 @@ hosts: support gather_facts: False become: yes - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - debug: msg: "Post-Software tasks Started" @@ -14,11 +14,11 @@ become: yes tags: - opentlc_bastion_tasks - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - import_role: - name: "bastion-opentlc-ipa" + name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" when: install_ipa_client|bool # sssd bug, fixed by restart @@ -33,9 +33,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/linklight-networking/pre_infra.yml b/ansible/configs/archive/linklight-networking/pre_infra.yml index 71b7ec2eed8..9ee384a51bc 100644 --- a/ansible/configs/archive/linklight-networking/pre_infra.yml +++ b/ansible/configs/archive/linklight-networking/pre_infra.yml @@ -3,9 +3,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -18,42 +18,42 @@ - name: Generate SSH keys when set_env_authorized_key block: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{ env_authorized_key }}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" -q -N "" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" - name: fix permission file: - path: "{{workdir_dir}}/{{ env_authorized_key }}" + path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" mode: 0400 - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{ env_authorized_key }}" > "{{workdir_dir}}/{{ env_authorized_key }}.pub" + shell: ssh-keygen -y -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" > "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}.pub" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" when: set_env_authorized_key # tested version on 2018-07-24 fc86de92080165b72906a1477e389cf0298bd499 # - name: Clone Ansible linklight repo locally - specfic commit #git: # repo: https://github.com/network-automation/linklight.git - # dest: "{{workdir_dir}}/linklight" + # dest: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight" # version: fc86de92080165b72906a1477e389cf0298bd499 - name: PreSoftware flight-check hosts: localhost connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: - debug: msg: "Pre-Software checks completed successfully" -- import_playbook: "{{workdir_dir}}/linklight-networking/provisioner/provision_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-networking/provisioner/provision_lab.yml" tags: - linklight_provision @@ -63,9 +63,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/linklight-networking/pre_software.yml b/ansible/configs/archive/linklight-networking/pre_software.yml index a358b70d8cb..1ac16bec2d3 100644 --- a/ansible/configs/archive/linklight-networking/pre_software.yml +++ b/ansible/configs/archive/linklight-networking/pre_software.yml @@ -5,25 +5,25 @@ - all:!windows become: true gather_facts: False - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step004 - common_tasks roles: - - { role: "set-repositories", when: 'repo_method is defined' } - - { role: "common", when: 'install_common' } - - { role: "set_env_authorized_key", when: 'set_env_authorized_key' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' } - name: Configuring Bastion Hosts hosts: bastions become: true - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" roles: - - { role: "bastion", when: 'install_bastion' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/bastion", when: 'install_bastion' } tags: - step004 - bastion_tasks @@ -34,9 +34,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: diff --git a/ansible/configs/archive/rhte-ansible-net/README.adoc b/ansible/configs/archive/rhte-ansible-net/README.adoc index 7c7a555aab1..498503716a3 100644 --- a/ansible/configs/archive/rhte-ansible-net/README.adoc +++ b/ansible/configs/archive/rhte-ansible-net/README.adoc @@ -81,10 +81,10 @@ EMAIL_USERS=no CREATE_LOGIN_PAGE=false STUDENT_TOTAL=2 #USERS='{"users":[{ "name": "Alice", "username": "alice", "email": "alice@example.com" }, { "name": "Bob", "username":"bob", "email": "bob@example.com" }]}' -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ -e env_type=${ENV_TYPE} \ -e networking=${NETWORKING} \ @@ -137,10 +137,10 @@ EC2_NAME_PREFIX=${GUID} EC2_REGION=us-east-1 EC2_AVAILABILITY_ZONE=us-east-1a -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) -ansible-playbook ${ANSIBLE_REPO_PATH | default('.')}/configs/${ENV_TYPE}/destroy_env.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ +ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e ec2_name_prefix=${GUID} \ -e ec2_region=${EC2_REGION} \ -e ec2_az=${EC2_AVAILABILITY_ZONE}ยท diff --git a/ansible/configs/archive/rhte-ansible-net/destroy_env.yml b/ansible/configs/archive/rhte-ansible-net/destroy_env.yml index befd3bd6490..21c8ce04b49 100644 --- a/ansible/configs/archive/rhte-ansible-net/destroy_env.yml +++ b/ansible/configs/archive/rhte-ansible-net/destroy_env.yml @@ -3,8 +3,8 @@ connection: local gather_facts: False become: no - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" -- import_playbook: "{{workdir_dir}}/rhte-ansible-net/provisioner/teardown_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/rhte-ansible-net/provisioner/teardown_lab.yml" diff --git a/ansible/configs/archive/rhte-ansible-net/post_infra.yml b/ansible/configs/archive/rhte-ansible-net/post_infra.yml index eeac335d82a..79266a58866 100644 --- a/ansible/configs/archive/rhte-ansible-net/post_infra.yml +++ b/ansible/configs/archive/rhte-ansible-net/post_infra.yml @@ -3,9 +3,9 @@ hosts: localhost connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -44,9 +44,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -104,19 +104,19 @@ - name: Run infra-ec2-create-inventory Role include_role: - name: "infra-ec2-create-inventory" + name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" - name: Run Common SSH Config Generator Role include_role: - name: "infra-common-ssh-config-generate" + name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" - name: ssh workaround thing hosts: all connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -124,5 +124,5 @@ - name: set facts for remote access set_fact: - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf" diff --git a/ansible/configs/archive/rhte-ansible-net/post_software.yml b/ansible/configs/archive/rhte-ansible-net/post_software.yml index ddaa7fc1aa7..2b419864371 100644 --- a/ansible/configs/archive/rhte-ansible-net/post_software.yml +++ b/ansible/configs/archive/rhte-ansible-net/post_software.yml @@ -2,8 +2,8 @@ hosts: support gather_facts: False become: yes - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - debug: msg: "Post-Software tasks Started" @@ -14,11 +14,11 @@ become: yes tags: - opentlc_bastion_tasks - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - import_role: - name: "bastion-opentlc-ipa" + name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" when: install_ipa_client|bool # sssd bug, fixed by restart @@ -33,9 +33,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/rhte-ansible-net/pre_infra.yml b/ansible/configs/archive/rhte-ansible-net/pre_infra.yml index 52a226b11ac..52ce12dd016 100644 --- a/ansible/configs/archive/rhte-ansible-net/pre_infra.yml +++ b/ansible/configs/archive/rhte-ansible-net/pre_infra.yml @@ -3,9 +3,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -18,26 +18,26 @@ - name: Generate SSH keys when set_env_authorized_key block: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{ env_authorized_key }}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" -q -N "" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" - name: fix permission file: - path: "{{workdir_dir}}/{{ env_authorized_key }}" + path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" mode: 0400 - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{ env_authorized_key }}" > "{{workdir_dir}}/{{ env_authorized_key }}.pub" + shell: ssh-keygen -y -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" > "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}.pub" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" when: set_env_authorized_key # tested version on 2018-07-24 fc86de92080165b72906a1477e389cf0298bd499 # - name: Clone Ansible linklight repo locally - specfic commit #git: # repo: https://github.com/network-automation/linklight.git - # dest: "{{workdir_dir}}/linklight" + # dest: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight" # version: fc86de92080165b72906a1477e389cf0298bd499 @@ -47,9 +47,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: @@ -57,7 +57,7 @@ msg: "Pre-Software checks completed successfully" -- import_playbook: "{{workdir_dir}}/rhte-ansible-net/provisioner/provision_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/rhte-ansible-net/provisioner/provision_lab.yml" tags: - rnet_invoke @@ -66,9 +66,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/archive/rhte-ansible-net/pre_software.yml b/ansible/configs/archive/rhte-ansible-net/pre_software.yml index 0a7e8221c1b..1ac16bec2d3 100644 --- a/ansible/configs/archive/rhte-ansible-net/pre_software.yml +++ b/ansible/configs/archive/rhte-ansible-net/pre_software.yml @@ -5,25 +5,25 @@ - all:!windows become: true gather_facts: False - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step004 - common_tasks roles: - - { role: "set-repositories", when: 'repo_method is defined' } - - { role: "common", when: 'install_common' } - - { role: "set_env_authorized_key", when: 'set_env_authorized_key' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' } - name: Configuring Bastion Hosts hosts: bastions become: true - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" roles: - - { role: "bastion", when: 'install_bastion' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/bastion", when: 'install_bastion' } tags: - step004 - bastion_tasks @@ -34,9 +34,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: diff --git a/ansible/configs/archive/three-tier-tower/README.adoc b/ansible/configs/archive/three-tier-tower/README.adoc index 142c4237268..cf1892f38ec 100644 --- a/ansible/configs/archive/three-tier-tower/README.adoc +++ b/ansible/configs/archive/three-tier-tower/README.adoc @@ -60,7 +60,7 @@ DEPLOYER_REPO_PATH=`pwd` ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" \ -e "env_type=${ENVTYPE}" \ -e "key_name=${KEYNAME}" \ @@ -87,7 +87,7 @@ ENVTYPE="three-tier-app" CLOUDPROVIDER=ec2 #To Destroy an Env ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" \ -e "HostedZoneId=${HOSTZONEID}" -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" diff --git a/ansible/configs/archive/three-tier-tower/destroy_env.yml b/ansible/configs/archive/three-tier-tower/destroy_env.yml index 54114c2c91e..12e764192ac 100644 --- a/ansible/configs/archive/three-tier-tower/destroy_env.yml +++ b/ansible/configs/archive/three-tier-tower/destroy_env.yml @@ -1,3 +1,3 @@ --- - name: Import default destroy playbook - import_playbook: "{{workdir_dir}}/cloud_providers/{{cloud_provider}}_destroy_env.yml" + import_playbook: ../../cloud_providers/{{cloud_provider}}_destroy_env.yml diff --git a/ansible/configs/archive/three-tier-tower/env_vars.yml b/ansible/configs/archive/three-tier-tower/env_vars.yml index 7a28b44749a..6da22eba28c 100644 --- a/ansible/configs/archive/three-tier-tower/env_vars.yml +++ b/ansible/configs/archive/three-tier-tower/env_vars.yml @@ -35,7 +35,7 @@ project_tag: "{{ env_type }}-{{ guid }}" # This is where the ssh_config file will be created, this file is used to # define the communication method to all the hosts in the deployment -deploy_local_ssh_config_location: "{{workdir_dir}}/" +deploy_local_ssh_config_location: "{{output_dir}}/" install_bastion: true install_common: true diff --git a/ansible/configs/archive/three-tier-tower/pre_infra.yml b/ansible/configs/archive/three-tier-tower/pre_infra.yml index f53897e59e2..542669a9bbb 100644 --- a/ansible/configs/archive/three-tier-tower/pre_infra.yml +++ b/ansible/configs/archive/three-tier-tower/pre_infra.yml @@ -15,19 +15,19 @@ msg: "Step 000 Pre Infrastructure" - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key diff --git a/ansible/configs/bu-workshop/cleanup.yml b/ansible/configs/bu-workshop/cleanup.yml index 0e05381bfa6..cb802e61e47 100644 --- a/ansible/configs/bu-workshop/cleanup.yml +++ b/ansible/configs/bu-workshop/cleanup.yml @@ -36,28 +36,28 @@ - name: Remove SSH config file: - dest: "{{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + dest: "{{output_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" state: absent tags: - remove_ssh_config - name: Remove SSH bastion config file: - dest: "{{workdir_dir}}/ssh-config-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/ssh-config-{{ env_type }}-{{ guid }}" state: absent tags: - remove_hosts_file - name: Remove cloud template file: - dest: "{{workdir_dir}}/{{ cloud_provider }}_cloud_template.{{ env_type }}.{{ guid }}.json" + dest: "{{output_dir}}/{{ cloud_provider }}_cloud_template.{{ env_type }}.{{ guid }}.json" state: absent tags: - remove_cloud_template - name: Remove hosts file file: - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" state: absent tags: - remove_hosts_file diff --git a/ansible/configs/bu-workshop/ssh_vars.yml b/ansible/configs/bu-workshop/ssh_vars.yml index fed512a13f5..631484e4a23 100644 --- a/ansible/configs/bu-workshop/ssh_vars.yml +++ b/ansible/configs/bu-workshop/ssh_vars.yml @@ -1 +1 @@ -ansible_ssh_extra_args: "-F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf -o StrictHostKeyChecking=no" +ansible_ssh_extra_args: "-F {{output_dir}}/{{ env_type }}_{{ guid }}_ssh_conf -o StrictHostKeyChecking=no" diff --git a/ansible/configs/just-some-nodes-example/README.adoc b/ansible/configs/just-some-nodes-example/README.adoc index 96966529638..5a086cab014 100644 --- a/ansible/configs/just-some-nodes-example/README.adoc +++ b/ansible/configs/just-some-nodes-example/README.adoc @@ -67,7 +67,7 @@ DEPLOYER_REPO_PATH=`pwd` ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "cloud_provider=${CLOUDPROVIDER}" -e"key_name=ocpkey" -e"ssh_key=ocpkey"\ -e "email=sborenst@redhat.com" \ @@ -89,7 +89,7 @@ CLOUDPROVIDER=ec2 DEPLOYER_REPO_PATH=`pwd` #To Destroy an Env ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" ---- diff --git a/ansible/configs/just-some-nodes-example/destroy_env.yml b/ansible/configs/just-some-nodes-example/destroy_env.yml index 7a5389c5709..6af8600d1d9 100644 --- a/ansible/configs/just-some-nodes-example/destroy_env.yml +++ b/ansible/configs/just-some-nodes-example/destroy_env.yml @@ -1,3 +1,4 @@ +--- - import_playbook: ../../include_vars.yml - name: Delete Infrastructure diff --git a/ansible/configs/just-some-nodes-example/env_vars.yml b/ansible/configs/just-some-nodes-example/env_vars.yml index 9c4f61f06d1..acab2738fd6 100644 --- a/ansible/configs/just-some-nodes-example/env_vars.yml +++ b/ansible/configs/just-some-nodes-example/env_vars.yml @@ -122,7 +122,7 @@ software_to_deploy: none ###V2WORK, these should just be set as default listed in the documentation # This is where the ssh_config file will be created, this file is used to # define the communication method to all the hosts in the deployment -deploy_local_ssh_config_location: "{{workdir_dir}}/" +deploy_local_ssh_config_location: "{{output_dir}}/" ### If you want a Key Pair name created and injected into the hosts, diff --git a/ansible/configs/linklight-foundations/README.adoc b/ansible/configs/linklight-foundations/README.adoc index 339f6e322c8..1b68f9f12fa 100644 --- a/ansible/configs/linklight-foundations/README.adoc +++ b/ansible/configs/linklight-foundations/README.adoc @@ -42,7 +42,7 @@ $ mydeploy-script.sh --student_workloads=linklight_engine --more_args ... [source,bash] ---- ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ ..... args omitted for brevity -e @configs/linklight/linklight_all_vars.yml \ @@ -114,10 +114,10 @@ STUDENT_WORKLOADS=foundations_engine #foundations_networking_v2_allcisco #foundations_tower -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ -e env_type=${ENVTYPE} \ -e project_tag=${ENVTYPE}-${GUID} \ @@ -159,10 +159,10 @@ STUDENT_WORKLOADS=foundations_engine EC2_NAME_PREFIX=${GUID} EC2_REGION=us-east-1 -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) -ansible-playbook ${ANSIBLE_REPO_PATH | default('.')}/configs/${ENV_TYPE}/destroy_env.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ +ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e ec2_name_prefix=${GUID} \ -e ec2_region=${EC2_REGION} \ -e @configs/${ENVTYPE}/lab_vars/foundations_all_vars.yml \ diff --git a/ansible/configs/linklight-foundations/destroy_env.yml b/ansible/configs/linklight-foundations/destroy_env.yml index f8f083c0331..c39370bcb7c 100644 --- a/ansible/configs/linklight-foundations/destroy_env.yml +++ b/ansible/configs/linklight-foundations/destroy_env.yml @@ -3,8 +3,8 @@ connection: local gather_facts: False become: no + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" - - - -- import_playbook: "{{workdir_dir}}/linklight-foundations/provisioner/teardown_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-foundations/provisioner/teardown_lab.yml" diff --git a/ansible/configs/linklight-foundations/post_infra.yml b/ansible/configs/linklight-foundations/post_infra.yml index 7dadff7703a..79266a58866 100644 --- a/ansible/configs/linklight-foundations/post_infra.yml +++ b/ansible/configs/linklight-foundations/post_infra.yml @@ -3,9 +3,9 @@ hosts: localhost connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -44,9 +44,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -104,19 +104,19 @@ - name: Run infra-ec2-create-inventory Role include_role: - name: "infra-ec2-create-inventory" + name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" - name: Run Common SSH Config Generator Role include_role: - name: "infra-common-ssh-config-generate" + name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" - name: ssh workaround thing hosts: all connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -124,5 +124,5 @@ - name: set facts for remote access set_fact: - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf" diff --git a/ansible/configs/linklight-foundations/post_software.yml b/ansible/configs/linklight-foundations/post_software.yml index b168ad6d99d..2b419864371 100644 --- a/ansible/configs/linklight-foundations/post_software.yml +++ b/ansible/configs/linklight-foundations/post_software.yml @@ -2,8 +2,8 @@ hosts: support gather_facts: False become: yes - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - debug: msg: "Post-Software tasks Started" @@ -14,11 +14,11 @@ become: yes tags: - opentlc_bastion_tasks - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - import_role: - name: "bastion-opentlc-ipa" + name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" when: install_ipa_client|bool # sssd bug, fixed by restart @@ -33,9 +33,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/linklight-foundations/pre_infra.yml b/ansible/configs/linklight-foundations/pre_infra.yml index 737552d1246..7ffd0d6968e 100644 --- a/ansible/configs/linklight-foundations/pre_infra.yml +++ b/ansible/configs/linklight-foundations/pre_infra.yml @@ -3,9 +3,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -18,19 +18,19 @@ - name: Generate SSH keys when set_env_authorized_key block: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{ env_authorized_key }}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" -q -N "" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" - name: fix permission file: - path: "{{workdir_dir}}/{{ env_authorized_key }}" + path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" mode: 0400 - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{ env_authorized_key }}" > "{{workdir_dir}}/{{ env_authorized_key }}.pub" + shell: ssh-keygen -y -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" > "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}.pub" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" when: set_env_authorized_key - name: PreSoftware flight-check @@ -38,16 +38,16 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: - debug: msg: "Pre-Software checks completed successfully" -- import_playbook: "{{workdir_dir}}/linklight-foundations/provisioner/provision_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight-foundations/provisioner/provision_lab.yml" tags: - linklight_provision @@ -56,9 +56,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check diff --git a/ansible/configs/linklight-foundations/pre_software.yml b/ansible/configs/linklight-foundations/pre_software.yml index a358b70d8cb..1ac16bec2d3 100644 --- a/ansible/configs/linklight-foundations/pre_software.yml +++ b/ansible/configs/linklight-foundations/pre_software.yml @@ -5,25 +5,25 @@ - all:!windows become: true gather_facts: False - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step004 - common_tasks roles: - - { role: "set-repositories", when: 'repo_method is defined' } - - { role: "common", when: 'install_common' } - - { role: "set_env_authorized_key", when: 'set_env_authorized_key' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' } - name: Configuring Bastion Hosts hosts: bastions become: true - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" roles: - - { role: "bastion", when: 'install_bastion' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/bastion", when: 'install_bastion' } tags: - step004 - bastion_tasks @@ -34,9 +34,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: diff --git a/ansible/configs/linklight/README.adoc b/ansible/configs/linklight/README.adoc index bc0b806e432..032b0eabac7 100644 --- a/ansible/configs/linklight/README.adoc +++ b/ansible/configs/linklight/README.adoc @@ -42,7 +42,7 @@ $ mydeploy-script.sh --student_workloads=linklight_engine --more_args ... [source,bash] ---- ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ ..... args omitted for brevity -e @configs/linklight/linklight_all_vars.yml \ @@ -111,10 +111,10 @@ EC2_KEYNAME=${GUID}-link STUDENT_TOTAL=2 -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) ansible-playbook main.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e guid=${GUID} \ -e env_type=${ENV_TYPE} \ -e project_tag=${ENV_TYPE}-${GUID} \ @@ -155,10 +155,10 @@ ENV_TYPE=linklight EC2_NAME_PREFIX=${GUID} EC2_REGION=us-east-1 -ANSIBLE_REPO_PATH | default('.')=$(pwd) +ANSIBLE_REPO_PATH=$(pwd) -ansible-playbook ${ANSIBLE_REPO_PATH | default('.')}/configs/${ENV_TYPE}/destroy_env.yml \ - -e ANSIBLE_REPO_PATH | default('.')=${ANSIBLE_REPO_PATH | default('.')} \ +ansible-playbook ${ANSIBLE_REPO_PATH}/configs/${ENV_TYPE}/destroy_env.yml \ + -e ANSIBLE_REPO_PATH=${ANSIBLE_REPO_PATH} \ -e ec2_name_prefix=${GUID} \ -e ec2_region=${EC2_REGION} \ -e @configs/linklight/linklight_all_vars.yml \ diff --git a/ansible/configs/linklight/destroy_env.yml b/ansible/configs/linklight/destroy_env.yml index 8489463e5ea..45e8b7f3afe 100644 --- a/ansible/configs/linklight/destroy_env.yml +++ b/ansible/configs/linklight/destroy_env.yml @@ -3,8 +3,8 @@ connection: local gather_facts: False become: no + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" - - - -- import_playbook: "{{workdir_dir}}/linklight/provisioner/teardown_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight/provisioner/teardown_lab.yml" diff --git a/ansible/configs/linklight/post_infra.yml b/ansible/configs/linklight/post_infra.yml index eeac335d82a..79266a58866 100644 --- a/ansible/configs/linklight/post_infra.yml +++ b/ansible/configs/linklight/post_infra.yml @@ -3,9 +3,9 @@ hosts: localhost connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -44,9 +44,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -104,19 +104,19 @@ - name: Run infra-ec2-create-inventory Role include_role: - name: "infra-ec2-create-inventory" + name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory" - name: Run Common SSH Config Generator Role include_role: - name: "infra-common-ssh-config-generate" + name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate" - name: ssh workaround thing hosts: all connection: local become: false - - - + vars_files: + - "./env_vars.yml" + - "./env_secret_vars.yml" tags: - step002 - post_infrastructure @@ -124,5 +124,5 @@ - name: set facts for remote access set_fact: - ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf" diff --git a/ansible/configs/linklight/post_software.yml b/ansible/configs/linklight/post_software.yml index ddaa7fc1aa7..2b419864371 100644 --- a/ansible/configs/linklight/post_software.yml +++ b/ansible/configs/linklight/post_software.yml @@ -2,8 +2,8 @@ hosts: support gather_facts: False become: yes - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - debug: msg: "Post-Software tasks Started" @@ -14,11 +14,11 @@ become: yes tags: - opentlc_bastion_tasks - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" tasks: - import_role: - name: "bastion-opentlc-ipa" + name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" when: install_ipa_client|bool # sssd bug, fixed by restart @@ -33,9 +33,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: diff --git a/ansible/configs/linklight/pre_infra.yml b/ansible/configs/linklight/pre_infra.yml index 674d42ec970..ae847bd3d35 100644 --- a/ansible/configs/linklight/pre_infra.yml +++ b/ansible/configs/linklight/pre_infra.yml @@ -3,9 +3,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step001 - pre_infrastructure @@ -18,19 +18,19 @@ - name: Generate SSH keys when set_env_authorized_key block: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{ env_authorized_key }}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" -q -N "" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" - name: fix permission file: - path: "{{workdir_dir}}/{{ env_authorized_key }}" + path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" mode: 0400 - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{ env_authorized_key }}" > "{{workdir_dir}}/{{ env_authorized_key }}.pub" + shell: ssh-keygen -y -f "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}" > "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" args: - creates: "{{workdir_dir}}/{{ env_authorized_key }}.pub" + creates: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_authorized_key }}.pub" when: set_env_authorized_key - name: PreSoftware flight-check @@ -38,16 +38,16 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: - debug: msg: "Pre-Software checks completed successfully" -- import_playbook: "{{workdir_dir}}/linklight/provisioner/provision_lab.yml" +- import_playbook: "{{ ANSIBLE_REPO_PATH }}/workdir/linklight/provisioner/provision_lab.yml" tags: - linklight_provision @@ -56,31 +56,31 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - post_flight_check tasks: - - - name: generate email content for user + + - name: generate email content for user block: - name: generate user info string for email when a workshop, create_login_page set to true, S3 bucket debug: msg: "user.info: The list of VMs for this workshop is available at:" - - name: generate S3 bucket URL for user email when ec2_region is us-east-1 + - name: generate S3 bucket URL for user email when ec2_region is us-east-1 debug: - msg: "user.info: https://s3.amazonaws.com/{{ guid }}.{{ workshop_dns_zone }}/{{ guid }}-index.html" - when: ec2_region == 'us-east-1' + msg: "user.info: https://s3.amazonaws.com/{{ guid }}.{{ workshop_dns_zone }}/{{ guid }}-index.html" + when: ec2_region == 'us-east-1' - name: generate S3 bucket URL for user email when ec2_region is NOT us-east-1 debug: - msg: "user.info: https://s3-{{ ec2_region }}.amazonaws.com/{{ guid }}.{{ workshop_dns_zone }}/{{ guid }}-index.html" - when: ec2_region != 'us-east-1' + msg: "user.info: https://s3-{{ ec2_region }}.amazonaws.com/{{ guid }}.{{ workshop_dns_zone }}/{{ guid }}-index.html" + when: ec2_region != 'us-east-1' - when: create_login_page + when: create_login_page - debug: msg: "Post-Software checks completed successfully" diff --git a/ansible/configs/linklight/pre_software.yml b/ansible/configs/linklight/pre_software.yml index 0a7e8221c1b..1ac16bec2d3 100644 --- a/ansible/configs/linklight/pre_software.yml +++ b/ansible/configs/linklight/pre_software.yml @@ -5,25 +5,25 @@ - all:!windows become: true gather_facts: False - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - step004 - common_tasks roles: - - { role: "set-repositories", when: 'repo_method is defined' } - - { role: "common", when: 'install_common' } - - { role: "set_env_authorized_key", when: 'set_env_authorized_key' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' } - name: Configuring Bastion Hosts hosts: bastions become: true - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" roles: - - { role: "bastion", when: 'install_bastion' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/bastion", when: 'install_bastion' } tags: - step004 - bastion_tasks @@ -34,9 +34,9 @@ connection: local gather_facts: false become: false - - - + vars_files: + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" + - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" tags: - flight_check tasks: diff --git a/ansible/configs/ocp-clientvm/README.adoc b/ansible/configs/ocp-clientvm/README.adoc index fa23f22b184..3803e64f982 100644 --- a/ansible/configs/ocp-clientvm/README.adoc +++ b/ansible/configs/ocp-clientvm/README.adoc @@ -40,18 +40,17 @@ You can run the playbook with the following arguments to overwrite the default v [source,bash] ---- -GUID=sborenstest2 -REGION=ap-southeast-1 +GUID=testclientvm1 +REGION=us-east-1 KEYNAME=ocpkey ENVTYPE="ocp-clientvm" CLOUDPROVIDER=ec2 -HOSTZONEID='Z3IHLWJZOU9SRT' +HOSTZONEID='Z186MFNM7DX4NF' REPO_PATH='https://admin.example.com/repos/ocp/3.9.14/' - BASESUFFIX='.example.opentlc.com' -REPO_VERSION=3.11 +REPO_VERSION=3.9 DEPLOYER_REPO_PATH=`pwd` -OSRELEASE=3.11.16 +OSRELEASE=3.9.14 ansible-playbook main.yml \ -e "guid=${GUID}" \ @@ -59,7 +58,7 @@ ansible-playbook main.yml \ -e "osrelease=${OSRELEASE}" \ -e "repo_version=${REPO_VERSION}" \ -e "docker_version=1.13.1" \ - -e "cloud_provider=${CLOUDPROVIDER}" \ + -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" \ -e "HostedZoneId=${HOSTZONEID}" \ -e "key_name=${KEYNAME}" \ @@ -67,25 +66,28 @@ ansible-playbook main.yml \ -e "clientvm_instance_type=t2.large" \ -e "email=name@example.com" \ -e "software_to_deploy=none" \ - -e "own_repo_path=${REPO_PATH}" -e"@../../secret.yml" - - - -e "ANSIBLE_REPO_PATH | default('.') | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ + -e "own_repo_path=${REPO_PATH}" ---- === Satellite version ---- -GUID=sborenstest2 -REGION=ap-southeast-1 +GUID=testclientvm1 +REGION=us-east-1 KEYNAME=ocpkey ENVTYPE="ocp-clientvm" CLOUDPROVIDER=ec2 HOSTZONEID='Z186MFNM7DX4NF' BASESUFFIX='.example.opentlc.com' -REPO_VERSION=3.11 +REPO_VERSION=3.9 DEPLOYER_REPO_PATH=`pwd` LOG_FILE=/tmp/${ENVTYPE}-${GUID}.log +IPAPASS=$5 + +if [ "$1" = "provision" ] ; then + +echo "Provisioning: ${STACK_NAME}" 1>> $LOG_FILE 2>> $LOG_FILE ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "guid=${GUID}" \ @@ -96,14 +98,14 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "HostedZoneId=${HOSTZONEID}" \ -e "subdomain_base_suffix=${BASESUFFIX}" \ -e "clientvm_instance_type=t2.large" \ -# -e "ipa_host_password=${IPAPASS}" + -e "ipa_host_password=${IPAPASS}" -e "repo_method=satellite" \ -e "repo_version=${REPO_VERSION}" \ -e "email=name@example.com" \ -e "software_to_deploy=none" \ - -e "osrelease=3.11.16" \ + -e "osrelease=3.9.14" \ -e "docker_version=1.13.1" \ - -e "ANSIBLE_REPO_PATH | default('.') | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === To Delete an environment @@ -145,4 +147,4 @@ ENVTYPE_ARGS=( -e "clientvm_instance_type=t2.large" -e "subdomain_base_suffix=.example.opentlc.com" ) ----- +---- \ No newline at end of file diff --git a/ansible/configs/ocp-clientvm/env_vars.yml b/ansible/configs/ocp-clientvm/env_vars.yml index f63cbc7f95a..c5abc6bb49f 100644 --- a/ansible/configs/ocp-clientvm/env_vars.yml +++ b/ansible/configs/ocp-clientvm/env_vars.yml @@ -1,8 +1,6 @@ ###### VARIABLES YOU SHOULD CONFIGURE FOR YOUR DEPLOYEMNT ###### OR PASS as "-e" args to ansible-playbook command - -workdir_dir: /opt/workdir ### Common Host settings repo_method: file # Other Options are: file, satellite and rhn # Do you want to run a full yum update diff --git a/ansible/configs/ocp-clientvm/pre_software.yml b/ansible/configs/ocp-clientvm/pre_software.yml index 31a77739905..4a53c40e22e 100644 --- a/ansible/configs/ocp-clientvm/pre_software.yml +++ b/ansible/configs/ocp-clientvm/pre_software.yml @@ -9,21 +9,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}//{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}//{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/ocp-gpu-single-node/README.adoc b/ansible/configs/ocp-gpu-single-node/README.adoc index 038f2fe1099..893e6bef90f 100644 --- a/ansible/configs/ocp-gpu-single-node/README.adoc +++ b/ansible/configs/ocp-gpu-single-node/README.adoc @@ -43,7 +43,7 @@ zabbix_auto_registration_pass: "XXXXX" === Add new users on the bastion -For managing users on the bastion, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : +For managing users on the bastion, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : .Default mgr_users.yml [source,yaml] @@ -99,7 +99,7 @@ ansible-playbook main.yml -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "nfs_instance_type=m3.large" -e "node_instance_count=5" \ -e "email=name@example.com" \ -e "install_idm=htpasswd" -e "software_to_deploy=openshift" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" -e "own_repo_path=${REPO_PATH}" --skip-tags=remove_self_provisioners + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" -e "own_repo_path=${REPO_PATH}" --skip-tags=remove_self_provisioners ---- @@ -134,7 +134,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "repo_method=satellite" -e "repo_version=${REPO_VERSION}" \ -e "email=name@example.com" \ -e "software_to_deploy=openshift" -e "osrelease=3.5.5.15" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === Advanced Development Workshop @@ -163,7 +163,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "nfs_instance_type=t2.large" -e "node_instance_count=${NODE_COUNT}" \ -e "install_idm=htpasswd" -e "software_to_deploy=openshift" \ -e "email=name@example.com" \ - -e "own_repo_path=${REPO_PATH}" -e"repo_method=file" -e"ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "own_repo_path=${REPO_PATH}" -e"repo_method=file" -e"ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "osrelease=${REPO_VERSION}" -e "repo_version=${REPO_VERSION}" -e "docker_version=1.12.6" \ -e install_lets_encrypt_certificates=false -e user_vols=100\ --skip-tags=remove_self_provisioners,opentlc-integration,install_zabbix @@ -203,7 +203,7 @@ REPO_VERSION=3.5 NODE_COUNT=4 NEW_NODE_COUNT=2 ansible-playbook ./configs/${ENVTYPE}/scaleup.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "HostedZoneId=${HOSTZONEID}" \ -e "bastion_instance_type=t2.large" \ -e "cloud_provider=${CLOUDPROVIDER}" \ @@ -239,7 +239,7 @@ CLOUDPROVIDER=ec2 HOSTZONEID='Z186MFNM7DX4NF' #To Destroy an Env ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" \ -e "HostedZoneId=${HOSTZONEID}" -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" ---- diff --git a/ansible/configs/ocp-gpu-single-node/destroy_env.yml b/ansible/configs/ocp-gpu-single-node/destroy_env.yml index f46ddb6981a..6af8600d1d9 100644 --- a/ansible/configs/ocp-gpu-single-node/destroy_env.yml +++ b/ansible/configs/ocp-gpu-single-node/destroy_env.yml @@ -1,13 +1,11 @@ --- +- import_playbook: ../../include_vars.yml + - name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - name: Run infra-ec2-template-destroy include_role: diff --git a/ansible/configs/ocp-gpu-single-node/post_infra.yml b/ansible/configs/ocp-gpu-single-node/post_infra.yml index 4eb168ffaf2..a77b344426b 100644 --- a/ansible/configs/ocp-gpu-single-node/post_infra.yml +++ b/ansible/configs/ocp-gpu-single-node/post_infra.yml @@ -42,7 +42,7 @@ - name: write down s3user credentials copy: - dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" + dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" content: | * S3 Bucket for registry: {{s3user}} ** S3User access key: {{s3user_access_key}} @@ -63,7 +63,7 @@ - name: write down Route53User credentials copy: - dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" + dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" content: | * Route53 User for Let's Encrypt: {{ route53user }} ** Route53User access key: {{ route53user_access_key }} diff --git a/ansible/configs/ocp-gpu-single-node/pre_software.yml b/ansible/configs/ocp-gpu-single-node/pre_software.yml index 4f0d4664015..2bf2024a9b5 100644 --- a/ansible/configs/ocp-gpu-single-node/pre_software.yml +++ b/ansible/configs/ocp-gpu-single-node/pre_software.yml @@ -100,9 +100,9 @@ # - acme_aws_secret_access_key: "{{ hostvars['localhost'].route53user_secret_access_key }}" # - acme_production: "{{ lets_encrypt_production|d(False)|bool}}" # - acme_remote_dir: "/root" -# - acme_cache_cert_file: "{{workdir_dir}}/{{guid}}.cert" -# - acme_cache_key_file: "{{workdir_dir}}/{{guid}}.key" -# - acme_cache_archive_file: "{{workdir_dir}}/{{guid}}_acme.tgz" +# - acme_cache_cert_file: "{{output_dir}}/{{guid}}.cert" +# - acme_cache_key_file: "{{output_dir}}/{{guid}}.key" +# - acme_cache_archive_file: "{{output_dir}}/{{guid}}_acme.tgz" # - acme_renew_automatically: True # - acme_force_issue: False # when: diff --git a/ansible/configs/ocp-gpu-single-node/scaleup.yml b/ansible/configs/ocp-gpu-single-node/scaleup.yml index f36edaf1d77..369674cf1cb 100644 --- a/ansible/configs/ocp-gpu-single-node/scaleup.yml +++ b/ansible/configs/ocp-gpu-single-node/scaleup.yml @@ -7,7 +7,7 @@ ################################################################################ ################################################################################ -- import_playbook: "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/pre_infra.yml" +- import_playbook: pre_infra.yml tags: - step000 - pre_infra_tasks @@ -18,7 +18,7 @@ ################################################################################# ################################################################################# -- import_playbook: "{{ ANSIBLE_REPO_PATH | default('.') }}/cloud_providers/{{ cloud_provider }}_infrastructure_deployment.yml" +- import_playbook: "../../cloud_providers/{{ cloud_provider }}_infrastructure_deployment.yml" tags: - step001 - deploy_infrastructure @@ -28,8 +28,6 @@ connection: local gather_facts: false become: false - - tasks: - name: Assert new_node_instance_count and node_instance_count are setup properly. tags: assert_new_node @@ -48,7 +46,7 @@ ################################################################################# ################################################################################# -- import_playbook: "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/post_infra.yml" +- import_playbook: post_infra.yml tags: - step002 - post_infra_tasks @@ -66,9 +64,6 @@ - "newnodes" become: true gather_facts: False - - - tags: - step004 - common_tasks @@ -83,9 +78,6 @@ connection: local gather_facts: false become: false - - - tags: - flight_check tasks: @@ -97,14 +89,10 @@ - name: Configuring openshift-nodes gather_facts: False become: yes - - - - hosts: - - "newnodes" + - newnodes roles: - - "openshift-node" + - host-ocp-node tags: - openshift_node_tasks @@ -112,23 +100,20 @@ hosts: bastions become: true gather_facts: False - - - tags: - openshift_host_templates tasks: - - name: generate ansible hosts file, keep it under workdir_dir + - name: generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.j2" - dest: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: - generate_ansible_hosts_file - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/scaleup_hosts ## Run Scaleup playbook @@ -137,8 +122,6 @@ gather_facts: False become: yes hosts: bastions[0] - - tags: - installing_openshift ## Change to scale up, and change inventory file @@ -201,10 +184,10 @@ msg: "WARNING: s3user credentials not set" when: s3user_access_key is not defined - - name: generate ansible hosts file, keep it under workdir_dir + - name: generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: @@ -212,6 +195,6 @@ - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/hosts-{{ project_tag }}" + src: "{{output_dir}}/hosts-{{ project_tag }}" dest: /etc/ansible/hosts backup: yes diff --git a/ansible/configs/ocp-ha-disconnected-lab/README.adoc b/ansible/configs/ocp-ha-disconnected-lab/README.adoc index 4094ecbb744..86a717e0500 100644 --- a/ansible/configs/ocp-ha-disconnected-lab/README.adoc +++ b/ansible/configs/ocp-ha-disconnected-lab/README.adoc @@ -83,7 +83,7 @@ LOG_FILE=$(pwd)/${ENVTYPE}-${GUID}.log -e "email=name@example.com" \ -e "repo_method=file" -e "own_repo_path=${REPO_PATH}" -e "repo_version=${REPO_VERSION}" \ -e "software_to_deploy=openshift" -e "osrelease=3.6.173.0.21" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ --skip-tags=installing_openshift,get_openshift_credentials 1>> $LOG_FILE 2>> $LOG_FILE . To Delete an environment @@ -93,7 +93,7 @@ ansible-playbook \ ${DEPLOYER_REPO_PATH}/configs/${ENVTYPE}/destroy_env.yml \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" -e "HostedZoneId=${HOSTZONEID}" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" ---- @@ -141,6 +141,6 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "email=name@example.com" \ -e "repo_method=file" -e "own_repo_path=${REPO_PATH}" -e "repo_version=${REPO_VERSION}" \ -e "software_to_deploy=openshift" -e "osrelease=3.6.173.0.21" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ --skip-tags=installing_openshift,get_openshift_credentials -vv ---- diff --git a/ansible/configs/ocp-ha-disconnected-lab/destroy_env.yml b/ansible/configs/ocp-ha-disconnected-lab/destroy_env.yml index a0a70510ee8..a5588fecc47 100644 --- a/ansible/configs/ocp-ha-disconnected-lab/destroy_env.yml +++ b/ansible/configs/ocp-ha-disconnected-lab/destroy_env.yml @@ -1,31 +1,18 @@ +--- +- import_playbook: ../../include_vars.yml + - name: Starting environment deployment hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - - name: Destroy cloudformation template - cloudformation: - stack_name: "{{project_tag}}" - state: "absent" - region: "{{aws_region_final|d(aws_region)}}" - disable_rollback: false - tags: - Stack: "project {{env_type}}-{{ guid }}" - tags: [ destroying, destroy_cf_deployment ] - register: cloudformation_result - until: cloudformation_result|succeeded - retries: 5 - delay: 60 - ignore_errors: yes + - name: Run infra-ec2-template-destroy + include_role: + name: "infra-{{cloud_provider}}-template-destroy" + when: cloud_provider == 'ec2' - - name: report Cloudformation error - fail: - msg: "FAIL {{ project_tag }} Destroy Cloudformation" - when: not cloudformation_result|succeeded - tags: [ destroying, destroy_cf_deployment ] -## we need to add something to delete the env specific key. + - name: Run infra-azure-template-destroy + include_role: + name: "infra-{{cloud_provider}}-template-destroy" + when: cloud_provider == 'azure' diff --git a/ansible/configs/ocp-ha-disconnected-lab/post_software.yml b/ansible/configs/ocp-ha-disconnected-lab/post_software.yml index 5cec9ca76d0..316fff74e19 100644 --- a/ansible/configs/ocp-ha-disconnected-lab/post_software.yml +++ b/ansible/configs/ocp-ha-disconnected-lab/post_software.yml @@ -13,7 +13,7 @@ - name: Generate /etc/ansible/hosts file with lab inv template template: src: "./files/labs_hosts_template.{{ osrelease }}.j2" - dest: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" - name: Run openshift host provision on the bastion gather_facts: False @@ -52,7 +52,7 @@ tasks: - name: Copy complete inventory file to bastion /var/preserve/hosts copy: - src: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" dest: /var/preserve/hosts tags: preserve_complete_ansible_inventory @@ -64,7 +64,7 @@ - name: Copy over ansible hosts file, lab version copy: backup: no - src: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts tags: - overwrite_hosts_with_lab_hosts diff --git a/ansible/configs/ocp-ha-disconnected-lab/pre_software.yml b/ansible/configs/ocp-ha-disconnected-lab/pre_software.yml index f958da52fb4..35918526927 100644 --- a/ansible/configs/ocp-ha-disconnected-lab/pre_software.yml +++ b/ansible/configs/ocp-ha-disconnected-lab/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/ocp-ha-lab/README.adoc b/ansible/configs/ocp-ha-lab/README.adoc index e175ca55431..2ccf6032552 100644 --- a/ansible/configs/ocp-ha-lab/README.adoc +++ b/ansible/configs/ocp-ha-lab/README.adoc @@ -83,7 +83,7 @@ LOG_FILE=$(pwd)/${ENVTYPE}-${GUID}.log -e "email=name@example.com" \ -e "repo_method=file" -e "own_repo_path=${REPO_PATH}" -e "repo_version=${REPO_VERSION}" \ -e "software_to_deploy=openshift" -e "osrelease=3.6.173.0.21" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ --skip-tags=installing_openshift,get_openshift_credentials 1>> $LOG_FILE 2>> $LOG_FILE . To Delete an environment @@ -93,7 +93,7 @@ ansible-playbook \ ${DEPLOYER_REPO_PATH}/configs/${ENVTYPE}/destroy_env.yml \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" -e "HostedZoneId=${HOSTZONEID}" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" ---- diff --git a/ansible/configs/ocp-ha-lab/post_software.yml b/ansible/configs/ocp-ha-lab/post_software.yml index e676e62b806..1de3d07e386 100644 --- a/ansible/configs/ocp-ha-lab/post_software.yml +++ b/ansible/configs/ocp-ha-lab/post_software.yml @@ -10,11 +10,11 @@ - name: Generate /etc/ansible/hosts file with lab inv template template: src: "./files/labs_hosts_template.{{ osrelease }}.j2" - dest: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" - name: Generate /etc/ansible/hosts file with homework8 inv template template: src: "./files/hosts_homework8_template.{{ osrelease }}.j2" - dest: "{{workdir_dir}}/hosts_homework8-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts_homework8-{{ env_type }}-{{ guid }}" - name: Run openshift host provision on the bastion gather_facts: False @@ -47,7 +47,7 @@ tasks: - name: Copy complete inventory file to bastion /var/preserve/hosts copy: - src: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" dest: /var/preserve/hosts tags: preserve_complete_ansible_inventory @@ -59,7 +59,7 @@ - name: Copy over homework8 hosts file, lab version copy: backup: no - src: "{{workdir_dir}}/hosts_homework8-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/hosts_homework8-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts tags: - overwrite_hosts_with_hosts_homework8 @@ -67,7 +67,7 @@ - name: Copy over ansible hosts file, lab version copy: backup: no - src: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts tags: - overwrite_hosts_with_lab_hosts diff --git a/ansible/configs/ocp-ha-lab/pre_software.yml b/ansible/configs/ocp-ha-lab/pre_software.yml index 7c1efd4de40..7241ff9535c 100644 --- a/ansible/configs/ocp-ha-lab/pre_software.yml +++ b/ansible/configs/ocp-ha-lab/pre_software.yml @@ -10,21 +10,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/ocp-implementation-lab/README.adoc b/ansible/configs/ocp-implementation-lab/README.adoc index e175ca55431..2ccf6032552 100644 --- a/ansible/configs/ocp-implementation-lab/README.adoc +++ b/ansible/configs/ocp-implementation-lab/README.adoc @@ -83,7 +83,7 @@ LOG_FILE=$(pwd)/${ENVTYPE}-${GUID}.log -e "email=name@example.com" \ -e "repo_method=file" -e "own_repo_path=${REPO_PATH}" -e "repo_version=${REPO_VERSION}" \ -e "software_to_deploy=openshift" -e "osrelease=3.6.173.0.21" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ --skip-tags=installing_openshift,get_openshift_credentials 1>> $LOG_FILE 2>> $LOG_FILE . To Delete an environment @@ -93,7 +93,7 @@ ansible-playbook \ ${DEPLOYER_REPO_PATH}/configs/${ENVTYPE}/destroy_env.yml \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" -e "HostedZoneId=${HOSTZONEID}" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" ---- diff --git a/ansible/configs/ocp-implementation-lab/destroy_env.yml b/ansible/configs/ocp-implementation-lab/destroy_env.yml index 432e278fe64..a5588fecc47 100644 --- a/ansible/configs/ocp-implementation-lab/destroy_env.yml +++ b/ansible/configs/ocp-implementation-lab/destroy_env.yml @@ -1,31 +1,18 @@ +--- +- import_playbook: ../../include_vars.yml + - name: Starting environment deployment hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - - name: Destroy cloudformation template - cloudformation: - stack_name: "{{project_tag}}" - state: "absent" - region: "{{aws_region_final|d(aws_region)}}" - disable_rollback: false - tags: - Stack: "project {{env_type}}-{{ guid }}" - tags: [ destroying, destroy_cf_deployment ] - register: cloudformation_result - until: cloudformation_result|succeeded - retries: 5 - delay: 60 - ignore_errors: yes + - name: Run infra-ec2-template-destroy + include_role: + name: "infra-{{cloud_provider}}-template-destroy" + when: cloud_provider == 'ec2' - - name: report Cloudformation error - fail: - msg: "FAIL {{ project_tag }} Destroy Cloudformation" - when: not cloudformation_result|succeeded - tags: [ destroying, destroy_cf_deployment ] -## we need to add something to delete the env specific key. + - name: Run infra-azure-template-destroy + include_role: + name: "infra-{{cloud_provider}}-template-destroy" + when: cloud_provider == 'azure' diff --git a/ansible/configs/ocp-implementation-lab/post_software.yml b/ansible/configs/ocp-implementation-lab/post_software.yml index eb625be9d63..70e44ce60eb 100644 --- a/ansible/configs/ocp-implementation-lab/post_software.yml +++ b/ansible/configs/ocp-implementation-lab/post_software.yml @@ -13,7 +13,7 @@ - name: Generate /etc/ansible/hosts file with lab hosts template template: src: "./files/labs_hosts_template.j2" - dest: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" - name: Configure NFS host for user-vols if required hosts: support @@ -47,7 +47,7 @@ - name: Copy over ansible hosts file, lab version copy: backup: no - src: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts tags: - overwrite_hosts_with_lab_hosts diff --git a/ansible/configs/ocp-implementation-lab/pre_software.yml b/ansible/configs/ocp-implementation-lab/pre_software.yml index ae21b1d985a..1b01252f6fd 100644 --- a/ansible/configs/ocp-implementation-lab/pre_software.yml +++ b/ansible/configs/ocp-implementation-lab/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/ocp-multi-cloud-example/README.adoc b/ansible/configs/ocp-multi-cloud-example/README.adoc index db5d8e9168b..1c6cc90b8f7 100644 --- a/ansible/configs/ocp-multi-cloud-example/README.adoc +++ b/ansible/configs/ocp-multi-cloud-example/README.adoc @@ -43,7 +43,7 @@ zabbix_auto_registration_pass: "XXXXX" === Add new users on the bastion -For managing users on the bastion, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : +For managing users on the bastion, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : .Default mgr_users.yml [source,yaml] @@ -100,7 +100,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "nfs_instance_type=t2.large" -e "node_instance_count=${NODE_COUNT}" \ -e "install_idm=htpasswd" -e "software_to_deploy=openshift" \ -e "email=sborenst@redhat.com" \ - -e "own_repo_path=${REPO_PATH}" -e"repo_method=file" -e"ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "own_repo_path=${REPO_PATH}" -e"repo_method=file" -e"ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "osrelease=${REPO_VERSION}" -e "repo_version=${REPO_VERSION}" -e "docker_version=1.13.1" \ -e install_lets_encrypt_certificates=false -e user_vols=100\ --tags=step000,step001,step002,step003 @@ -116,7 +116,7 @@ CLOUDPROVIDER=ec2 HOSTZONEID='Z186MFNM7DX4NF' #To Destroy an Env ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" \ -e "HostedZoneId=${HOSTZONEID}" -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" ---- diff --git a/ansible/configs/ocp-multi-cloud-example/destroy_env.yml b/ansible/configs/ocp-multi-cloud-example/destroy_env.yml index 2c57291b6dd..6af8600d1d9 100644 --- a/ansible/configs/ocp-multi-cloud-example/destroy_env.yml +++ b/ansible/configs/ocp-multi-cloud-example/destroy_env.yml @@ -1,13 +1,11 @@ --- +- import_playbook: ../../include_vars.yml + - name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - name: Run infra-ec2-template-destroy include_role: diff --git a/ansible/configs/ocp-multi-cloud-example/env_tests.yml b/ansible/configs/ocp-multi-cloud-example/env_tests.yml index 798b77c833a..b7323f6f2fa 100644 --- a/ansible/configs/ocp-multi-cloud-example/env_tests.yml +++ b/ansible/configs/ocp-multi-cloud-example/env_tests.yml @@ -1,16 +1,13 @@ +--- ######################### env-specific specific +- import_playbook: ../../include_vars.yml - name: ocp-workshop tests hosts: masters[0] become: yes - - - "./{{ env_type }}_vars.yml" - - "./{{ env_type }}_secret_vars.yml" - tags: [ env-specific, cf_integration ] tasks: - -## This need to be completed + ## This need to be completed - name: Can authenticate at the master console with admin user shell: "oc login master.{{subdomain_base}} -u {{admin_user}} -p {{admin_user_password}} --insecure-skip-tls-verify=true" diff --git a/ansible/configs/ocp-multi-cloud-example/packer.adoc b/ansible/configs/ocp-multi-cloud-example/packer.adoc index cc5792288cb..4d4122a480e 100644 --- a/ansible/configs/ocp-multi-cloud-example/packer.adoc +++ b/ansible/configs/ocp-multi-cloud-example/packer.adoc @@ -5,7 +5,7 @@ You will find a packer file `packer.json`. To create the image for a specific version: ---- -packer build -var-file=~/secrets/rhte.json -var "ANSIBLE_REPO_PATH | default('.')=$(pwd)/../../" -var own_repo_path=http://... packer.json +packer build -var-file=~/secrets/rhte.json -var "ANSIBLE_REPO_PATH=$(pwd)/../../" -var own_repo_path=http://... packer.json ---- diff --git a/ansible/configs/ocp-multi-cloud-example/post_infra.yml b/ansible/configs/ocp-multi-cloud-example/post_infra.yml index abbb99dc395..6a1e7fac761 100644 --- a/ansible/configs/ocp-multi-cloud-example/post_infra.yml +++ b/ansible/configs/ocp-multi-cloud-example/post_infra.yml @@ -43,7 +43,7 @@ # # - name: write down s3user credentials # copy: -# dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" +# dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" # content: | # * S3 Bucket for registry: {{s3user}} # ** S3User access key: {{s3user_access_key}} @@ -64,7 +64,7 @@ # # - name: write down Route53User credentials # copy: -# dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" +# dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" # content: | # * Route53 User for Let's Encrypt: {{ route53user }} # ** Route53User access key: {{ route53user_access_key }} diff --git a/ansible/configs/ocp-multi-cloud-example/scaleup.yml b/ansible/configs/ocp-multi-cloud-example/scaleup.yml index 1c3ebf59405..8ed9008d081 100644 --- a/ansible/configs/ocp-multi-cloud-example/scaleup.yml +++ b/ansible/configs/ocp-multi-cloud-example/scaleup.yml @@ -118,17 +118,17 @@ tags: - openshift_host_templates tasks: - - name: generate ansible hosts file, keep it under workdir_dir + - name: generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.j2" - dest: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: - generate_ansible_hosts_file - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/scaleup_hosts ## Run Scaleup playbook @@ -201,10 +201,10 @@ msg: "WARNING: s3user credentials not set" when: s3user_access_key is not defined - - name: generate ansible hosts file, keep it under workdir_dir + - name: generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: @@ -212,6 +212,6 @@ - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/hosts-{{ project_tag }}" + src: "{{output_dir}}/hosts-{{ project_tag }}" dest: /etc/ansible/hosts backup: yes diff --git a/ansible/configs/ocp-storage-cns/README.adoc b/ansible/configs/ocp-storage-cns/README.adoc index e175ca55431..2ccf6032552 100644 --- a/ansible/configs/ocp-storage-cns/README.adoc +++ b/ansible/configs/ocp-storage-cns/README.adoc @@ -83,7 +83,7 @@ LOG_FILE=$(pwd)/${ENVTYPE}-${GUID}.log -e "email=name@example.com" \ -e "repo_method=file" -e "own_repo_path=${REPO_PATH}" -e "repo_version=${REPO_VERSION}" \ -e "software_to_deploy=openshift" -e "osrelease=3.6.173.0.21" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ --skip-tags=installing_openshift,get_openshift_credentials 1>> $LOG_FILE 2>> $LOG_FILE . To Delete an environment @@ -93,7 +93,7 @@ ansible-playbook \ ${DEPLOYER_REPO_PATH}/configs/${ENVTYPE}/destroy_env.yml \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" -e "HostedZoneId=${HOSTZONEID}" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" ---- diff --git a/ansible/configs/ocp-storage-cns/destroy_env.yml b/ansible/configs/ocp-storage-cns/destroy_env.yml index 432e278fe64..6af8600d1d9 100644 --- a/ansible/configs/ocp-storage-cns/destroy_env.yml +++ b/ansible/configs/ocp-storage-cns/destroy_env.yml @@ -1,31 +1,18 @@ -- name: Starting environment deployment +--- +- import_playbook: ../../include_vars.yml + +- name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - - name: Destroy cloudformation template - cloudformation: - stack_name: "{{project_tag}}" - state: "absent" - region: "{{aws_region_final|d(aws_region)}}" - disable_rollback: false - tags: - Stack: "project {{env_type}}-{{ guid }}" - tags: [ destroying, destroy_cf_deployment ] - register: cloudformation_result - until: cloudformation_result|succeeded - retries: 5 - delay: 60 - ignore_errors: yes + - name: Run infra-ec2-template-destroy + include_role: + name: "infra-{{cloud_provider}}-template-destroy" + when: cloud_provider == 'ec2' - - name: report Cloudformation error - fail: - msg: "FAIL {{ project_tag }} Destroy Cloudformation" - when: not cloudformation_result|succeeded - tags: [ destroying, destroy_cf_deployment ] -## we need to add something to delete the env specific key. + - name: Run infra-azure-template-destroy + include_role: + name: "infra-{{cloud_provider}}-template-destroy" + when: cloud_provider == 'azure' diff --git a/ansible/configs/ocp-storage-cns/post_software.yml b/ansible/configs/ocp-storage-cns/post_software.yml index eb625be9d63..70e44ce60eb 100644 --- a/ansible/configs/ocp-storage-cns/post_software.yml +++ b/ansible/configs/ocp-storage-cns/post_software.yml @@ -13,7 +13,7 @@ - name: Generate /etc/ansible/hosts file with lab hosts template template: src: "./files/labs_hosts_template.j2" - dest: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" - name: Configure NFS host for user-vols if required hosts: support @@ -47,7 +47,7 @@ - name: Copy over ansible hosts file, lab version copy: backup: no - src: "{{workdir_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/labs_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts tags: - overwrite_hosts_with_lab_hosts diff --git a/ansible/configs/ocp-storage-cns/pre_software.yml b/ansible/configs/ocp-storage-cns/pre_software.yml index bff973de714..794852a25e4 100644 --- a/ansible/configs/ocp-storage-cns/pre_software.yml +++ b/ansible/configs/ocp-storage-cns/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH kseys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/ocp-workloads/ocp-workload.yml b/ansible/configs/ocp-workloads/ocp-workload.yml index 6a3a5ff0277..7dff586a448 100644 --- a/ansible/configs/ocp-workloads/ocp-workload.yml +++ b/ansible/configs/ocp-workloads/ocp-workload.yml @@ -1,9 +1,10 @@ +--- +- import_playbook: ../../include_vars.yml + - name: Deploy a workload role on a master host hosts: all become: false gather_facts: False - - tags: - step007 roles: diff --git a/ansible/configs/ocp-workshop/README.adoc b/ansible/configs/ocp-workshop/README.adoc index 38fcd445e88..01a0025c5f3 100644 --- a/ansible/configs/ocp-workshop/README.adoc +++ b/ansible/configs/ocp-workshop/README.adoc @@ -43,7 +43,7 @@ zabbix_auto_registration_pass: "XXXXX" === Add new users on the bastion -For managing users on the bastion, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : +For managing users on the bastion, you can override the `mgr_users` variable. The default is located in `{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/mgr_users.yml`, and looks like : .Default mgr_users.yml [source,yaml] @@ -99,7 +99,7 @@ ansible-playbook main.yml -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "nfs_instance_type=m3.large" -e "node_instance_count=5" \ -e "email=name@example.com" \ -e "install_idm=htpasswd" -e "software_to_deploy=openshift" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" -e "own_repo_path=${REPO_PATH}" --skip-tags=remove_self_provisioners + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" -e "own_repo_path=${REPO_PATH}" --skip-tags=remove_self_provisioners ---- @@ -134,7 +134,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "repo_method=satellite" -e "repo_version=${REPO_VERSION}" \ -e "email=name@example.com" \ -e "software_to_deploy=openshift" -e "osrelease=3.5.5.15" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === Advanced Development Workshop @@ -161,7 +161,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "nfs_instance_type=t2.large" -e "node_instance_count=${NODE_COUNT}" \ -e "install_idm=htpasswd" -e "software_to_deploy=openshift" \ -e "email=name@example.com" \ - -e "own_repo_path=${REPO_PATH}" -e"repo_method=rhn" -e"ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "own_repo_path=${REPO_PATH}" -e"repo_method=rhn" -e"ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "osrelease=3.5.5.31" -e "repo_version=${REPO_VERSION}" -e "docker_version=1.12.6" \ --skip-tags=remove_self_provisioners,opentlc-integration ---- @@ -200,7 +200,7 @@ REPO_VERSION=3.5 NODE_COUNT=4 NEW_NODE_COUNT=2 ansible-playbook ./configs/${ENVTYPE}/scaleup.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "HostedZoneId=${HOSTZONEID}" \ -e "bastion_instance_type=t2.large" \ -e "cloud_provider=${CLOUDPROVIDER}" \ diff --git a/ansible/configs/ocp-workshop/destroy_env.yml b/ansible/configs/ocp-workshop/destroy_env.yml index d0d1a33e1a8..5db8ca6b305 100644 --- a/ansible/configs/ocp-workshop/destroy_env.yml +++ b/ansible/configs/ocp-workshop/destroy_env.yml @@ -1,13 +1,11 @@ --- +- import_playbook: ../../include_vars.yml + - name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - name: Delete S3 bucket environment: @@ -35,32 +33,12 @@ - s3_result is not succeeded - cloud_provider == 'ec2' - - name: Destroy cloudformation template - cloudformation: - aws_access_key: "{{ aws_access_key_id }}" - aws_secret_key: "{{ aws_secret_access_key }}" - stack_name: "{{project_tag}}" - state: "absent" - region: "{{aws_region_final|d(aws_region)}}" - disable_rollback: false - tags: - Stack: "project {{env_type}}-{{ guid }}" - tags: [ destroying, destroy_cf_deployment ] - register: cloudformation_result - until: cloudformation_result is succeeded - retries: 5 - delay: "{{ cloudformation_retry_delay | default(60) }}" - ignore_errors: yes + - name: Run infra-ec2-template-destroy + include_role: + name: "infra-{{cloud_provider}}-template-destroy" when: cloud_provider == 'ec2' - - name: report Cloudformation error - fail: - msg: "FAIL {{ project_tag }} Destroy Cloudformation" - when: - - cloudformation_result is not succeeded - - cloud_provider == 'ec2' - tags: [ destroying, destroy_cf_deployment ] - name: Import default azure destroy playbook - import_playbook: "{{workdir_dir}}/cloud_providers/azure_destroy_env.yml" + import_playbook: ../../cloud_providers/azure_destroy_env.yml when: cloud_provider == 'azure' diff --git a/ansible/configs/ocp-workshop/env_tests.yml b/ansible/configs/ocp-workshop/env_tests.yml index 798b77c833a..5c6e7dd927a 100644 --- a/ansible/configs/ocp-workshop/env_tests.yml +++ b/ansible/configs/ocp-workshop/env_tests.yml @@ -1,12 +1,10 @@ -######################### env-specific specific +--- +- import_playbook: ../../include_vars.yml +######################### env-specific specific - name: ocp-workshop tests hosts: masters[0] become: yes - - - "./{{ env_type }}_vars.yml" - - "./{{ env_type }}_secret_vars.yml" - tags: [ env-specific, cf_integration ] tasks: diff --git a/ansible/configs/ocp-workshop/ocp_workloads.yml b/ansible/configs/ocp-workshop/ocp_workloads.yml index ceacf90b44e..4ed17f41a39 100644 --- a/ansible/configs/ocp-workshop/ocp_workloads.yml +++ b/ansible/configs/ocp-workshop/ocp_workloads.yml @@ -4,9 +4,6 @@ gather_facts: false run_once: true become: yes - - - tasks: - name: Install ocp-infra workloads when: diff --git a/ansible/configs/ocp-workshop/post_infra.yml b/ansible/configs/ocp-workshop/post_infra.yml index 823896bde57..5aafdd09521 100644 --- a/ansible/configs/ocp-workshop/post_infra.yml +++ b/ansible/configs/ocp-workshop/post_infra.yml @@ -41,7 +41,7 @@ - name: write down s3user credentials copy: - dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" + dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" content: | * S3 Bucket for registry: {{s3user}} ** S3User access key: {{s3user_access_key}} @@ -62,7 +62,7 @@ - name: write down Route53User credentials copy: - dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" + dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" content: | * Route53 User for Let's Encrypt: {{ route53user }} ** Route53User access key: {{ route53user_access_key }} diff --git a/ansible/configs/ocp-workshop/post_software.yml b/ansible/configs/ocp-workshop/post_software.yml index 9c0b84eaa47..b831917d9d4 100644 --- a/ansible/configs/ocp-workshop/post_software.yml +++ b/ansible/configs/ocp-workshop/post_software.yml @@ -130,15 +130,15 @@ hosts: bastions become: yes gather_facts: False - - - "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/mgr_users.yml" - - tags: - env-specific - cf_integration - opentlc_integration tasks: + - name: Include mgr_users vars + include_vars: + file: mgr_users.yml + - name: Configure Bastion include_role: name: "opentlc-integration" @@ -652,7 +652,7 @@ - name: Fetch the diagnostic archive and logs fetch: src: /tmp/diagnostics.tar.gz - dest: "{{workdir_dir}}/{{project_tag}}_diagnostics.tar.gz" + dest: "{{output_dir}}/{{project_tag}}_diagnostics.tar.gz" flat: true - name: Report diagnostics failure @@ -728,7 +728,7 @@ - name: Generate report template: src: "./files/ocp_report.adoc.j2" - dest: "{{workdir_dir}}/ocp_report_{{ env_type }}-{{ guid }}.adoc" + dest: "{{output_dir}}/ocp_report_{{ env_type }}-{{ guid }}.adoc" when: - ocp_report|bool - cloud_provider == 'ec2' diff --git a/ansible/configs/ocp-workshop/pre_software.yml b/ansible/configs/ocp-workshop/pre_software.yml index 3e85bc290cd..f6a9b67caf8 100644 --- a/ansible/configs/ocp-workshop/pre_software.yml +++ b/ansible/configs/ocp-workshop/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} @@ -86,10 +86,10 @@ - acme_aws_secret_access_key: "{{ hostvars['localhost'].route53user_secret_access_key }}" - acme_production: "{{ lets_encrypt_production|d(False)|bool}}" - acme_remote_dir: "/root" - - acme_cache_cert_file: "{{workdir_dir}}/{{guid}}.cert" - - acme_cache_key_file: "{{workdir_dir}}/{{guid}}.key" - - acme_cache_archive_file: "{{workdir_dir}}/{{guid}}_acme.tgz" - - acme_cache_ca_file: "{{workdir_dir}}/{{guid}}_ca.cert" + - acme_cache_cert_file: "{{output_dir}}/{{guid}}.cert" + - acme_cache_key_file: "{{output_dir}}/{{guid}}.key" + - acme_cache_archive_file: "{{output_dir}}/{{guid}}_acme.tgz" + - acme_cache_ca_file: "{{output_dir}}/{{guid}}_ca.cert" - acme_renew_automatically: True - acme_force_issue: False when: diff --git a/ansible/configs/ocp-workshop/scaleup.yml b/ansible/configs/ocp-workshop/scaleup.yml index 5bfdcc169c0..eb337923c22 100644 --- a/ansible/configs/ocp-workshop/scaleup.yml +++ b/ansible/configs/ocp-workshop/scaleup.yml @@ -21,7 +21,7 @@ ################################################################################# ################################################################################# -- import_playbook: "{{ ANSIBLE_REPO_PATH | default('.') }}/cloud_providers/{{ cloud_provider }}_infrastructure_deployment.yml" +- import_playbook: "../../cloud_providers/{{ cloud_provider }}_infrastructure_deployment.yml" tags: - step001 - deploy_infrastructure @@ -91,9 +91,9 @@ gather_facts: False become: yes hosts: - - "newnodes" + - newnodes roles: - - "host-ocp-node" + - host-ocp-node tags: - openshift_node_tasks @@ -104,17 +104,17 @@ tags: - openshift_host_templates tasks: - - name: Generate ansible hosts file, keep it under workdir_dir + - name: Generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.{{ osrelease }}.j2" - dest: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: - generate_ansible_hosts_file - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/scaleup_hosts ## Run Scaleup playbook @@ -201,10 +201,10 @@ msg: "WARNING: s3user credentials not set" when: s3user_access_key is not defined - - name: generate ansible hosts file, keep it under workdir_dir + - name: generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.{{ osrelease }}.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: @@ -212,6 +212,6 @@ - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/hosts-{{ project_tag }}" + src: "{{output_dir}}/hosts-{{ project_tag }}" dest: /etc/ansible/hosts backup: yes diff --git a/ansible/configs/ocp4-coreos-deployer/README.adoc b/ansible/configs/ocp4-coreos-deployer/README.adoc index a107d9bc219..b44d426cfa2 100644 --- a/ansible/configs/ocp4-coreos-deployer/README.adoc +++ b/ansible/configs/ocp4-coreos-deployer/README.adoc @@ -66,7 +66,7 @@ ansible-playbook main.yml \ -e "clientvm_instance_type=t2.small" \ -e "email=name@example.com" \ -e "software_to_deploy=none" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" # -e "own_repo_path=${REPO_PATH}" @@ -107,7 +107,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "software_to_deploy=none" \ -e "osrelease=3.9.14" \ -e "docker_version=1.13.1" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === To Delete an environment diff --git a/ansible/configs/ocp4-coreos-deployer/destroy_env.yml b/ansible/configs/ocp4-coreos-deployer/destroy_env.yml index 2b897fd3293..7e0c3036804 100644 --- a/ansible/configs/ocp4-coreos-deployer/destroy_env.yml +++ b/ansible/configs/ocp4-coreos-deployer/destroy_env.yml @@ -1,15 +1,2 @@ --- -- name: Delete Infrastructure - hosts: localhost - connection: local - gather_facts: False - become: no - - - - - tasks: - - debug: - msg: Deleting Infrastructure - - import_playbook: "../../cloud_providers/ec2_destroy_env.yml" diff --git a/ansible/configs/ocp4-coreos-deployer/pre_software.yml b/ansible/configs/ocp4-coreos-deployer/pre_software.yml index d6b6447cb70..4cff10583cc 100644 --- a/ansible/configs/ocp4-coreos-deployer/pre_software.yml +++ b/ansible/configs/ocp4-coreos-deployer/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/quay-enterprise/README.adoc b/ansible/configs/quay-enterprise/README.adoc index 6dec9c70a2e..1765432f418 100644 --- a/ansible/configs/quay-enterprise/README.adoc +++ b/ansible/configs/quay-enterprise/README.adoc @@ -69,7 +69,7 @@ ansible-playbook main.yml \ -e "clientvm_instance_type=t2.large" \ -e "email=name@example.com" \ -e "software_to_deploy=none" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "own_repo_path=${REPO_PATH}" ---- @@ -108,7 +108,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "software_to_deploy=none" \ -e "osrelease=3.9.14" \ -e "docker_version=1.13.1" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === To Delete an environment diff --git a/ansible/configs/quay-enterprise/env_vars.yml b/ansible/configs/quay-enterprise/env_vars.yml index 27a96ba655c..6354bbbd80d 100644 --- a/ansible/configs/quay-enterprise/env_vars.yml +++ b/ansible/configs/quay-enterprise/env_vars.yml @@ -44,8 +44,8 @@ qe_quay_ssl_lets_encrypt_certs: False qe_quay_ssl_lets_encrypt_production: False qe_quay_ssl_lets_encrypt_force_renew: False qe_quay_ssl_lets_encrypt_renew_automatically: False -#qe_quay_ssl_key_file: "{{workdir_dir}}/{{guid}}.key" -#qe_quay_ssl_cert_file: "{{workdir_dir}}/{{guid}}.cert" +#qe_quay_ssl_key_file: "{{output_dir}}/{{guid}}.key" +#qe_quay_ssl_cert_file: "{{output_dir}}/{{guid}}.cert" # qe_quay_superuser_username: quayadmin # qe_quay_superuser_password: quaypwd # qe_quay_superuser_email: quayadmin@dummy.com diff --git a/ansible/configs/quay-enterprise/pre_software.yml b/ansible/configs/quay-enterprise/pre_software.yml index 11d0e2d62a0..4c286f7781b 100644 --- a/ansible/configs/quay-enterprise/pre_software.yml +++ b/ansible/configs/quay-enterprise/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/quay-enterprise/software.yml b/ansible/configs/quay-enterprise/software.yml index 690666d261d..a722abed0c0 100644 --- a/ansible/configs/quay-enterprise/software.yml +++ b/ansible/configs/quay-enterprise/software.yml @@ -63,16 +63,16 @@ vars: - acme_domain: "{{ qe_quay_hostname }}.{{ subdomain_base }}" - acme_remote_dir: "/root" - - acme_cache_cert_file: "{{workdir_dir}}/{{guid}}.cert" - - acme_cache_key_file: "{{workdir_dir}}/{{guid}}.key" - - acme_cache_archive_file: "{{workdir_dir}}/{{guid}}_acme.tgz" + - acme_cache_cert_file: "{{output_dir}}/{{guid}}.cert" + - acme_cache_key_file: "{{output_dir}}/{{guid}}.key" + - acme_cache_archive_file: "{{output_dir}}/{{guid}}_acme.tgz" - acme_production: "{{ qe_quay_ssl_lets_encrypt_production|d(False)|bool }}" - acme_renew_automatically: "{{ qe_quay_ssl_lets_encrypt_renew_automatically|d(False)|bool }}" - acme_force_issue: "{{ qe_quay_ssl_lets_encrypt_force_renew|d(False)|bool }}" - name: Set Cert/Key file locations to cached locations set_fact: - qe_quay_ssl_key_file: "{{workdir_dir}}/{{guid}}.key" - qe_quay_ssl_cert_file: "{{workdir_dir}}/{{guid}}.cert" + qe_quay_ssl_key_file: "{{output_dir}}/{{guid}}.key" + qe_quay_ssl_cert_file: "{{output_dir}}/{{guid}}.cert" - name: Set up Node Software (Docker) hosts: @@ -204,7 +204,7 @@ tasks: - name: Set Clair SSL Certificate set_fact: - qe_quay_ssl_cert_file: "{{workdir_dir}}/{{guid}}.cert" + qe_quay_ssl_cert_file: "{{output_dir}}/{{guid}}.cert" when: - qe_quay_ssl_lets_encrypt_certs|d(False)|bool - name: Set SSL Certificate to self signed certificate if no certificate file specified diff --git a/ansible/configs/rhte-lb/README.adoc b/ansible/configs/rhte-lb/README.adoc index 3619bb572b2..3803e64f982 100644 --- a/ansible/configs/rhte-lb/README.adoc +++ b/ansible/configs/rhte-lb/README.adoc @@ -66,7 +66,7 @@ ansible-playbook main.yml \ -e "clientvm_instance_type=t2.large" \ -e "email=name@example.com" \ -e "software_to_deploy=none" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "own_repo_path=${REPO_PATH}" ---- @@ -105,7 +105,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "software_to_deploy=none" \ -e "osrelease=3.9.14" \ -e "docker_version=1.13.1" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === To Delete an environment diff --git a/ansible/configs/rhte-lb/pre_software.yml b/ansible/configs/rhte-lb/pre_software.yml index 8d0da6de2aa..8b021cb528c 100644 --- a/ansible/configs/rhte-lb/pre_software.yml +++ b/ansible/configs/rhte-lb/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/rhte-oc-cluster-vms/README.adoc b/ansible/configs/rhte-oc-cluster-vms/README.adoc index 3619bb572b2..3803e64f982 100644 --- a/ansible/configs/rhte-oc-cluster-vms/README.adoc +++ b/ansible/configs/rhte-oc-cluster-vms/README.adoc @@ -66,7 +66,7 @@ ansible-playbook main.yml \ -e "clientvm_instance_type=t2.large" \ -e "email=name@example.com" \ -e "software_to_deploy=none" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "own_repo_path=${REPO_PATH}" ---- @@ -105,7 +105,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "software_to_deploy=none" \ -e "osrelease=3.9.14" \ -e "docker_version=1.13.1" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === To Delete an environment diff --git a/ansible/configs/rhte-oc-cluster-vms/pre_software.yml b/ansible/configs/rhte-oc-cluster-vms/pre_software.yml index 8d0da6de2aa..8b021cb528c 100644 --- a/ansible/configs/rhte-oc-cluster-vms/pre_software.yml +++ b/ansible/configs/rhte-oc-cluster-vms/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} diff --git a/ansible/configs/rhte-ocp-workshop/README.adoc b/ansible/configs/rhte-ocp-workshop/README.adoc index 936e517985e..d2f5753d5b4 100644 --- a/ansible/configs/rhte-ocp-workshop/README.adoc +++ b/ansible/configs/rhte-ocp-workshop/README.adoc @@ -69,7 +69,7 @@ ansible-playbook main.yml -e "guid=${GUID}" -e "env_type=${ENVTYPE}" \ -e "nfs_instance_type=m3.large" -e "node_instance_count=5" \ -e "email=name@example.com" \ -e "install_idm=htpasswd" -e "software_to_deploy=openshift" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" -e "own_repo_path=${REPO_PATH}" --skip-tags=remove_self_provisioners + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" -e "own_repo_path=${REPO_PATH}" --skip-tags=remove_self_provisioners ---- @@ -104,7 +104,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "repo_method=satellite" -e "repo_version=${REPO_VERSION}" \ -e "email=name@example.com" \ -e "software_to_deploy=openshift" -e "osrelease=3.5.5.15" -e "docker_version=1.12.6" \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" 1>> $LOG_FILE 2>> $LOG_FILE ---- === Advanced Development Workshop @@ -131,7 +131,7 @@ ansible-playbook ${DEPLOYER_REPO_PATH}/main.yml \ -e "nfs_instance_type=t2.large" -e "node_instance_count=${NODE_COUNT}" \ -e "install_idm=htpasswd" -e "software_to_deploy=openshift" \ -e "email=name@example.com" \ - -e "own_repo_path=${REPO_PATH}" -e"repo_method=rhn" -e"ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "own_repo_path=${REPO_PATH}" -e"repo_method=rhn" -e"ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "osrelease=3.5.5.31" -e "repo_version=${REPO_VERSION}" -e "docker_version=1.12.6" \ --skip-tags=remove_self_provisioners,opentlc-integration ---- @@ -170,7 +170,7 @@ REPO_VERSION=3.5 NODE_COUNT=4 NEW_NODE_COUNT=2 ansible-playbook ./configs/${ENVTYPE}/scaleup.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "HostedZoneId=${HOSTZONEID}" \ -e "bastion_instance_type=t2.large" \ -e "cloud_provider=${CLOUDPROVIDER}" \ diff --git a/ansible/configs/rhte-ocp-workshop/destroy_env.yml b/ansible/configs/rhte-ocp-workshop/destroy_env.yml index 7309396ffad..3fd07420196 100644 --- a/ansible/configs/rhte-ocp-workshop/destroy_env.yml +++ b/ansible/configs/rhte-ocp-workshop/destroy_env.yml @@ -1,12 +1,11 @@ --- +- import_playbook: ../../include_vars.yml + - name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - environment: AWS_ACCESS_KEY_ID: "{{aws_access_key_id}}" AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}" @@ -14,7 +13,7 @@ tasks: - name: Fetch autoscaling name slurp: - src: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.AutoScalingGroupClientVM" + src: "{{output_dir}}/{{ env_type }}.{{ guid }}.AutoScalingGroupClientVM" register: asg_r ignore_errors: yes - when: asg_r is succeeded @@ -108,5 +107,5 @@ ignore_errors: yes - name: Import default azure destroy playbook - import_playbook: "{{workdir_dir}}/cloud_providers/azure_destroy_env.yml" + import_playbook: ../../cloud_providers/azure_destroy_env.yml when: cloud_provider == 'azure' diff --git a/ansible/configs/rhte-ocp-workshop/post_infra.yml b/ansible/configs/rhte-ocp-workshop/post_infra.yml index 238aed6fe43..a4bdaf829b6 100644 --- a/ansible/configs/rhte-ocp-workshop/post_infra.yml +++ b/ansible/configs/rhte-ocp-workshop/post_infra.yml @@ -33,7 +33,7 @@ - name: Write down autoscaling name copy: - dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.AutoScalingGroupClientVM" + dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.AutoScalingGroupClientVM" content: "{{cloudformation_out_final.stack_outputs.AutoScalingGroupClientVM}}" - name: Allocate and associate an EIP to the clientVMs @@ -57,13 +57,13 @@ DNS_action: UPSERT template: src: ./files/clientvms_dns.json.j2 - dest: "{{workdir_dir}}/{{env_type}}-{{guid}}_clientvms_dns.json" + dest: "{{output_dir}}/{{env_type}}-{{guid}}_clientvms_dns.json" - name: Create clientvms DNS names command: >- aws route53 change-resource-record-sets --hosted-zone-id {{HostedZoneId}} - --change-batch file:///{{workdir_dir}}/{{env_type}}-{{guid}}_clientvms_dns.json + --change-batch file:///{{output_dir}}/{{env_type}}-{{guid}}_clientvms_dns.json - name: Rename instance ec2_tag: @@ -115,7 +115,7 @@ - name: write down s3user credentials copy: - dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" + dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.s3user.credentials" content: | * S3 Bucket for registry: {{s3user}} ** S3User access key: {{s3user_access_key}} @@ -136,7 +136,7 @@ - name: write down Route53User credentials copy: - dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" + dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.route53user.credentials" content: | * Route53 User for Let's Encrypt: {{ route53user }} ** Route53User access key: {{ route53user_access_key }} diff --git a/ansible/configs/rhte-ocp-workshop/post_software.yml b/ansible/configs/rhte-ocp-workshop/post_software.yml index 65f56c158d7..7cd145e7ad2 100644 --- a/ansible/configs/rhte-ocp-workshop/post_software.yml +++ b/ansible/configs/rhte-ocp-workshop/post_software.yml @@ -100,15 +100,15 @@ hosts: bastions become: yes gather_facts: False - - - "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/mgr_users.yml" - - tags: - env-specific - cf_integration - opentlc_integration tasks: + - name: Include mgr_users vars + include_vars: + file: mgr_users.yml + - name: Configure Bastion include_role: name: "opentlc-integration" @@ -773,7 +773,7 @@ - name: Fetch the diagnostic archive and logs fetch: src: /tmp/diagnostics.tar.gz - dest: "{{workdir_dir}}/{{project_tag}}_diagnostics.tar.gz" + dest: "{{output_dir}}/{{project_tag}}_diagnostics.tar.gz" flat: true - name: Report diagnostics failure @@ -849,7 +849,7 @@ - name: Generate report template: src: "./files/ocp_report.adoc.j2" - dest: "{{workdir_dir}}/ocp_report_{{ env_type }}-{{ guid }}.adoc" + dest: "{{output_dir}}/ocp_report_{{ env_type }}-{{ guid }}.adoc" when: - ocp_report|bool - cloud_provider == 'ec2' diff --git a/ansible/configs/rhte-ocp-workshop/pre_software.yml b/ansible/configs/rhte-ocp-workshop/pre_software.yml index d1fa6b8425c..6dc30b37f87 100644 --- a/ansible/configs/rhte-ocp-workshop/pre_software.yml +++ b/ansible/configs/rhte-ocp-workshop/pre_software.yml @@ -12,21 +12,21 @@ - generate_env_keys tasks: - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key # Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }} @@ -73,9 +73,9 @@ - acme_aws_secret_access_key: "{{ hostvars['localhost'].route53user_secret_access_key }}" - acme_production: "{{ lets_encrypt_production|d(False)|bool}}" - acme_remote_dir: "/root" - - acme_cache_cert_file: "{{workdir_dir}}/{{guid}}.cert" - - acme_cache_key_file: "{{workdir_dir}}/{{guid}}.key" - - acme_cache_archive_file: "{{workdir_dir}}/{{guid}}_acme.tgz" + - acme_cache_cert_file: "{{output_dir}}/{{guid}}.cert" + - acme_cache_key_file: "{{output_dir}}/{{guid}}.key" + - acme_cache_archive_file: "{{output_dir}}/{{guid}}_acme.tgz" - acme_renew_automatically: True - acme_force_issue: False when: diff --git a/ansible/configs/rhte-ocp-workshop/scaleup.yml b/ansible/configs/rhte-ocp-workshop/scaleup.yml index 6b059d08bb0..fedb52a467b 100644 --- a/ansible/configs/rhte-ocp-workshop/scaleup.yml +++ b/ansible/configs/rhte-ocp-workshop/scaleup.yml @@ -7,7 +7,7 @@ ################################################################################ ################################################################################ -- import_playbook: "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/pre_infra.yml" +- import_playbook: pre_infra.yml tags: - step000 - pre_infra_tasks @@ -18,7 +18,7 @@ ################################################################################# ################################################################################# -- import_playbook: "{{ ANSIBLE_REPO_PATH | default('.') }}/cloud_providers/{{ cloud_provider }}_infrastructure_deployment.yml" +- import_playbook: "../../cloud_providers/{{ cloud_provider }}_infrastructure_deployment.yml" tags: - step001 - deploy_infrastructure @@ -48,7 +48,7 @@ ################################################################################# ################################################################################# -- import_playbook: "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/post_infra.yml" +- import_playbook: post_infra.yml tags: - step002 - post_infra_tasks @@ -102,9 +102,9 @@ hosts: - - "newnodes" + - newnodes roles: - - "openshift-node" + - host-ocp-node tags: - openshift_node_tasks @@ -118,17 +118,17 @@ tags: - openshift_host_templates tasks: - - name: generate ansible hosts file, keep it under workdir_dir + - name: generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.j2" - dest: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: - generate_ansible_hosts_file - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/scaleup_hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/scaleup_hosts ## Run Scaleup playbook @@ -208,10 +208,10 @@ msg: "WARNING: s3user credentials not set" when: s3user_access_key is not defined - - name: generate ansible hosts file, keep it under workdir_dir + - name: generate ansible hosts file, keep it under output_dir template: src: "./files/hosts_template.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" delegate_to: localhost become: false tags: @@ -219,6 +219,6 @@ - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/hosts-{{ project_tag }}" + src: "{{output_dir}}/hosts-{{ project_tag }}" dest: /etc/ansible/hosts backup: yes diff --git a/ansible/configs/simple-multi-cloud-example/README.adoc b/ansible/configs/simple-multi-cloud-example/README.adoc index 740c08b5ae9..547bb1aae54 100644 --- a/ansible/configs/simple-multi-cloud-example/README.adoc +++ b/ansible/configs/simple-multi-cloud-example/README.adoc @@ -58,7 +58,7 @@ DEPLOYER_REPO_PATH=`pwd` ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" \ -e "env_type=${ENVTYPE}" \ -e "key_name=${KEYNAME}" \ @@ -83,7 +83,7 @@ ENVTYPE="simple-multi-cloud-example" CLOUDPROVIDER=ec2 #To Destroy an Env ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" \ -e "HostedZoneId=${HOSTZONEID}" -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" diff --git a/ansible/configs/simple-multi-cloud-example/destroy_env.yml b/ansible/configs/simple-multi-cloud-example/destroy_env.yml index 026083c9de6..6af8600d1d9 100644 --- a/ansible/configs/simple-multi-cloud-example/destroy_env.yml +++ b/ansible/configs/simple-multi-cloud-example/destroy_env.yml @@ -1,12 +1,11 @@ +--- +- import_playbook: ../../include_vars.yml + - name: Delete Infrastructure hosts: localhost connection: local gather_facts: False become: no - - - - tasks: - name: Run infra-ec2-template-destroy include_role: diff --git a/ansible/configs/simple-multi-cloud-example/env_vars.yml b/ansible/configs/simple-multi-cloud-example/env_vars.yml index 4640475926a..2c71254a594 100644 --- a/ansible/configs/simple-multi-cloud-example/env_vars.yml +++ b/ansible/configs/simple-multi-cloud-example/env_vars.yml @@ -109,7 +109,7 @@ software_to_deploy: none ###V2WORK, these should just be set as default listed in the documentation # This is where the ssh_config file will be created, this file is used to # define the communication method to all the hosts in the deployment -deploy_local_ssh_config_location: "{{workdir_dir}}/" +deploy_local_ssh_config_location: "{{output_dir}}/" ### If you want a Key Pair name created and injected into the hosts, diff --git a/ansible/configs/simple-multi-cloud-example/pre_infra.yml b/ansible/configs/simple-multi-cloud-example/pre_infra.yml index f53897e59e2..542669a9bbb 100644 --- a/ansible/configs/simple-multi-cloud-example/pre_infra.yml +++ b/ansible/configs/simple-multi-cloud-example/pre_infra.yml @@ -15,19 +15,19 @@ msg: "Step 000 Pre Infrastructure" - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key diff --git a/ansible/configs/three-tier-app/README.adoc b/ansible/configs/three-tier-app/README.adoc index dae532b6328..602bd6f3b45 100644 --- a/ansible/configs/three-tier-app/README.adoc +++ b/ansible/configs/three-tier-app/README.adoc @@ -58,7 +58,7 @@ DEPLOYER_REPO_PATH=`pwd` ansible-playbook \ ${DEPLOYER_REPO_PATH}/main.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" \ -e "env_type=${ENVTYPE}" \ -e "key_name=${KEYNAME}" \ @@ -85,7 +85,7 @@ ENVTYPE="three-tier-app" CLOUDPROVIDER=ec2 #To Destroy an Env ansible-playbook ./configs/${ENVTYPE}/destroy_env.yml \ - -e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \ + -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \ -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" -e "aws_region=${REGION}" \ -e "HostedZoneId=${HOSTZONEID}" -e "key_name=${KEYNAME}" -e "subdomain_base_suffix=${BASESUFFIX}" diff --git a/ansible/configs/three-tier-app/destroy_env.yml b/ansible/configs/three-tier-app/destroy_env.yml index 54114c2c91e..12e764192ac 100644 --- a/ansible/configs/three-tier-app/destroy_env.yml +++ b/ansible/configs/three-tier-app/destroy_env.yml @@ -1,3 +1,3 @@ --- - name: Import default destroy playbook - import_playbook: "{{workdir_dir}}/cloud_providers/{{cloud_provider}}_destroy_env.yml" + import_playbook: ../../cloud_providers/{{cloud_provider}}_destroy_env.yml diff --git a/ansible/configs/three-tier-app/env_vars.yml b/ansible/configs/three-tier-app/env_vars.yml index 2376ba6d9fe..f3b6a8fafcd 100644 --- a/ansible/configs/three-tier-app/env_vars.yml +++ b/ansible/configs/three-tier-app/env_vars.yml @@ -35,7 +35,7 @@ project_tag: "{{ env_type }}-{{ guid }}" # This is where the ssh_config file will be created, this file is used to # define the communication method to all the hosts in the deployment -deploy_local_ssh_config_location: "{{workdir_dir}}/" +deploy_local_ssh_config_location: "{{output_dir}}/" install_bastion: true install_common: true diff --git a/ansible/configs/three-tier-app/pre_infra.yml b/ansible/configs/three-tier-app/pre_infra.yml index f53897e59e2..542669a9bbb 100644 --- a/ansible/configs/three-tier-app/pre_infra.yml +++ b/ansible/configs/three-tier-app/pre_infra.yml @@ -15,19 +15,19 @@ msg: "Step 000 Pre Infrastructure" - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key diff --git a/ansible/include_vars.yml b/ansible/include_vars.yml index f0bfe5100c4..e1ba8b0b982 100644 --- a/ansible/include_vars.yml +++ b/ansible/include_vars.yml @@ -21,7 +21,3 @@ loop: "{{ rstat_varfiles.results }}" loop_control: label: "{{ item._ansible_item_label | default(item) }}" - - name: Set ANSIBLE_REPO_PATH - set_fact: - ANSIBLE_REPO_PATH: "{{playbook_dir}}" - WORKDIR: "{{workdir_dir}}" diff --git a/ansible/main.yml b/ansible/main.yml index e7e8e0554ec..3bc4b99d13e 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -7,14 +7,9 @@ ################################################################################ ################################################################################ -# include global vars from the config -- import_playbook: include_vars.yml - -# Load galaxy roles of the config -- import_playbook: install_galaxy_roles.yml +- import_playbook: setup_runtime.yml tags: - step0000 - - galaxy_roles ################################################################################ ################################################################################ diff --git a/ansible/roles/bastion-opentlc-ipa/tasks/main.yml b/ansible/roles/bastion-opentlc-ipa/tasks/main.yml index 44d65c87ac9..31ccbfe18fb 100644 --- a/ansible/roles/bastion-opentlc-ipa/tasks/main.yml +++ b/ansible/roles/bastion-opentlc-ipa/tasks/main.yml @@ -82,7 +82,7 @@ - name: Fetch the ipa-client-logs archive fetch: src: /tmp/ipa-client-logs.tar.gz - dest: "{{workdir_dir}}/{{project_tag}}_ipa-client-logs.tar.gz" + dest: "{{output_dir}}/{{project_tag}}_ipa-client-logs.tar.gz" flat: true ignore_errors: yes diff --git a/ansible/roles/bastion/tasks/main.yml b/ansible/roles/bastion/tasks/main.yml index 225daa5684d..3c85a0170b6 100644 --- a/ansible/roles/bastion/tasks/main.yml +++ b/ansible/roles/bastion/tasks/main.yml @@ -14,7 +14,7 @@ - name: copy the environment .pem key become: true copy: - src: "{{workdir_dir}}/{{ env_authorized_key }}" + src: "{{output_dir}}/{{ env_authorized_key }}" dest: /root/.ssh/{{env_authorized_key}}.pem owner: root group: root @@ -35,14 +35,14 @@ - name: Generate host .ssh/config Template become: no - local_action: template src={{ role_path }}/files/bastion_ssh_config.j2 dest={{workdir_dir}}/ssh-config-{{ env_type }}-{{ guid }} + local_action: template src={{ role_path }}/files/bastion_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} tags: - gen_sshconfig_file - name: copy over host .ssh/config Template become: true copy: - src: "{{workdir_dir}}/ssh-config-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/ssh-config-{{ env_type }}-{{ guid }}" dest: /root/.ssh/config owner: root group: root diff --git a/ansible/roles/host-ocp-installer/tasks/main.yml b/ansible/roles/host-ocp-installer/tasks/main.yml index eb2e66c3620..14044d96026 100644 --- a/ansible/roles/host-ocp-installer/tasks/main.yml +++ b/ansible/roles/host-ocp-installer/tasks/main.yml @@ -41,7 +41,7 @@ - name: Fetch ansible.log (3.7 and earlier) fetch: src: /root/ansible.log - dest: "{{workdir_dir}}/{{project_tag}}.bastion.ansible.log" + dest: "{{output_dir}}/{{project_tag}}.bastion.ansible.log" flat: true tags: - openshift_installer @@ -80,7 +80,7 @@ - name: Fetch ansible.log for prerequisites run (3.9 and later) fetch: src: /root/ansible.log - dest: "{{workdir_dir}}/{{project_tag}}.bastion.ansible.prerequisites.log" + dest: "{{output_dir}}/{{project_tag}}.bastion.ansible.prerequisites.log" flat: true tags: - openshift_installer @@ -119,7 +119,7 @@ - name: Fetch ansible.log for deploy_cluster run (3.9 and later) fetch: src: /root/ansible.log - dest: "{{workdir_dir}}/{{project_tag}}.bastion.ansible.deploy_cluster.log" + dest: "{{output_dir}}/{{project_tag}}.bastion.ansible.deploy_cluster.log" flat: true tags: - openshift_installer diff --git a/ansible/roles/host-ocp-provisioner/tasks/main.yml b/ansible/roles/host-ocp-provisioner/tasks/main.yml index 2c20c397ed7..bfba83bc41c 100644 --- a/ansible/roles/host-ocp-provisioner/tasks/main.yml +++ b/ansible/roles/host-ocp-provisioner/tasks/main.yml @@ -7,7 +7,7 @@ - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts - name: get idm certificate diff --git a/ansible/roles/infra-azure-template-destroy/tasks/main.yml b/ansible/roles/infra-azure-template-destroy/tasks/main.yml index af39ba803da..244c08d30f2 100644 --- a/ansible/roles/infra-azure-template-destroy/tasks/main.yml +++ b/ansible/roles/infra-azure-template-destroy/tasks/main.yml @@ -1,91 +1,82 @@ - -### Do we need this block? -- name: set ENV vars for playbook - set_fact: +--- +- environment: AZURE_CLIENT_ID: "{{azure_service_principal}}" AZURE_TENANT: "{{azure_tenant}}" AZURE_SECRET: "{{azure_password}}" AZURE_SUBSCRIPTION_ID: "{{azure_subscription_id}}" # AZURE_CONFIG_DIR: create a specific config dir for this stack to allow concurrent access for 'az' command AZURE_CONFIG_DIR: "/tmp/.azure-{{project_tag}}" - -- name: Delete delegation for NS to the main DNSZone - azure_rm_dnsrecordset: - resource_group: "{{az_dnszone_resource_group|default('dns')}}" - relative_name: "{{guid}}" - zone_name: "{{HostedZoneId}}" - record_type: NS - state: absent - -- name: Destroy method resourceGroup (standalone ResourceGroup) - when: az_destroy_method|default('resource_group') == 'resource_group' block: - - name: Delete the resource group - azure_rm_resourcegroup: - name: "{{az_resource_group}}" + - name: Delete delegation for NS to the main DNSZone + azure_rm_dnsrecordset: + resource_group: "{{az_dnszone_resource_group|default('dns')}}" + relative_name: "{{guid}}" + zone_name: "{{HostedZoneId}}" + record_type: NS state: absent - force: true - tags: - - destroying - - destroy_cloud_deployment - - destroy_azure_deployment - register: azure_result - until: azure_result|succeeded - retries: 6 - delay: 10 - ignore_errors: yes - when: - - cloud_provider == 'azure' - - name: report azure error - fail: - msg: "FAIL {{ az_resource_group }} Azure delete group" - when: - - not azure_result|succeeded - - cloud_provider == 'azure' - tags: - - destroying - - destroy_cloud_deployment - - destroy_azure_deployment + - name: Destroy method resourceGroup (standalone ResourceGroup) + when: az_destroy_method|default('resource_group') == 'resource_group' + block: + - name: Delete the resource group + azure_rm_resourcegroup: + name: "{{az_resource_group}}" + state: absent + force: true + tags: + - destroying + - destroy_cloud_deployment + - destroy_azure_deployment + register: azure_result + until: azure_result|succeeded + retries: 6 + delay: 10 + ignore_errors: yes + when: + - cloud_provider == 'azure' -- name: Method destroy deployment (shared ResourceGroup) - when: az_destroy_method|default('resource_group') == 'deployment' - environment: - AZURE_CLIENT_ID: "{{azure_service_principal}}" - AZURE_TENANT: "{{azure_tenant}}" - AZURE_SECRET: "{{azure_password}}" - AZURE_SUBSCRIPTION_ID: "{{azure_subscription_id}}" - # AZURE_CONFIG_DIR: create a specific config dir for this stack to allow concurrent access - AZURE_CONFIG_DIR: "/tmp/.azure-{{project_tag}}" - block: - - set_fact: - t_dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" + - name: report azure error + fail: + msg: "FAIL {{ az_resource_group }} Azure delete group" + when: + - not azure_result|succeeded + - cloud_provider == 'azure' + tags: + - destroying + - destroy_cloud_deployment + - destroy_azure_deployment + + - name: Method destroy deployment (shared ResourceGroup) + when: az_destroy_method|default('resource_group') == 'deployment' + block: + - set_fact: + t_dest: "{{output_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" - - name: Get all resources from the deployment - command: az group deployment show --name {{env_type}}.{{guid}} --resource-group {{az_resource_group}} - changed_when: false - register: az_dep - until: az_dep|succeeded - retries: 5 + - name: Get all resources from the deployment + command: az group deployment show --name {{env_type}}.{{guid}} --resource-group {{az_resource_group}} + changed_when: false + register: az_dep + until: az_dep|succeeded + retries: 5 - - debug: - var: az_dep - verbosity: 2 + - debug: + var: az_dep + verbosity: 2 - - name: Get all resources from tag - command: az resource list --tag 'Project={{project_tag}}' - register: az_tag - retries: 5 - until: az_tag|succeeded - changed_when: false + - name: Get all resources from tag + command: az resource list --tag 'Project={{project_tag}}' + register: az_tag + retries: 5 + until: az_tag|succeeded + changed_when: false - - name: delete all resources - vars: - ids_tags: "{{ az_tag.stdout|from_json|json_query('[*].id')}}" - ids_deployment: "{{ az_dep.stdout|from_json|json_query('properties.additionalProperties.outputResources[*].id')}}" - ids: "{{ids_deployment|union(ids_tags)}}" - command: "az resource delete --ids {{ids|join(' ')}} --resource-group {{az_resource_group}}" - register: az_delete - until: az_delete|succeeded - retries: 5 - when: ids|length > 0 + - name: delete all resources + vars: + ids_tags: "{{ az_tag.stdout|from_json|json_query('[*].id')}}" + ids_deployment: "{{ az_dep.stdout|from_json|json_query('properties.additionalProperties.outputResources[*].id')}}" + ids: "{{ids_deployment|union(ids_tags)}}" + command: "az resource delete --ids {{ids|join(' ')}} --resource-group {{az_resource_group}}" + register: az_delete + until: az_delete|succeeded + retries: 5 + when: ids|length > 0 diff --git a/ansible/roles/infra-common-ssh-config-generate/tasks/main.yml b/ansible/roles/infra-common-ssh-config-generate/tasks/main.yml index 51d15eaf366..7d4e0e8a3f5 100644 --- a/ansible/roles/infra-common-ssh-config-generate/tasks/main.yml +++ b/ansible/roles/infra-common-ssh-config-generate/tasks/main.yml @@ -12,8 +12,8 @@ bastion_hostname: "{{groups['bastions'].0 }}" # This is where the ssh_config file will be created, this file is used to # define the communication method to all the hosts in the deployment - ansible_ssh_config: "{{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" - ansible_known_host: "{{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_known_hosts" + ansible_ssh_config: "{{output_dir}}/{{ env_type }}_{{ guid }}_ssh_conf" + ansible_known_host: "{{output_dir}}/{{ env_type }}_{{ guid }}_ssh_known_hosts" remote_user: "{{ remote_user_map[cloud_provider] }}" - name: Delete dedicated known_host if it exists (new deployment) diff --git a/ansible/roles/infra-ec2-template-create/tasks/main.yml b/ansible/roles/infra-ec2-template-create/tasks/main.yml index 8edaf2295d8..3491e06bc4b 100644 --- a/ansible/roles/infra-ec2-template-create/tasks/main.yml +++ b/ansible/roles/infra-ec2-template-create/tasks/main.yml @@ -45,7 +45,7 @@ region: "{{ aws_region_loop | d(aws_region) | d(region) | d('us-east-1')}}" # rollback is unreliable, it can make this task hang forever. disable_rollback: true - template: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" + template: "{{output_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" tags: "{{ cf_tags | combine(cloud_tags_final)}}" tags: - aws_infrastructure_deployment diff --git a/ansible/roles/infra-ec2-template-destroy/tasks/ec2_detect_region_tasks.yml b/ansible/roles/infra-ec2-template-destroy/tasks/ec2_detect_region_tasks.yml new file mode 100644 index 00000000000..ffa265034dc --- /dev/null +++ b/ansible/roles/infra-ec2-template-destroy/tasks/ec2_detect_region_tasks.yml @@ -0,0 +1,29 @@ +--- +# if fallback_regions is defined, detect the region +- when: fallback_regions is defined + block: + - name: fallback_regions is defined, detect region for AWS + environment: + AWS_ACCESS_KEY_ID: "{{aws_access_key_id}}" + AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}" + command: >- + aws cloudformation describe-stacks + --stack-name {{project_tag}} --region {{item}} + register: cloudformation_detect + with_items: "{{ [aws_region] + fallback_regions|d([]) }}" + changed_when: false + failed_when: false + + - name: Set aws_region_final + set_fact: + aws_region_final: "{{item._ansible_item_label}}" + with_items: "{{cloudformation_detect.results}}" + loop_control: + label: "{{item._ansible_item_label|d('unknown')}}" + when: item.rc == 0 + +# else just set as the provided aws_region +- name: Set aws_region_final as provided with aws_region + when: fallback_regions is not defined + set_fact: + aws_region_final: "{{aws_region}}" diff --git a/ansible/roles/infra-ec2-template-destroy/tasks/main.yml b/ansible/roles/infra-ec2-template-destroy/tasks/main.yml index b8e1a786981..3c8c7858377 100644 --- a/ansible/roles/infra-ec2-template-destroy/tasks/main.yml +++ b/ansible/roles/infra-ec2-template-destroy/tasks/main.yml @@ -1,4 +1,6 @@ --- +- import_tasks: ec2_detect_region_tasks.yml + - name: Destroy cloudformation template cloudformation: aws_access_key: "{{ aws_access_key_id }}" @@ -15,8 +17,8 @@ - destroy_cloud_deployment register: cloudformation_result until: cloudformation_result is succeeded - retries: 5 - delay: 60 + retries: "{{ cloudformation_retries | d(3) }}" + delay: "{{ cloudformation_retry_delay | d(60) }}" ignore_errors: yes when: cloud_provider == 'ec2' diff --git a/ansible/roles/infra-ec2-template-generate/tasks/main.yml b/ansible/roles/infra-ec2-template-generate/tasks/main.yml index 8552026744e..688ffbf03ad 100644 --- a/ansible/roles/infra-ec2-template-generate/tasks/main.yml +++ b/ansible/roles/infra-ec2-template-generate/tasks/main.yml @@ -2,7 +2,7 @@ - import_tasks: locate_template.yml - set_fact: - cloudformation_template: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" + cloudformation_template: "{{output_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template" - name: AWS Generate CloudFormation Template template: diff --git a/ansible/roles/infra-local-create-ssh_key/tasks/main.yml b/ansible/roles/infra-local-create-ssh_key/tasks/main.yml index 85afdc84263..bfa33b88e04 100644 --- a/ansible/roles/infra-local-create-ssh_key/tasks/main.yml +++ b/ansible/roles/infra-local-create-ssh_key/tasks/main.yml @@ -1,18 +1,18 @@ --- - name: Generate SSH keys - shell: ssh-keygen -b 2048 -t rsa -f "{{workdir_dir}}/{{env_authorized_key}}" -q -N "" + shell: ssh-keygen -b 2048 -t rsa -f "{{output_dir}}/{{env_authorized_key}}" -q -N "" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}" + creates: "{{output_dir}}/{{env_authorized_key}}" when: set_env_authorized_key | bool - name: fix permission file: - path: "{{workdir_dir}}/{{env_authorized_key}}" + path: "{{output_dir}}/{{env_authorized_key}}" mode: 0400 when: set_env_authorized_key | bool - name: Generate SSH pub key - shell: ssh-keygen -y -f "{{workdir_dir}}/{{env_authorized_key}}" > "{{workdir_dir}}/{{env_authorized_key}}.pub" + shell: ssh-keygen -y -f "{{output_dir}}/{{env_authorized_key}}" > "{{output_dir}}/{{env_authorized_key}}.pub" args: - creates: "{{workdir_dir}}/{{env_authorized_key}}.pub" + creates: "{{output_dir}}/{{env_authorized_key}}.pub" when: set_env_authorized_key | bool diff --git a/ansible/roles/ocp-workload-3scale-demo/readme.adoc b/ansible/roles/ocp-workload-3scale-demo/readme.adoc index 819747887c7..152a18ba542 100644 --- a/ansible/roles/ocp-workload-3scale-demo/readme.adoc +++ b/ansible/roles/ocp-workload-3scale-demo/readme.adoc @@ -79,7 +79,7 @@ bastion.cluster4.openshift.opentlc.com tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -96,7 +96,7 @@ GUID=0418 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/id_rsa" \ -e"ansible_ssh_user=opentlc-mgr" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -117,7 +117,7 @@ GUID=3005 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/id_rsa" \ -e"ansible_ssh_user=opentlc-mgr" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-3scale-experienced/readme.adoc b/ansible/roles/ocp-workload-3scale-experienced/readme.adoc index 7cee99bc372..3e161e0f537 100644 --- a/ansible/roles/ocp-workload-3scale-experienced/readme.adoc +++ b/ansible/roles/ocp-workload-3scale-experienced/readme.adoc @@ -8,13 +8,13 @@ This workload only sets a clusterquota for a student who has need to provision a GUID=user1 WORKLOAD="ocp-workload-3scale-experienced" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ -e"ACTION=create" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ -e"ACTION=remove" diff --git a/ansible/roles/ocp-workload-3scale-lifecycle/readme.adoc b/ansible/roles/ocp-workload-3scale-lifecycle/readme.adoc index 967bf2aaf92..1c72e163170 100644 --- a/ansible/roles/ocp-workload-3scale-lifecycle/readme.adoc +++ b/ansible/roles/ocp-workload-3scale-lifecycle/readme.adoc @@ -6,7 +6,7 @@ SUBDOMAIN_BASE=`oc whoami --show-server | cut -d'.' -f 2,3,4,5 | cut -d':' -f 1` # API manager provision ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=create" \ -e"subdomain_base=$SUBDOMAIN_BASE" @@ -14,7 +14,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=remove" \ -e"subdomain_base=$SUBDOMAIN_BASE" diff --git a/ansible/roles/ocp-workload-3scale-multitenant/readme.adoc b/ansible/roles/ocp-workload-3scale-multitenant/readme.adoc index 3e0e922ff20..fc9c81db9bb 100644 --- a/ansible/roles/ocp-workload-3scale-multitenant/readme.adoc +++ b/ansible/roles/ocp-workload-3scale-multitenant/readme.adoc @@ -31,7 +31,7 @@ ADM_USERNAME=api0 # API manager provision ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=create" \ -e"subdomain_base=$SUBDOMAIN_BASE" \ @@ -45,7 +45,7 @@ CREATE_GWS_WITH_EACH_TENANT=true # Tenant Management ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=tenant_mgmt" \ -e"start_tenant=$START_TENANT" \ @@ -58,7 +58,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml # Delete REMOVE_TENANTS_ONLY=true ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=remove" \ -e"subdomain_base=$SUBDOMAIN_BASE" \ diff --git a/ansible/roles/ocp-workload-amq-enmasse/readme.adoc b/ansible/roles/ocp-workload-amq-enmasse/readme.adoc index 12f82d45434..1e82f59a5ea 100644 --- a/ansible/roles/ocp-workload-amq-enmasse/readme.adoc +++ b/ansible/roles/ocp-workload-amq-enmasse/readme.adoc @@ -37,7 +37,7 @@ SSH_PRIVATE_KEY="id_ocp" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USERNAME}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -62,7 +62,7 @@ SSH_PRIVATE_KEY="id_ocp" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USERNAME}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-appdev-homework/readme.adoc b/ansible/roles/ocp-workload-appdev-homework/readme.adoc index f4c2599d6c9..aff7ea06f77 100644 --- a/ansible/roles/ocp-workload-appdev-homework/readme.adoc +++ b/ansible/roles/ocp-workload-appdev-homework/readme.adoc @@ -40,7 +40,7 @@ GUID=1001 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/keytoyourhost.pem" \ -e"ansible_ssh_user=ec2-user" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -60,7 +60,7 @@ GUID=1002 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/keytoyourhost.pem" \ -e"ansible_ssh_user=ec2-user" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -80,7 +80,7 @@ ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements diff --git a/ansible/roles/ocp-workload-appmod-migration/readme.adoc b/ansible/roles/ocp-workload-appmod-migration/readme.adoc index 1aaa9244c95..4b82e4afe33 100644 --- a/ansible/roles/ocp-workload-appmod-migration/readme.adoc +++ b/ansible/roles/ocp-workload-appmod-migration/readme.adoc @@ -7,7 +7,7 @@ WORKLOAD="ocp-workload-appmod-migration" GUID=1 OCP_USERNAME="user$GUID" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -15,7 +15,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml -e"ACTION=create" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-bxms-dm/readme.adoc b/ansible/roles/ocp-workload-bxms-dm/readme.adoc index 5d843b27ff8..08a9110d532 100644 --- a/ansible/roles/ocp-workload-bxms-dm/readme.adoc +++ b/ansible/roles/ocp-workload-bxms-dm/readme.adoc @@ -15,7 +15,7 @@ OCP_USERNAME="jbride-redhat.com" # a TARGET_HOST is specified in the command line, without using an inventory file ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ -e"ACTION=create" \ @@ -29,7 +29,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml # a TARGET_HOST is specified in the command line, without using an inventory file ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-bxms-pam/readme.adoc b/ansible/roles/ocp-workload-bxms-pam/readme.adoc index 5045192febe..ca59a29d141 100644 --- a/ansible/roles/ocp-workload-bxms-pam/readme.adoc +++ b/ansible/roles/ocp-workload-bxms-pam/readme.adoc @@ -11,7 +11,7 @@ WORKLOAD="ocp-workload-bxms-pam" GUID=jb45 ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ocp_user_needs_quota=true" \ -e"guid=$GUID" \ @@ -19,7 +19,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml -e"ocp_username=dtorresf-redhat.com" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=$GUID" \ -e"ACTION=remove" \ diff --git a/ansible/roles/ocp-workload-developer-environment/readme.adoc b/ansible/roles/ocp-workload-developer-environment/readme.adoc index f4c2599d6c9..aff7ea06f77 100644 --- a/ansible/roles/ocp-workload-developer-environment/readme.adoc +++ b/ansible/roles/ocp-workload-developer-environment/readme.adoc @@ -40,7 +40,7 @@ GUID=1001 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/keytoyourhost.pem" \ -e"ansible_ssh_user=ec2-user" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -60,7 +60,7 @@ GUID=1002 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/keytoyourhost.pem" \ -e"ansible_ssh_user=ec2-user" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -80,7 +80,7 @@ ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements diff --git a/ansible/roles/ocp-workload-dm7-qlb-demo/readme.adoc b/ansible/roles/ocp-workload-dm7-qlb-demo/readme.adoc index 45135680605..c34207fcdc8 100644 --- a/ansible/roles/ocp-workload-dm7-qlb-demo/readme.adoc +++ b/ansible/roles/ocp-workload-dm7-qlb-demo/readme.adoc @@ -40,7 +40,7 @@ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -67,7 +67,7 @@ WORKLOAD="ocp-workload-fsi-client-onboarding-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -87,7 +87,7 @@ WORKLOAD="ocp-workload-fsi-client-onboarding-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-example/readme.adoc b/ansible/roles/ocp-workload-example/readme.adoc index 4259b908d1a..25ba94df95b 100644 --- a/ansible/roles/ocp-workload-example/readme.adoc +++ b/ansible/roles/ocp-workload-example/readme.adoc @@ -41,7 +41,7 @@ GUID=1001 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/keytoyourhost.pem" \ -e"ansible_ssh_user=ec2-user" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"silent=False" \ @@ -61,7 +61,7 @@ GUID=1002 ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/keytoyourhost.pem" \ -e"ansible_ssh_user=ec2-user" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -82,7 +82,7 @@ ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements diff --git a/ansible/roles/ocp-workload-fsi-client-onboarding-demo/readme.adoc b/ansible/roles/ocp-workload-fsi-client-onboarding-demo/readme.adoc index 45135680605..c34207fcdc8 100644 --- a/ansible/roles/ocp-workload-fsi-client-onboarding-demo/readme.adoc +++ b/ansible/roles/ocp-workload-fsi-client-onboarding-demo/readme.adoc @@ -40,7 +40,7 @@ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -67,7 +67,7 @@ WORKLOAD="ocp-workload-fsi-client-onboarding-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -87,7 +87,7 @@ WORKLOAD="ocp-workload-fsi-client-onboarding-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-fuse-on-ocp/readme.adoc b/ansible/roles/ocp-workload-fuse-on-ocp/readme.adoc index 539a99ad534..ace2562ab1d 100644 --- a/ansible/roles/ocp-workload-fuse-on-ocp/readme.adoc +++ b/ansible/roles/ocp-workload-fuse-on-ocp/readme.adoc @@ -15,7 +15,7 @@ OCP_USERNAME="jbride-redhat.com" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USERNAME}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -36,7 +36,7 @@ OCP_USERNAME="jbride-redhat.com" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USERNAME}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-integreatly/readme.adoc b/ansible/roles/ocp-workload-integreatly/readme.adoc index 68ce8cc4720..4c17631cc63 100644 --- a/ansible/roles/ocp-workload-integreatly/readme.adoc +++ b/ansible/roles/ocp-workload-integreatly/readme.adoc @@ -41,7 +41,7 @@ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -68,7 +68,7 @@ WORKLOAD="ocp-workload-integreatly" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ -e"ocp_user_needs_quota=false" \ @@ -85,7 +85,7 @@ WORKLOAD="ocp-workload-integreatly" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ -e"ACTION=remove" diff --git a/ansible/roles/ocp-workload-iot-demo/readme.adoc b/ansible/roles/ocp-workload-iot-demo/readme.adoc index aa597f7c2f1..f81a96d2aea 100644 --- a/ansible/roles/ocp-workload-iot-demo/readme.adoc +++ b/ansible/roles/ocp-workload-iot-demo/readme.adoc @@ -40,7 +40,7 @@ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -70,7 +70,7 @@ WORKLOAD="ocp-workload-parksmap-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -90,7 +90,7 @@ WORKLOAD="ocp-workload-parksmap-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-istio-community/readme.adoc b/ansible/roles/ocp-workload-istio-community/readme.adoc index 46f6867fb20..a403d65149e 100644 --- a/ansible/roles/ocp-workload-istio-community/readme.adoc +++ b/ansible/roles/ocp-workload-istio-community/readme.adoc @@ -15,12 +15,12 @@ WORKLOAD="ocp-workload-istio-community" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=create" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=remove" diff --git a/ansible/roles/ocp-workload-pam-order-it-hardware/readme.adoc b/ansible/roles/ocp-workload-pam-order-it-hardware/readme.adoc index 45135680605..c34207fcdc8 100644 --- a/ansible/roles/ocp-workload-pam-order-it-hardware/readme.adoc +++ b/ansible/roles/ocp-workload-pam-order-it-hardware/readme.adoc @@ -40,7 +40,7 @@ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -67,7 +67,7 @@ WORKLOAD="ocp-workload-fsi-client-onboarding-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -87,7 +87,7 @@ WORKLOAD="ocp-workload-fsi-client-onboarding-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-parksmap-demo/readme.adoc b/ansible/roles/ocp-workload-parksmap-demo/readme.adoc index 5ddfee75300..1c68468bf84 100644 --- a/ansible/roles/ocp-workload-parksmap-demo/readme.adoc +++ b/ansible/roles/ocp-workload-parksmap-demo/readme.adoc @@ -40,7 +40,7 @@ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -67,7 +67,7 @@ WORKLOAD="ocp-workload-parksmap-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -87,7 +87,7 @@ WORKLOAD="ocp-workload-parksmap-demo" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-rhte-mw-api-biz/readme.adoc b/ansible/roles/ocp-workload-rhte-mw-api-biz/readme.adoc index 0193196eaa9..0128739739a 100644 --- a/ansible/roles/ocp-workload-rhte-mw-api-biz/readme.adoc +++ b/ansible/roles/ocp-workload-rhte-mw-api-biz/readme.adoc @@ -40,7 +40,7 @@ SUBDOMAIN_BASE=`oc whoami --show-server | cut -d'.' -f 2,3,4,5 | cut -d':' -f 1` # API manager provision ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=create" \ -e"subdomain_base=$SUBDOMAIN_BASE" @@ -53,7 +53,7 @@ END_TENANT=1 # Tenant Management ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=tenant_mgmt" \ -e"start_tenant=$START_TENANT" \ @@ -64,7 +64,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml # Delete REMOVE_TENANTS_ONLY=true ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=remove" \ -e"subdomain_base=$SUBDOMAIN_BASE" \ diff --git a/ansible/roles/ocp-workload-rhte-mw-api-mesh/readme.adoc b/ansible/roles/ocp-workload-rhte-mw-api-mesh/readme.adoc index 7f4750a0312..844f5e634e6 100644 --- a/ansible/roles/ocp-workload-rhte-mw-api-mesh/readme.adoc +++ b/ansible/roles/ocp-workload-rhte-mw-api-mesh/readme.adoc @@ -12,14 +12,14 @@ WORKLOAD="ocp-workload-rhte-mw-api-mesh" GUID=a1001 OCP_USERNAME="developer" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ -e"ACTION=create" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-rhte-mw-bfield-migration/readme.adoc b/ansible/roles/ocp-workload-rhte-mw-bfield-migration/readme.adoc index 87911751590..1f011993d90 100644 --- a/ansible/roles/ocp-workload-rhte-mw-bfield-migration/readme.adoc +++ b/ansible/roles/ocp-workload-rhte-mw-bfield-migration/readme.adoc @@ -6,13 +6,13 @@ WORKLOAD="ocp-workload-rhte-mw-bfield-migration" OCP_USERNAME="user1" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=create" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=remove" diff --git a/ansible/roles/ocp-workload-rhte-mw-msa-mesh/readme.adoc b/ansible/roles/ocp-workload-rhte-mw-msa-mesh/readme.adoc index f4d023e2a87..5a82bc8a234 100644 --- a/ansible/roles/ocp-workload-rhte-mw-msa-mesh/readme.adoc +++ b/ansible/roles/ocp-workload-rhte-mw-msa-mesh/readme.adoc @@ -13,7 +13,7 @@ GUID=1 OCP_USERNAME="user$GUID" HOST_GUID=`oc whoami --show-server | cut -d'.' -f 2` ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -21,7 +21,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml -e"ACTION=create" ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -46,7 +46,7 @@ SSH_PRIVATE_KEY="id_ocp" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USERNAME}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -70,7 +70,7 @@ SSH_PRIVATE_KEY="id_ocp" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USERNAME}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-rhte-mw-msa-orchestration/readme.adoc b/ansible/roles/ocp-workload-rhte-mw-msa-orchestration/readme.adoc index b92b28fb9cd..f4dea4bee5c 100644 --- a/ansible/roles/ocp-workload-rhte-mw-msa-orchestration/readme.adoc +++ b/ansible/roles/ocp-workload-rhte-mw-msa-orchestration/readme.adoc @@ -15,7 +15,7 @@ OCP_DOMAIN=$REGION.openshift.opentlc.com # a TARGET_HOST is specified in the command line, without using an inventory file ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -26,7 +26,7 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/ocp-workload-rhte-mw-op-intel/readme.adoc b/ansible/roles/ocp-workload-rhte-mw-op-intel/readme.adoc index 1f8490138e6..c9a30d43d00 100644 --- a/ansible/roles/ocp-workload-rhte-mw-op-intel/readme.adoc +++ b/ansible/roles/ocp-workload-rhte-mw-op-intel/readme.adoc @@ -11,7 +11,7 @@ OCP_USERNAME="jbride-redhat.com" WORKLOAD="ocp-workload-rhte-mw-op-intel" $ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ACTION=create" @@ -19,7 +19,7 @@ $ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.y $ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ACTION=remove" diff --git a/ansible/roles/ocp-workload-starter-workshop/readme.adoc b/ansible/roles/ocp-workload-starter-workshop/readme.adoc index 4e827f7ce57..0fc0b963226 100644 --- a/ansible/roles/ocp-workload-starter-workshop/readme.adoc +++ b/ansible/roles/ocp-workload-starter-workshop/readme.adoc @@ -40,7 +40,7 @@ tags: - step007 roles: - - { role: "{{ocp_workload}}", when: 'ocp_workload is defined' } + - { role: "{{ ANSIBLE_REPO_PATH }}/roles/{{ocp_workload}}", when: 'ocp_workload is defined' } ---- NOTE: You might want to change `hosts: all` to fit your requirements @@ -75,7 +75,7 @@ WORKLOAD="ocp-workload-starter-workshop" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -99,7 +99,7 @@ WORKLOAD="ocp-workload-starter-workshop" ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"admin_project=${WORKSHOP_PROJECT}" \ diff --git a/ansible/roles/ocp-workload-vertx-reactica/readme.adoc b/ansible/roles/ocp-workload-vertx-reactica/readme.adoc index 3dec703c615..72a190c169c 100644 --- a/ansible/roles/ocp-workload-vertx-reactica/readme.adoc +++ b/ansible/roles/ocp-workload-vertx-reactica/readme.adoc @@ -29,7 +29,7 @@ WORKLOAD="ocp-workload-vertx-reactica" ansible-playbook -v -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ @@ -60,7 +60,7 @@ WORKLOAD="ocp-workload-vertx-reactica" ansible-playbook -v -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_ssh_user=${SSH_USER}" \ - -e"ANSIBLE_REPO_PATH | default('.')=`pwd`" \ + -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ diff --git a/ansible/roles/set_env_authorized_key/tasks/main.yml b/ansible/roles/set_env_authorized_key/tasks/main.yml index e38d7946a1d..e0a95adfa86 100644 --- a/ansible/roles/set_env_authorized_key/tasks/main.yml +++ b/ansible/roles/set_env_authorized_key/tasks/main.yml @@ -9,7 +9,7 @@ - name: copy the environment .pem key become: true copy: - src: "{{workdir_dir}}/{{ env_authorized_key }}" + src: "{{output_dir}}/{{ env_authorized_key }}" dest: "/root/.ssh/{{env_authorized_key}}.pem" owner: root group: root @@ -20,16 +20,16 @@ authorized_key: user: "{{ansible_ssh_user}}" state: present - key: "{{ lookup('file', '{{workdir_dir}}/{{env_authorized_key}}.pub') }}" + key: "{{ lookup('file', '{{output_dir}}/{{env_authorized_key}}.pub') }}" - name: Generate host .ssh/config Template become: no - local_action: template src={{ role_path }}/files/host_ssh_config.j2 dest={{workdir_dir}}/ssh-config-{{ env_type }}-{{ guid }} + local_action: template src={{ role_path }}/files/host_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} - name: copy over host .ssh/config Template become: true copy: - src: "{{workdir_dir}}/ssh-config-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/ssh-config-{{ env_type }}-{{ guid }}" dest: /root/.ssh/config owner: root group: root diff --git a/ansible/roles/tower_demo/tasks/main.yml b/ansible/roles/tower_demo/tasks/main.yml index 77cc506138e..8535305bdbb 100644 --- a/ansible/roles/tower_demo/tasks/main.yml +++ b/ansible/roles/tower_demo/tasks/main.yml @@ -21,7 +21,7 @@ - name: copy the private key copy: - src: "{{workdir_dir}}/{{ guid + 'key' }}" + src: "{{output_dir}}/{{ guid + 'key' }}" dest: /tmp/id_rsa mode: 0640 diff --git a/ansible/setup_runtime.yml b/ansible/setup_runtime.yml new file mode 100644 index 00000000000..21c331f13a2 --- /dev/null +++ b/ansible/setup_runtime.yml @@ -0,0 +1,34 @@ +--- +- name: Step 0000 - Setup output_dir + hosts: localhost + connection: local + gather_facts: false + become: false + tasks: + - name: Set output_dir if not defined + set_fact: + output_dir: >- + {{ + ANSIBLE_REPO_PATH + '/workdir' if ANSIBLE_REPO_PATH is defined + else '/tmp/output_dir' + }} + + when: output_dir is not defined + + - name: Stat output_dir + stat: + path: "{{ output_dir }}" + register: rstat_output_dir + + - name: Create output_dir if it does not exists + file: + path: "{{ output_dir }}" + state: directory + when: not rstat_output_dir.stat.exists + +# include global vars from the config +- import_playbook: include_vars.yml + +# Load galaxy roles of the config +- import_playbook: install_galaxy_roles.yml + tags: galaxy_roles diff --git a/ansible/software_playbooks/none.yml b/ansible/software_playbooks/none.yml index 9bbed59b6d7..27fad7a5eff 100644 --- a/ansible/software_playbooks/none.yml +++ b/ansible/software_playbooks/none.yml @@ -16,7 +16,7 @@ - name: generate ansible hosts file template: src: "../configs/{{ env_type }}/files/hosts_template.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" - name: Step 00xxxxx bastion preparation for deployment hosts: bastions @@ -29,5 +29,5 @@ state: directory - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts diff --git a/ansible/software_playbooks/openshift.yml b/ansible/software_playbooks/openshift.yml index c21ac31433d..04be0214062 100644 --- a/ansible/software_playbooks/openshift.yml +++ b/ansible/software_playbooks/openshift.yml @@ -24,19 +24,19 @@ - name: generate ansible hosts file for 3.7 and earlier template: src: "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/files/hosts_template.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" when: - osrelease is version_compare('3.9', '<') - name: generate ansible hosts file for 3.9 and later template: src: "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/files/hosts_template.{{ osrelease }}.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" when: - osrelease is version_compare('3.9', '>=') - name: remove filename parameter from htpasswd authentication for 3.10+ replace: - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" regexp: ', "filename": "/etc/origin/master/htpasswd"' replace: '' when: diff --git a/ansible/software_playbooks/tower.yml b/ansible/software_playbooks/tower.yml index e6356addb8c..c324441bc14 100644 --- a/ansible/software_playbooks/tower.yml +++ b/ansible/software_playbooks/tower.yml @@ -14,11 +14,11 @@ - name: generate ansible hosts file template: src: "../configs/{{ env_type }}/files/hosts_template.j2" - dest: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" - name: generate ansible tower hosts file template: src: "../configs/{{ env_type }}/files/tower_hosts_template.j2" - dest: "{{workdir_dir}}/tower_hosts-{{ env_type }}-{{ guid }}" + dest: "{{output_dir}}/tower_hosts-{{ env_type }}-{{ guid }}" - name: Prepare bastion for Tower Deployment hosts: bastions @@ -40,12 +40,12 @@ - name: Copy over ansible hosts file copy: - src: "{{workdir_dir}}/hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/hosts-{{ env_type }}-{{ guid }}" dest: /etc/ansible/hosts - name: Copy over ansible tower hosts file copy: - src: "{{workdir_dir}}/tower_hosts-{{ env_type }}-{{ guid }}" + src: "{{output_dir}}/tower_hosts-{{ env_type }}-{{ guid }}" dest: "{{tower_inventory_path}}" - name: unarchive the latest tower software unarchive: diff --git a/tests/static/syntax-check.sh b/tests/static/syntax-check.sh index e540e55dcbd..a67a0c52fb5 100755 --- a/tests/static/syntax-check.sh +++ b/tests/static/syntax-check.sh @@ -6,6 +6,8 @@ ORIG=$(cd $(dirname $0); cd ../..; pwd) ansible_path=${ORIG}/ansible static=${ORIG}/tests/static +cd ${ORIG} + for i in ${static}/scenarii/*.{yaml,yml}; do config=$(basename "${i}") @@ -21,17 +23,28 @@ for i in ${static}/scenarii/*.{yaml,yml}; do echo '############################' echo "${config}" echo '############################' - touch ${ansible_path}/configs/${env_type}/env_secret_vars.yml - ansible-playbook --syntax-check \ - --list-tasks \ - "${inventory[@]}" \ - -e ANSIBLE_REPO_PATH=${ansible_path} \ - ${ansible_path}/main.yml \ - -e @${i} - ansible-playbook --syntax-check \ - --list-tasks \ - "${inventory[@]}" \ - -e ANSIBLE_REPO_PATH=${ansible_path} \ - ${ansible_path}/destroy.yml \ - -e @${i} + + for playbook in \ + ${ansible_path}/main.yml \ + ${ansible_path}/destroy.yml \ + ${ansible_path}/configs/${env_type}/destroy_env.yml \ + ${ansible_path}/configs/${env_type}/scaleup.yml; do + if [ -e "${playbook}" ]; then + echo + echo -n "With ANSIBLE_REPO_PATH: " + ansible-playbook --syntax-check \ + --list-tasks \ + "${inventory[@]}" \ + -e ANSIBLE_REPO_PATH=${ansible_path} \ + "${playbook}" \ + -e @${i} + echo -n "Without ANSIBLE_REPO_PATH: " + + ansible-playbook --syntax-check \ + --list-tasks \ + "${inventory[@]}" \ + "${playbook}" \ + -e @${i} + fi + done done diff --git a/tests/static/tox-inventory.txt b/tests/static/tox-inventory.txt index 8c632d58ab8..2e335fff1ac 100644 --- a/tests/static/tox-inventory.txt +++ b/tests/static/tox-inventory.txt @@ -47,3 +47,6 @@ localhost [clientvms] localhost + +[newnodes] +localhost