Add Git Server To Keep ansible-pull
Traffic Local (#21)
* Fedora Minimal does not come with tar. Need installed for Telegraf. * First attempt at automating HTTP git server setup. * Add cron jobs to keep projects up to date. * Add new git playbook to server. * Add new server variables for git. Put all variables in a dictionary. * Put variables into run file. * Fix the loop variables to be dictionaries, not jinja. * Upgrade nanominer. * Attempt to fix templating error. * Attempt to fix templating error, but in the right spot this time. :) * Attempt another fix for building list of dictionaries. * Change strings to dicts. * Add quotes for jinja variables. * Remove extra curly brackets. * Fix the rest of the file's dictionaries now that General works. * Remove testing code. * Variablize ansible repo. Begin watching personal repos rather than pinging GitHub. * Fix variables to append, not replace. * Fix variable names. * Try to prevent variables from being strings, without getting formatting error. * Try to fix variables, again. * Fixed git.yml. Found a way to test locally and all is working now.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
- name: General | Account Management | Provisioning Configuration | Variables 1
|
||||
set_fact:
|
||||
prov_dir: "/usr/local/etc/hyperling-scm"
|
||||
provision_variables: []
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Variables 2
|
||||
set_fact:
|
||||
@ -54,15 +55,15 @@
|
||||
branch: "{{ lookup('ini', 'branch file={{gen_file}} default=main') }}"
|
||||
pentesting: "{{ lookup('ini', 'pentesting file={{gen_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Print
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
- name: General | Account Management | Provisioning Configuration | General | List
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- provision
|
||||
- user
|
||||
- user_desc
|
||||
- branch
|
||||
- pentesting
|
||||
- { 'provision': "{{ provision }}" }
|
||||
- { 'user': "{{ user }}" }
|
||||
- { 'user_desc': "{{ user_desc }}" }
|
||||
- { 'branch': "{{ branch }}" }
|
||||
- { 'pentesting': "{{ pentesting }}" }
|
||||
|
||||
|
||||
## Workstation ##
|
||||
@ -102,16 +103,16 @@
|
||||
rdp: "{{ lookup('ini', 'rdp file={{wrk_file}} default=false') }}"
|
||||
vnc: "{{ lookup('ini', 'vnc file={{wrk_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Print
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | List
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- workstation
|
||||
- coding
|
||||
- editing
|
||||
- gaming
|
||||
- rdp
|
||||
- vnc
|
||||
- { 'workstation': "{{ workstation }}" }
|
||||
- { 'coding': "{{ coding }}" }
|
||||
- { 'editing': "{{ editing }}" }
|
||||
- { 'gaming': "{{ gaming }}" }
|
||||
- { 'rdp': "{{ rdp }}" }
|
||||
- { 'vnc': "{{ vnc }}" }
|
||||
|
||||
|
||||
## Miner ##
|
||||
@ -176,22 +177,22 @@
|
||||
nvidia: "{{ lookup('ini', 'nvidia file={{mnr_file}} default=false') }}"
|
||||
xmr_stak_cpu: "{{ lookup('ini', 'xmr_stak_cpu file={{mnr_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Miner | Print
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
- name: General | Account Management | Provisioning Configuration | Miner | List
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- miner
|
||||
- amdgpu
|
||||
- nanominer
|
||||
- nanominer_cpu
|
||||
- nanominer_cpu_pool
|
||||
- nanominer_gpu
|
||||
- nanominer_gpus
|
||||
- nanominer_gpu_pool
|
||||
- eth_minhashrate
|
||||
- ethminer
|
||||
- nvidia
|
||||
- xmr_stak_cpu
|
||||
- { 'miner': "{{ miner }}" }
|
||||
- { 'amdgpu': "{{ amdgpu }}" }
|
||||
- { 'nanominer': "{{ nanominer }}" }
|
||||
- { 'nanominer_cpu': "{{ nanominer_cpu }}" }
|
||||
- { 'nanominer_cpu_pool': "{{ nanominer_cpu_pool }}" }
|
||||
- { 'nanominer_gpu': "{{ nanominer_gpu }}" }
|
||||
- { 'nanominer_gpus': "{{ nanominer_gpus }}" }
|
||||
- { 'nanominer_gpu_pool': "{{ nanominer_gpu_pool }}" }
|
||||
- { 'eth_minhashrate': "{{ eth_minhashrate }}" }
|
||||
- { 'ethminer': "{{ ethminer }}" }
|
||||
- { 'nvidia': "{{ nvidia }}" }
|
||||
- { 'xmr_stak_cpu': "{{ xmr_stak_cpu }}" }
|
||||
|
||||
|
||||
## Server ##
|
||||
@ -227,6 +228,20 @@
|
||||
; Regardless of whether you choose http or https, the Certbot config will be skipped since the maintainer uses a reverse proxy.
|
||||
; Example: https://gitlab
|
||||
;
|
||||
; git : Set to true for this server to be configured as an HTTP git server.
|
||||
;
|
||||
; git_name : Name(s) of project(s) that the Git server should host.
|
||||
; Example: ansible#ansible-dev
|
||||
;
|
||||
; git_branch : Branch(es) of project(s) corresponding with git_name.
|
||||
; Example: main#dev
|
||||
;
|
||||
; git_url : URL(s) of project(s) corresponding with git_name.
|
||||
; Example: https://github.com/Hyperling/ansible#https://github.com/Hyperling/ansible
|
||||
;
|
||||
; git_sep : Separator for git variables above.
|
||||
; Example: #
|
||||
;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Server Config'
|
||||
state: present
|
||||
@ -245,21 +260,31 @@
|
||||
hugo: "{{ lookup('ini', 'hugo file={{srv_file}} default=false') }}"
|
||||
gitlab: "{{ lookup('ini', 'gitlab file={{srv_file}} default=false') }}"
|
||||
gitlab_url: "{{ lookup('ini', 'gitlab_url file={{srv_file}} default=false') }}"
|
||||
git: "{{ lookup('ini', 'git file={{srv_file}} default=false') }}"
|
||||
git_name: "{{ lookup('ini', 'git_name file={{srv_file}} default=false') }}"
|
||||
git_branch: "{{ lookup('ini', 'git_branch file={{srv_file}} default=false') }}"
|
||||
git_url: "{{ lookup('ini', 'git_url file={{srv_file}} default=false') }}"
|
||||
git_sep: "{{ lookup('ini', 'git_sep file={{srv_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Server | Print
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
- name: General | Account Management | Provisioning Configuration | Server | List
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- server
|
||||
- domain
|
||||
- onlyoffice
|
||||
- grafana
|
||||
- influxdb1
|
||||
- influxdb2
|
||||
- certbot
|
||||
- hugo
|
||||
- gitlab
|
||||
- gitlab_url
|
||||
- { 'server': "{{ server }}" }
|
||||
- { 'domain': "{{ domain }}" }
|
||||
- { 'onlyoffice': "{{ onlyoffice }}" }
|
||||
- { 'grafana': "{{ grafana }}" }
|
||||
- { 'influxdb1': "{{ influxdb1 }}" }
|
||||
- { 'influxdb2': "{{ influxdb2 }}" }
|
||||
- { 'certbot': "{{ certbot }}" }
|
||||
- { 'hugo': "{{ hugo }}" }
|
||||
- { 'gitlab': "{{ gitlab }}" }
|
||||
- { 'gitlab_url': "{{ gitlab_url }}" }
|
||||
- { 'git': "{{ git }}" }
|
||||
- { 'git_name': "{{ git_name }}" }
|
||||
- { 'git_branch': "{{ git_branch }}" }
|
||||
- { 'git_url': "{{ git_url }}" }
|
||||
- { 'git_sep': "{{ git_sep }}" }
|
||||
|
||||
|
||||
## Exit if not turned on yet ##
|
||||
@ -267,3 +292,10 @@
|
||||
- name: General | Account Management | Provisioning Configuration | Exit Check
|
||||
shell: echo "Please configure the config files in {{ prov_dir }} then try again." && exit 1
|
||||
when: provision != true
|
||||
|
||||
|
||||
## Display values ##
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Print
|
||||
debug:
|
||||
var: provision_variables
|
||||
|
@ -6,7 +6,7 @@
|
||||
user: ansible
|
||||
name: "Ansible Sync"
|
||||
minute: "*/30"
|
||||
job: "sudo {{ ansible_pull_exec.stdout }} -o -U https://github.com/Hyperling/ansible.git --checkout {{ branch }}"
|
||||
job: "sudo {{ ansible_pull_exec.stdout }} -o -U {{ repo_local }} --checkout {{ branch }}"
|
||||
state: present
|
||||
disabled: no
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
## Main ##
|
||||
|
||||
push.sh
|
||||
time {{ ansible_pull_exec.stdout }} -U https://github.com/Hyperling/ansible.git --checkout $branch
|
||||
time {{ ansible_pull_exec.stdout }} -U {{ repo_github }} --checkout $branch
|
||||
|
||||
marker: '{mark}'
|
||||
marker_begin: "#!{{ bash_exec.stdout }}"
|
||||
|
@ -56,7 +56,7 @@
|
||||
## Main ##
|
||||
|
||||
push.sh
|
||||
time sudo {{ ansible_pull_exec.stdout }} -U https://github.com/Hyperling/ansible.git --checkout $branch
|
||||
time sudo {{ ansible_pull_exec.stdout }} -U {{ repo_github }} --checkout $branch
|
||||
|
||||
marker: '{mark}'
|
||||
marker_begin: "#!{{ bash_exec.stdout }}"
|
||||
|
@ -48,6 +48,7 @@
|
||||
- "{{ locate }}"
|
||||
- zsh
|
||||
- "{{ opensshd }}"
|
||||
- tar
|
||||
state: present
|
||||
|
||||
- name: General | Software | Services | Install CROND (Looking at you, Fedora)
|
||||
|
@ -6,6 +6,10 @@
|
||||
shell: "echo 'START' > {{ ansible_pull_report }}"
|
||||
when: leet_drive_details.stat.exists
|
||||
|
||||
- name: General | Start | Ansible Pull Report | Add Provision Variables
|
||||
shell: "echo '{{ provision_variables }}' >> {{ ansible_pull_report }}"
|
||||
when: leet_drive_details.stat.exists
|
||||
|
||||
- name: General | Start | Ansible Pull Report | Make Viewable (SSHFS)
|
||||
file:
|
||||
path: "{{ ansible_pull_report }}"
|
||||
|
Reference in New Issue
Block a user