From db3e610c913cda1e9920f91732ffa8ce752b0d95 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 2 Jan 2025 15:51:41 -0700 Subject: [PATCH] Add a `prod` alias similar to how the `env-termux` project does it. --- tasks/general/acct_mgmt/provision_config.yml | 26 ++++++++++++++++++-- tasks/general/acct_mgmt/users.yml | 3 +++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tasks/general/acct_mgmt/provision_config.yml b/tasks/general/acct_mgmt/provision_config.yml index 00c3822..c56d261 100644 --- a/tasks/general/acct_mgmt/provision_config.yml +++ b/tasks/general/acct_mgmt/provision_config.yml @@ -35,11 +35,11 @@ ; ; user : Provide the name of the user account. ; Example: tom, jerry, kim, sarah - ; Default: ling + ; Default: user ; ; user_desc : Provide the description of the user account. ; Example: Thomas, Jerry, Kimberly, Sarah - ; Default: Hyperling + ; Default: User ; ; sshd_port : Determine the port which SSHD should listen on. ; Example: 12345 @@ -101,6 +101,22 @@ ; Slows down the rate of services such as telegraf and cron. ; Default: false ; + ;;;;;;;;;;;;;;;;;;;; Server Shortcut ;;;;;;;;;;;;;;;;;;;; + ; + ; For typing `prod` and getting straight to a server, like in env-termux. + ; + ; prod_host : Branch to use on this machine. + ; Example: myserver.com, mywebhost.net + ; Default: hyperling.com + ; + ; prod_port : Provide the git host that the machine should poll. + ; Example: 22, 222, 2222 + ; Default: 22 + ; + ; prod_user : Port of the server host to use for SSH requests. + ; Example: jim, bob, jeff, anne + ; Default: user + ; [global] marker: '; {mark} MANAGED BY ANSIBLE | Generic Config' state: present @@ -124,6 +140,9 @@ git_user: "{{ lookup('ini', 'git_user file={{gen_file}} default=me') }}" git_project: "{{ lookup('ini', 'git_project file={{gen_file}} default=env-ansible') }}" git_ssh_port: "{{ lookup('ini', 'git_ssh_port file={{gen_file}} default=22') }}" + prod_host: "{{ lookup('ini', 'prod_host file={{gen_file}} default=hyperling.com') }}" + prod_port: "{{ lookup('ini', 'prod_port file={{gen_file}} default=22') }}" + prod_user: "{{ lookup('ini', 'prod_user file={{gen_file}} default=user') }}" - name: General | Account Management | Provisioning Configuration | General | List set_fact: @@ -144,6 +163,9 @@ - { 'git_user': "{{ git_user }}" } - { 'git_project': "{{ git_project }}" } - { 'git_ssh_port': "{{ git_ssh_port }}" } + - { 'prod_host': "{{ prod_host }}" } + - { 'prod_port': "{{ prod_port }}" } + - { 'prod_user': "{{ prod_user }}" } ## Workstation ## diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index e711c12..66e219b 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -558,6 +558,8 @@ fi alias_scan: | alias scan="nmap -A -p- --script=vuln" + alias_prod: | + alias prod="ssh -p {{ prod_port }} {{ prod_user }}@{{ prod_host }}" - name: General | Account Management | Users | Files | Common Variable set_fact: @@ -599,6 +601,7 @@ {{ export_hyperling }} {{ source_docker_env }} {{ alias_scan }} + {{ alias_prod }} - name: General | Account Management | Users | Files | .bashrc blockinfile: