I had to reinstall a couple of machines recently and I had to do the same thing more then once. So I wrote a script,and for my own future self I post it here, as reference.
sed -e 's:ONBOOT=no:ONBOOT=yes:' -i /etc/sysconfig/network-scripts/ifcfg-eth0 yum install http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-9.noarch.rpm http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-10.noarch.rpm yum update yum install policycoreutils-python iotop yum-plugin-ps yum-cron iptraf acpid man bind-utils vim-enhanced nc zip unzip wget etckeeper links screen yum-utils lsof bash-completion ddrescue dos2unix dstat lftp links hdparm smartmontools jwhois kexec-tools mc mcelog memtest86+ mmv mtr nmap ntp openssh-server pbzip2 rng-tools sysstat vconfig vlock lzop atop mosh mkdir /root/.ssh/ echo 'ssh-dss AAAAB3NzaC1kc3MAAACBAKk1vlmmXqEEeyrIfvhIXaFy7E8mu39/nXvJ1UVqtwLPJedSszGKtaRGPMw/0D+csOP61mPCNHCzX8EUbrv5DZ0OB1PFaPWC+IAsXcentCO3Ssy0syqNCYYGpumUK1ycsACJbO4oiwyPJTHe2BkI8laXDjRLdrbryPD79h8k9Kd7AAAAFQCWJNXBY3gGZA6lcXZYmaWUqaCTHQAAAIARzJIR6q+GD2nDKA11A0uKrjBnJ2HzBLb9KOr+Psj2jMEmAVosvpw+NIpaCf7yNOTTrl1oTC9ziopKTGe0emxWz00Zrwvu9gxxAa0eBBVzUuVD6fSmNSGTq1mfQASF0Qhwx6BIjgnxjTZVBvuTgCgR2Kk3/tLXDK2rXWC1MTUQNAAAAIAlq8y8nWOJlSWsEctWvNQkb5av0VQo00co3qUAtiGlICwVUpOleaz2c5r7v99JrqUpG/v5IlLBzc/w7Wa4UX10gW8sAurYfIx7LnrsqrprA+yQVwDcTSmolIMAacLgO9C4IWquJKfJiGmve+0OWJ6s9sDK2vip5GnZGN5NxEPw1Q== normal' >> /root/.ssh/authorized_keys chmod 700 ~/.ssh/ chmod 600 ~/.ssh/authorized_keys restorecon ~/.ssh/authorized_keys ~/.ssh/ etckeeper init etckeeper commit chkconfig yum-cron on
Before people complain! Yes, I know puppet and chef. At work I use it daily, but this are play machines and I don’t want to handle puppet here at home.
Ansible has no agent or pain in the ass to manage and the playbooks would read much like your script.
Hi vidal,
yes ansible is on my todolist for this or the next weekend. Thanks for the hint.
CU
Jens
Try salt stack…