Skip to content

Commit

Permalink
fixup: several fixes, playbook, workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjeffman committed May 19, 2023
1 parent af66fc9 commit 7663db2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/multihost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ jobs:
- name: Run vagrant up
run: vagrant up

- name: Get vagrant ssh config and IP addresses
- name: Get vagrant ssh config
run: |
vagrant ssh-config | tee "vagrant-ssh" | ./get_ip.sh > inventory/group_vars/all.yml
vagrant ssh-config | tee "vagrant-ssh"
- name: Get nodes IP addresses
run: |
./get_ip.sh server replica client | tee "inventory/group_vars/all.yml"
- name: Test host connection
run: |
Expand Down
10 changes: 5 additions & 5 deletions tests/multihost/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Vagrant.configure("2") do |config|
# boot timeout (in seconds).
config.vm.boot_timeout = 25 * 60

config.vm.define "server.ipa.test" do |server|
config.vm.define "server" do |server|
server.vm.hostname = "server.ipa.test"
server.vm.provision "shell",
inline: "hostnamectl set-hostname server.ipa.test"
Expand All @@ -27,8 +27,8 @@ Vagrant.configure("2") do |config|
inline: "dnf install --downloadonly -y freeipa-server python3-libselinux freeipa-server-dns freeipa-server-trust-ad firewalld"
end

config.vm.define "rep-01.ipa.test" do |replica|
replica.vm.hostname="rep-01.ipa.test"
config.vm.define "replica" do |replica|
replica.vm.hostname="replica"
replica.vm.provision "shell",
inline: "hostnamectl set-hostname rep-01.ipa.test"
replica.vm.provision "shell",
Expand All @@ -37,8 +37,8 @@ Vagrant.configure("2") do |config|
inline: "dnf install --downloadonly -y freeipa-server python3-libselinux freeipa-server-dns freeipa-server-trust-ad firewalld"
end

config.vm.define "cli-01.ipa.test" do |client|
client.vm.hostname="cli-01.ipa.test"
config.vm.define "client" do |client|
client.vm.hostname="client"
client.vm.provision "shell",
inline: "hostnamectl set-hostname cli-01.ipa.test"
client.vm.provision "shell",
Expand Down
16 changes: 6 additions & 10 deletions tests/multihost/get_ip.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/bin/sh

INPUT=${1:--}

echo "---"
# shellcheck disable=SC2002
cat "${INPUT}" | \
grep HostName -B1 | \
sed -e "/^--/d" \
-e "/^Host/N;s/\n/:/;s/Host \([a-zA-Z0-9.]*\)/\1/;s/ *HostName \(.*\)/ \1/" \
-e "s/server.*:/server_ip:/" \
-e "s/cli-.*:/client_ip:/" \
-e "s/rep-.*:/replica_ip:/"

while [ -n "${1}" ]
do
echo "${1}_ip: $(vagrant ssh -c "hostname -I" "${1}")"
shift
done
20 changes: 10 additions & 10 deletions tests/multihost/inventory/vagrant-inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ all:
ipaserver_setup_dns: "{{ lookup('env', 'ipaserver_setup_dns') | default(true, True) | bool }}"
ipaserver_auto_forwarders: "{{ lookup('env', 'ipaserver_auto_forwarders') | default(true, True) | bool }}"
ipaserver_no_forwarders: "{{ lookup('env', 'ipaserver_no_forwarders') | default(false, True) | bool }}"
ipaserver_forwarders: "{{ lookup('env', 'ipaserver_forwarders') | default([], True) }}"
ipaserver_forwarders: "{{ lookup('env', 'ipaserver_forwarders') | default(omit, True) }}"
ipaserver_auto_reverse: "{{ lookup('env', 'ipaserver_auto_reverse') | default(true, True) | bool }}"
# For easier setup of DNS keep it set to 'true'
ipaserver_allow_zone_overlap: true
# DNSSEC must be set to 'false' for AD trust
ipaserver_no_dnssec_validation: true
# trust vars
ipaserver_setup_adtrust: "{{ lookup('env', 'ipaserver_setup_adtrust') | default(false) | bool }}"
ipaserver_netbios_name: "{{ lookup('env', 'ipaserver_netbios_name') | default('IPA') }}"
ipaserver_setup_adtrust: "{{ lookup('env', 'ipaserver_setup_adtrust') | default(false, True) | bool }}"
ipaserver_netbios_name: "{{ lookup('env', 'ipaserver_netbios_name') | default('IPA', True) }}"
# disable 'allow all' HBAC rule
ipaserver_no_hbac_allow: true
# other vars
Expand All @@ -60,16 +60,16 @@ all:
ipareplica_setup_dns: "{{ lookup('env', 'ipareplica_setup_dns') | default(false, True) | bool }}"
ipareplica_auto_forwarders: "{{ lookup('env', 'ipareplica_auto_forwarders') | default(true, True) | bool }}"
ipareplica_no_forwarders: "{{ lookup('env', 'ipareplica_no_forwarders') | default(false, True) | bool }}"
ipareplica_forwarders: "{{ lookup('env', 'ipareplica_forwarders') | default([], True) }}"
ipareplica_forwarders: "{{ lookup('env', 'ipareplica_forwarders') | default(omit, True) }}"
ipareplica_auto_reverse: "{{ lookup('env', 'ipareplica_auto_reverse') | default(true, True) | bool }}"
# Trust backup
ipareplica_setup_adtrust: "{{ lookup('env', 'ipaserver_setup_adtrust') | default(false) | bool }}"
ipareplica_netbios_name: "{{ lookup('env', 'ipaserver_netbios_name') | default('IPA') }}"
ipareplica_setup_adtrust: "{{ lookup('env', 'ipaserver_setup_adtrust') | default(false, True) | bool }}"
ipareplica_netbios_name: "{{ lookup('env', 'ipaserver_netbios_name') | default('IPA', True) }}"
# Update IP addressess
ipasssd_enable_dns_updates: true
# Automatically handle DNS nameservers (ansible-freeipa v1.9.0+)
ipaclient_configure_dns_resolver: "{{ ipaserver_setup_dns | default(false) }}"
ipaclient_dns_servers: ["{{ server_ip if (ipaserver_setup_dns | default(false)) else omit}}"]
ipaclient_configure_dns_resolver: "{{ lookup('env', 'ipareplica_setup_dns') | default(false, True) | bool }}"
ipaclient_dns_servers: "{{ server_ip if (lookup('env', 'ipareplica_setup_dns') | default(false, True) | bool) else default(omit) }}"
# IPA Client hosts
ipaclients:
hosts:
Expand All @@ -83,5 +83,5 @@ all:
# Add client DNS entries
ipasssd_enable_dns_updates: true
# Automatically handle DNS nameservers (ansible-freeipa v1.9.0+)
ipaclient_configure_dns_resolver: "{{ ipaserver_setup_dns | default(false) }}"
ipaclient_dns_servers: ["{{ server_ip if (ipaserver_setup_dns | default(false)) else omit}}"]
ipaclient_configure_dns_resolver: "{{ lookup('env', 'ipareplica_setup_dns') | default(false, True) | bool }}"
ipaclient_dns_servers: "{{ server_ip if (lookup('env', 'ipareplica_setup_dns') | default(false, True) | bool) else default(omit) }}"

0 comments on commit 7663db2

Please sign in to comment.