Upgrade code-reseed and have it use new Gitea server. Change files which pull to use the new provisioning variable.

This commit is contained in:
Hyperling 2025-01-02 12:32:21 -07:00
parent 5b67610fca
commit 734bc70c1d
6 changed files with 84 additions and 39 deletions

View File

@ -8,7 +8,8 @@
st_install_dir: /usr/local/src/st
global_bin: /usr/local/bin
x_desktops: /usr/share/xsessions
git_repo: https://git.hyperling.com/me/env-ansible.git
git_repo_http: http://{{ git_host }}/{{ git_user }}/{{ git_project }}
git_repo_ssh: ssh://{{ git_host }}:{{ git_ssh_port }}/{{ git_user }}/{{ git_project }}
- name: General | Facts | System | Linux

View File

@ -26,7 +26,9 @@
blockinfile:
path: "{{ gen_file }}"
block: |
;;;;;;; Available options - all require lowercase values ;;;;;;
; Please note that all potions require lowercase keys and values.
;
;;;;;;;;;;;;;;;;;;;; Basic Options ;;;;;;;;;;;;;;;;;;;;
;
; enable : Provide true for the provision to occur.
; Default: false
@ -39,22 +41,39 @@
; Example: Thomas, Jerry, Kimberly, Sarah
; Default: Hyperling
;
; branch : Provide the Github branch that the machine should poll.
; Example: main, dev
; Default: main
; sshd_port : Determine the port which SSHD should listen on.
; Example: 12345
; Default: 22
;
; pentesting : Set to true to install tools such as metasploit.
; nmap is already provided for reporting
; Default: false
;
; no_telem : Set to true to avoid setting up telemetry services.
; Disables GitHub updates to this project.
; Disables all telegraf pings.
; Default: false
;;;;;;;;;;;;;;;;;;;; Git Polling ;;;;;;;;;;;;;;;;;;;;
;
; battery : Set to true to attempt to save battery life.
; Slows down the rate of services such as telegraf and cron.
; Default: false
; For syncing this machine to a Git repository of this Ansible project.
;
; branch : Branch to use on this machine.
; Example: main, dev, prod
; Default: main
;
; git_host : Provide the git host that the machine should poll.
; Example: github.com, gitlab.com. gitea.com
; Default: git.hyperling.com
;
; git_user : Provide the git user which projects are found under.
; Example: Hyperling, JimBobMcGeeJr
; Default: me
;
; git_project : Name of this project on the server host.
; Example: Ansible, ansible-setup, my-env
; Default: env-ansible
;
; git_ssh_port : Port of the server host to use for SSH requests.
; Example: 22, 222, 2222
; Default: 22
;
;;;;;;;;;;;;;;;;;;;; Swap File ;;;;;;;;;;;;;;;;;;;;
;
; swap_block : Set to the block size if dd should create a swapfile.
; Preferably keep this under 2G for integrity sakes, the
@ -70,9 +89,16 @@
; Example: /usr/local/swap
; Default: /swapfile
;
; sshd_port : Determine the port which SSHD should listen on.
; Example: 12345
; Default: 22
;;;;;;;;;;;;;;;;;;;; Sync Frequency ;;;;;;;;;;;;;;;;;;;;
;
; no_telem : Set to true to avoid setting up telemetry services.
; Disables GitHub updates to this project.
; Disables all telegraf pings.
; Default: false
;
; battery : Set to true to attempt to save battery life.
; Slows down the rate of services such as telegraf and cron.
; Default: false
;
[global]
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
@ -93,6 +119,10 @@
swap_count: "{{ lookup('ini', 'swap_count file={{gen_file}} default=1') }}"
swap_file: "{{ lookup('ini', 'swap_file file={{gen_file}} default=/swapfile') }}"
sshd_port: "{{ lookup('ini', 'sshd_port file={{gen_file}} default=22') }}"
git_host: "{{ lookup('ini', 'git_host file={{gen_file}} default=git.hyperling.com') }}"
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') }}"
- name: General | Account Management | Provisioning Configuration | General | List
set_fact:
@ -109,6 +139,10 @@
- { 'swap_count': "{{ swap_count }}" }
- { 'swap_file': "{{ swap_file }}" }
- { 'sshd_port': "{{ sshd_port }}" }
- { 'git_host': "{{ git_host }}" }
- { 'git_user': "{{ git_user }}" }
- { 'git_project': "{{ git_project }}" }
- { 'git_ssh_port': "{{ git_ssh_port }}" }
## Workstation ##

View File

@ -139,7 +139,7 @@
Useful location types:
$zip_code | Ex: 12345
$city,$state | Ex: Austin,Texas
@$domain_dot_extension | Ex: @github.com
@$domain_dot_extension | Ex: @gitea.com
~$special_location | Ex: ~Manitou Incline
Full documentation: https://github.com/chubin/wttr.in'
return 1
@ -483,23 +483,33 @@
git checkout dev
done
'
alias_code_reseed: |
#alias code-reseed='
# unseed_dir="$HOME/TRASH/`date +%Y-%m-%d`_UnseededCodeProjects"
# mkdir -pv "$unseed_dir"
# mv -v ~/Code/*{ansible,docker,nix,break,website,www,tictactoe,-dev}* \
# "$unseed_dir"/ 2>/dev/null
# git clone git@github.com:Hyperling/Ansible \
# --branch dev ~/Code/ansible-dev
# git clone git@github.com:Hyperling/Docker \
# --branch dev ~/Code/docker-dev
# git clone git@github.com:Hyperling/Website \
# --branch dev ~/Code/website-dev
# git clone git@github.com:Hyperling/BreakTheHabit \
# --branch dev ~/Code/breakthehabit-dev
# git clone git@github.com:Hyperling/TicTacToeAndroid \
# --branch dev ~/Code/tictactoe-dev
#'
function_code_reseed: |
function git_projects_to_sync {
cat <<- EOF
env-ansible
env-docker
env-termux
nodejs-website
android-break-the-habit
android-tictactoe
android-expense-tracker
android-example-database-room
android-carb-up
ebook-health-protocol
EOF
}
function code-reseed {
unseed_dir="$HOME/TRASH/`date +%Y-%m-%d`_UnseededCodeProjects"
mkdir -pv "$unseed_dir"
mv -v ~/Code/* "$unseed_dir"/ 2>/dev/null
git_repo_ssh={{ git_repo_ssh }}
git_main_project={{ git_project }}
git_repo_ssh_basename=${git_repo_ssh//$git_main_project/}
git_projects_to_sync | while read git_project; do
git clone ${git_repo_ssh_basename}${git_project} \
--branch dev ~/Code/$git_project
done
}
function_clean_filenames: |
function clean-filenames() {
# Must provide the directory you'd like to clean all the filenames in.
@ -576,7 +586,7 @@
{{ alias_docker_restart }}
{{ alias_code_check }}
{{ alias_code_reset }}
{{ alias_code_reseed }}
{{ function_code_reseed }}
{{ function_clean_filenames }}
{{ function_clean_filenames_tree }}
{{ alias_clone }}

View File

@ -6,7 +6,7 @@
user: ansible
name: "Ansible Sync"
minute: "*/30"
job: "sudo {{ ansible_pull_exec.stdout }} -o -U {{ git_repo }} --checkout {{ branch }}"
job: "sudo {{ ansible_pull_exec.stdout }} -o -U {{ git_repo_http }} --checkout {{ branch }}"
state: present
disabled: "{{ 'yes' if no_telem else 'no' }}"

View File

@ -6,7 +6,7 @@
path: "{{ user_root.home }}/bin/scm.sh"
block: |
# 20210211 - Make life easier!
git clone {{ git_repo }} ansible-pull
git clone {{ git_repo_http }} ansible-pull
ansible-pull/setup.sh
mv ansible-pull ~/TRASH/
marker: '{mark}'
@ -37,7 +37,7 @@
## Main ##
time {{ ansible_pull_exec.stdout }} -U {{ git_repo }} --checkout $branch
time {{ ansible_pull_exec.stdout }} -U {{ git_repo_http }} --checkout $branch
marker: '{mark}'
marker_begin: "#!{{ bash_exec.stdout }}"

View File

@ -6,7 +6,7 @@
path: "{{ user_user.home }}/bin/scm.sh"
block: |
# 20210211 - Make life easier!
git clone {{ git_repo }} ansible-pull
git clone {{ git_repo_http }} ansible-pull
ansible-pull/setup.sh
mv ansible-pull ~/TRASH/
marker: '{mark}'
@ -37,7 +37,7 @@
## Main ##
time sudo {{ ansible_pull_exec.stdout }} -U {{ git_repo }} --checkout $branch
time sudo {{ ansible_pull_exec.stdout }} -U {{ git_repo_http }} --checkout $branch
marker: '{mark}'
marker_begin: "#!{{ bash_exec.stdout }}"