Open tecknicaltom opened 1 year ago
Do you have an example of the command you ran to get this?
python3 terry.py --operation apachetest --verbose --no_elastic add server --provider aws --type redirector --redirector_type https
[+] Start of script run with command: "terry.py --operation apachetest --verbose --no_elastic add server --provider aws --type redirector --redirector_type https"
[+] Adding to the "apachetest" deployment
[*] Parsing the build manifest
[*] Found the "terraform" binary, from provided path
[*] Successfully found "terraform" binary
[*] Found "redirector" specific server size of "t2.micro" for "aws" in terraform_mappings.yml.
[*] Found "redirector" specific disk size of "32" for "aws" in terraform_mappings.yml.
[!] No domains provided for redirector, this may cause issues with your redirector (depending on the protocol)
[+] Validating that we have all required credentials
[*] Validating required arguments for the "aws" provider
[*] AWS_ACCESS_KEY_ID: Value NOT FOUND in CLI arguments
[*] AWS_ACCESS_KEY_ID: Value NOT FOUND in environment variables
[*] AWS_ACCESS_KEY_ID: Value FOUND in config file
[*] AWS_SECRET_ACCESS_KEY: Value NOT FOUND in CLI arguments
[*] AWS_SECRET_ACCESS_KEY: Value NOT FOUND in environment variables
[*] AWS_SECRET_ACCESS_KEY: Value FOUND in config file
[*] AWS_DEFAULT_REGION: Value NOT FOUND in CLI arguments
[*] AWS_DEFAULT_REGION: Value NOT FOUND in environment variables
[*] AWS_DEFAULT_REGION: Value FOUND in config file
[+] All required credentials found
[!] This build has opted out of Nebula
[!] This build has opted out of Elastic
[*] Build looks good! Terry, take it away!
[+] Building Terraform plan
[*] No _base.tf.j2 found for "aws", skipping
[*] Writing Terraform plan to disk
[+] Applying Terraform plan
[*] Terraform not initialized, running "terraform init" now...
[*] Terraform successfully initialized!
[*] Terraform not planned, running "terraform plan" now...
[+] Getting Terraform state
[*] Mapping Terraform state
[*] Creating the build manifest
[*] Building Ansible inventory
[+] Nebula not configured for this build, skipping setting up Nebula configurations and certificates
[+] Getting IPs for Redirector configurations
[+] Redirectors configured
[*] Creating the build manifest
[*] Successfully found "ansible" binary
[*] Building Ansible inventory
[*] Running the "../../../playbooks/wait-for-system-setup.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/e70bcfd9-8dfe-4f2d-bbd4-8c273ff59b73/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/e70bcfd9-8dfe-4f2d-bbd4-8c273ff59b73/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Wait for Startup Scripts to complete] ************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Running the "../../../playbooks/clean-all-systems.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/8012be1e-b223-4ff6-bb57-6e62d04d307c/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/8012be1e-b223-4ff6-bb57-6e62d04d307c/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Clean the system from all old users and old firewall configurations] *****
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Running the "../../../playbooks/prep-all-systems.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/8afdbcd9-2d5e-4865-87f2-61a199abf202/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/8afdbcd9-2d5e-4865-87f2-61a199abf202/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Prepare All Systems with Basic Configurations] ***************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Running the "../../../playbooks/setup-lighthouse.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/e19069dc-91d0-4588-a9ef-756547a6d495/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/e19069dc-91d0-4588-a9ef-756547a6d495/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Setup the lighthouse server] *********************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Running the "../../../playbooks/setup-containers.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/32759b3f-7cc3-40f5-82f7-57f43ce5517f/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/32759b3f-7cc3-40f5-82f7-57f43ce5517f/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Set up the servers with containers] **************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Running the "../../../playbooks/setup-redirector.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/8267821b-a436-4f46-94bb-22ef504e395b/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/8267821b-a436-4f46-94bb-22ef504e395b/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Setup the Redirector Server] *********************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Running the "../../../playbooks/setup-categorization.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/08008bbb-fd7e-4c55-ba8e-98df781a38de/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/08008bbb-fd7e-4c55-ba8e-98df781a38de/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Setup the Categorization Server] *****************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Running the "../../../playbooks/setup-mailserver.yml" playbook
Identity added: /opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/43442ace-5d2e-4860-9b94-d45ced14c0db/ssh_key_data (/opt/new-terry-the-terraformer/terry-the-terraformer/deployments/apachetest/ansible/artifacts/43442ace-5d2e-4860-9b94-d45ced14c0db/ssh_key_data)
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [Setup the Mailserver] ****************************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
[*] Checking for extended_plays defined in the configuration file
[+] Ansible setup complete
Server Resources:
╒═══════════════╤═══════════════╤═════════════╤═════════════╤════════════╤══════════╕
│ server_name │ server_type │ public_ip │ nebula_ip │ provider │ domain │
╞═══════════════╪═══════════════╪═════════════╪═════════════╪════════════╪══════════╡
╘═══════════════╧═══════════════╧═════════════╧═════════════╧════════════╧══════════╛
Domain Resources:
╒══════════╤════════╤═══════════════╤═════════╕
│ domain │ host │ record_type │ value │
╞══════════╪════════╪═══════════════╪═════════╡
╘══════════╧════════╧═══════════════╧═════════╛
[+] Terry building complete! Enjoy the tools you tool!
in terry.py
:
if len(domains) == 0:
LogHandler.error('No domains provided for redirector, this may cause issues with your redirector (depending on the protocol)')
elif redirector_type == 'dns':
# Get the domain record and edit the server object
main_domain = domains.pop(0)
base_domain = Domain.get_domain(main_domain[0])
ns_domain_value = f'ns1.{base_domain}'
server.domain = ns_domain_value
ctx.obj['resources'].append(server)
# Build the Domain objects
ctx.invoke(domain, provider=main_domain[1], domain=main_domain[0], type='NS', value=ns_domain_value)
ctx.invoke(domain, provider=main_domain[1], domain=ns_domain_value, type='A', server_name=server.uuid)
else:
ctx.obj['resources'].append(server)
if no domains were provided, the final else is never reached and the server is not added to the resources. I'm not sure if this is the intended outcome (in which case the error message should be more direct) or if attempting to create the server will just result in a different error down the line.
The logic around the error message "No domains provided for redirector, this may cause issues with your redirector (depending on the protocol)" (in terry.py) results in no server being created for a redirector if there are no specified domains.
This behavior should be changed, or the error message should be more clear that the requested resource isn't going to be created, or it should be a more fatal error that stops the create/add request.