Add a prod alias similar to how the env-termux project does it.

This commit is contained in:
Hyperling 2025-01-02 15:51:41 -07:00
parent 76ec891138
commit db3e610c91
2 changed files with 27 additions and 2 deletions

View File

@ -35,11 +35,11 @@
; ;
; user : Provide the name of the user account. ; user : Provide the name of the user account.
; Example: tom, jerry, kim, sarah ; Example: tom, jerry, kim, sarah
; Default: ling ; Default: user
; ;
; user_desc : Provide the description of the user account. ; user_desc : Provide the description of the user account.
; Example: Thomas, Jerry, Kimberly, Sarah ; Example: Thomas, Jerry, Kimberly, Sarah
; Default: Hyperling ; Default: User
; ;
; sshd_port : Determine the port which SSHD should listen on. ; sshd_port : Determine the port which SSHD should listen on.
; Example: 12345 ; Example: 12345
@ -101,6 +101,22 @@
; Slows down the rate of services such as telegraf and cron. ; Slows down the rate of services such as telegraf and cron.
; Default: false ; 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] [global]
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config' marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
state: present state: present
@ -124,6 +140,9 @@
git_user: "{{ lookup('ini', 'git_user file={{gen_file}} default=me') }}" git_user: "{{ lookup('ini', 'git_user file={{gen_file}} default=me') }}"
git_project: "{{ lookup('ini', 'git_project file={{gen_file}} default=env-ansible') }}" 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') }}" 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 - name: General | Account Management | Provisioning Configuration | General | List
set_fact: set_fact:
@ -144,6 +163,9 @@
- { 'git_user': "{{ git_user }}" } - { 'git_user': "{{ git_user }}" }
- { 'git_project': "{{ git_project }}" } - { 'git_project': "{{ git_project }}" }
- { 'git_ssh_port': "{{ git_ssh_port }}" } - { 'git_ssh_port': "{{ git_ssh_port }}" }
- { 'prod_host': "{{ prod_host }}" }
- { 'prod_port': "{{ prod_port }}" }
- { 'prod_user': "{{ prod_user }}" }
## Workstation ## ## Workstation ##

View File

@ -558,6 +558,8 @@
fi fi
alias_scan: | alias_scan: |
alias scan="nmap -A -p- --script=vuln" 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 - name: General | Account Management | Users | Files | Common Variable
set_fact: set_fact:
@ -599,6 +601,7 @@
{{ export_hyperling }} {{ export_hyperling }}
{{ source_docker_env }} {{ source_docker_env }}
{{ alias_scan }} {{ alias_scan }}
{{ alias_prod }}
- name: General | Account Management | Users | Files | .bashrc - name: General | Account Management | Users | Files | .bashrc
blockinfile: blockinfile: