Factor extended hostnames into existing roles

Ow, really feeling that maintainability hit
This commit is contained in:
Salt 2020-07-28 06:44:33 -05:00
parent 82b3a430f2
commit 863623e3b0
6 changed files with 10 additions and 10 deletions

View File

@ -9,7 +9,7 @@
set -e
export OUTDIR="$BACKUPSDIR/{{ inventory_hostname }}"
export OUTDIR="$BACKUPSDIR/{{ inventory_hostname_short }}"
retention=7 # 7-day retention period
# Sanity checks
@ -40,7 +40,7 @@ for dir in /home/*; do
forcefile="$dir/.backup/force"
[ -d "$dir/.backup" ] || continue
for file in "$dir/.backup/"*; do [ -e "$file" ] || continue; done
tar czhf "$OUTDIR/desktop-$username-{{ inventory_hostname }}-$(date -Iseconds).tar.gz" "$dir/.backup/"*
tar czhf "$OUTDIR/desktop-$username-{{ inventory_hostname_short }}-$(date -Iseconds).tar.gz" "$dir/.backup/"*
# if (( "$(date +%d)" == "1" )) || [ -f "$forcefile" ]; then
# log "Detected conditions for monthly dump"
# if command -v aws > /dev/null 2>&1 && aws s3 ls "s3://$s3bucket" > /dev/null 2>&1; then
@ -55,7 +55,7 @@ for dir in /home/*; do
# --exclude "$dir/Nextcloud" \
# --exclude "$dir/snap" \
# "$dir/."* \
# | aws s3 cp - "s3://$s3bucket/{{ inventory_hostname }}/desktop-$username-{{ inventory_hostname }}-$(date -Iseconds)-full.tar.gz" \
# | aws s3 cp - "s3://$s3bucket/{{ inventory_hostname_short }}/desktop-$username-{{ inventory_hostname_short }}-$(date -Iseconds)-full.tar.gz" \
# --only-show-errors \
# --storage-class STANDARD_IA
# else

View File

@ -11,7 +11,7 @@
overwrite: yes
zone: "{{ zone }}"
type: A
record: "{{ inventory_hostname }}.{{ zone }}."
record: "{{ inventory_hostname_short }}.{{ zone }}."
ttl: 300
value:
- "{{ ipify_public_ip }}"

View File

@ -187,7 +187,7 @@
record: "{{ mcname }}.mc.{{ zone }}."
ttl: 300
value:
- "{{ inventory_hostname }}.{{ zone }}."
- "{{ inventory_hostname_short }}.{{ zone }}."
- name: Assure SRV record
route53:
state: present
@ -197,5 +197,5 @@
record: "_minecraft._tcp.{{ mcname }}.mc.{{ zone }}."
ttl: 300
value:
- "1 10 {{ mcport }} {{ inventory_hostname }}.{{ zone }}."
- "1 10 {{ mcport }} {{ inventory_hostname_short }}.{{ zone }}."
become: yes

View File

@ -18,7 +18,7 @@
record: "{{ nagios_url }}"
ttl: 3600
value:
- "{{ inventory_hostname }}.{{ zone }}."
- "{{ inventory_hostname_short }}.{{ zone }}."
- name: Set up Apache
block:
- name: Enable modules

View File

@ -45,5 +45,5 @@
record: "{{ source_instancename }}.src.{{ zone }}."
ttl: 300
value:
- "{{ inventory_hostname }}.{{ zone }}."
- "{{ inventory_hostname_short }}.{{ zone }}."
become: yes

View File

@ -18,7 +18,7 @@
mode: "0700"
- name: Generate keypair
openssh_keypair:
comment: "{{ user_username }}@{{ inventory_hostname }}"
comment: "{{ user_username }}@{{ inventory_hostname_short }}"
path: $HOME/.ssh/id_ed25519
mode: "0600"
register: keypair
@ -33,7 +33,7 @@
body:
key: "{{ keypair.public_key }}"
read_only: yes
title: "{{ inventory_hostname }}-ed25519"
title: "{{ inventory_hostname_short }}-ed25519"
status_code: 201
when: keypair is changed
- name: Configure authorized hosts