trinityX icon indicating copy to clipboard operation
trinityX copied to clipboard

INSTALL.sh doesn't update hosts

Open mulderij opened this issue 1 year ago • 1 comments

When running INSTALL.sh site/hosts is just copied from site/hosts.example. It should probably be updated from the site/group_vars/all.yml information that was entered in the tui_configurator. For example:

ha=$(/bin/grep '^ha: ' group_vars/all.yml | /bin/cut -d ' ' -f2)
trix_ctrl1_hostname=$(/bin/grep '^trix_ctrl1_hostname: ' group_vars/all.yml | /bin/cut -d ' ' -f2)
trix_ctrl1_ip=$(/bin/grep '^trix_ctrl1_ip: ' group_vars/all.yml | /bin/cut -d ' ' -f2)
trix_ctrl2_hostname=$(/bin/grep '^trix_ctrl2_hostname: ' group_vars/all.yml | /bin/cut -d ' ' -f2)
trix_ctrl2_ip=$(/bin/grep '^trix_ctrl2_ip: ' group_vars/all.yml | /bin/cut -d ' ' -f2)

/bin/cat <<EOF > hosts
# Generated by INSTALL.sh
[controllers]
${trix_ctrl1_hostname} ansible_host=${trix_ctrl1_ip}
EOF
[[ "${ha}" == 'true' ]] && /bin/echo "${trix_ctrl2_hostname} ansible_host=${trix_ctrl2_ip}" >> hosts
/bin/sed --in-place "s/^\($(/bin/hostname --short) .*\)$/\1 ansible_connection=local/g" hosts

Or at least

trix_ctrl1_hostname=$(/bin/grep '^trix_ctrl1_hostname: ' group_vars/all.yml | /bin/cut -d ' ' -f2)

/bin/cat <<EOF > hosts
# Generated by INSTALL.sh
[controllers]
${trix_ctrl1_hostname} ansible_host=127.0.0.1 ansible_connection=local
EOF

mulderij avatar Jul 25 '24 08:07 mulderij

True. though this has no immediate effect on the run as long as host=127.0.0.1, we will look into updating that.

aphmschonewille avatar Aug 19 '24 11:08 aphmschonewille

I try to have this incorporated into trix 15 if not, 15.1. Since it's affecting the outcome little, i mark it as closed. I thank you for your input. It's really valuable.

aphmschonewille avatar Feb 14 '25 23:02 aphmschonewille