Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add preffix option to hostname creation #621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

valkiriaaquatica
Copy link

@valkiriaaquatica valkiriaaquatica commented Mar 8, 2024

SUMMARY

add the option for the user to add a hostname_prefix in case the user wants to add a prefix to the hostname, focused on AAP or AWX that hostnames are by default the name shown in the UI

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

Add new parameter and function hostname_prefix handling

ADDITIONAL INFORMATION

Now when in AWX or AAP or any Ansible UI that shows the hosts in inventory, in gcp it is not possible to add a prefix to the host name (which is the hostname variable in dynamic inventories). With this change you can add a prefix to the host name if for example you have two projects in gcp and you have two machines with the same name, this way you can put for example project_1 + host name and in another project_2 + host name.

Before the change:

plugin: google.cloud.gcp_compute
auth_kind: serviceaccount
service_account_file: your path to creds json

projects:
  - 12345
hostnames:
  - name

Result of the hostname was :


        "hosts": [
            "machine-1",
            "machine-2"
        ]
    }

After the change:

plugin: google.cloud.gcp_compute
auth_kind: serviceaccount
service_account_file: your path to creds json

projects:
  - 12345
hostnames:
  - name
hostname_prefix: 'i_am_a_test'

The hostnames now are:

    "hosts": [
        "i_am_a_testmachine-1",
        "i_am_a_testmachine-2"
    ]
}

add the option for the user to add a hostname_prefix in case he wants to add a prefix to the hostname, focused on AAP or AWX that hostnames are by default the name shown in the UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant