Skip to content

hostname task fails on Ubuntu #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tkishel opened this issue Jan 10, 2020 · 1 comment · Fixed by #54
Closed

hostname task fails on Ubuntu #39

tkishel opened this issue Jan 10, 2020 · 1 comment · Fixed by #54

Comments

@tkishel
Copy link
Contributor

tkishel commented Jan 10, 2020

https://github.com/puppetlabs/puppetlabs-peadm/blob/master/tasks/hostname.sh#L3

/usr/bin/hostname vs /bin/hostname

Either do not specify a full path to hostname or

whn=`which hostname`
hostname=$($whn -f)
echo '{ "hostname": "'$hostname'" }'
@tkishel
Copy link
Contributor Author

tkishel commented Jan 13, 2020

Also stashing this here:

#!/bin/bash

func_bolt() {
  bolt --inventory ~/inventory.yaml "$@"
}

. /etc/os-release

if [[ "$ID" == "ubuntu" ]]; then
  func_bolt command run '/opt/puppetlabs/bin/puppet-enterprise-uninstaller -dpy' --nodes all
  func_bolt command run 'dpkg --list | egrep 'puppet-agent|pe-[a-z]' | cut -d ' ' -f 3 | xargs apt-get remove --purge -y' --nodes all
  func_bolt command run 'rm -rf /etc/apt/sources.list.d/puppet_enterprise.list* /etc/apt/sources.list.d/pe_repo.list*' --nodes all
  func_bolt command run 'apt-get update' --nodes all
  func_bolt command run 'rm -rf /etc/default/pe-* /etc/puppetlabs /opt/puppetlabs /var/log/puppetlabs /tmp/*puppet* /tmp/pe.conf' --nodes all
else
  func_bolt command run '/opt/puppetlabs/bin/puppet-enterprise-uninstaller -dpy' --nodes all
  func_bolt command run 'yum remove -y puppet-agent pe-*' --nodes all
  func_bolt command run 'rm -rf /etc/yum.repos.d/puppet_enterprise.repo* /etc/yum.repos.d/pe_repo.repo*' --nodes all
  func_bolt command run 'yum clean all' --nodes all
  func_bolt command run 'rm -rf /etc/sysconfig/pe-* /etc/puppetlabs /opt/puppetlabs /var/log/puppetlabs /tmp/*puppet* /tmp/pe.conf' --nodes all
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant