A simple repo to hold playbooks that I have written over the years for a variety of purposes
- This playbook will:
- Operate on all hosts in the Ansible inventory
- The tasks this playbook will complete are:
- Update the
/etc/ssh/sshd_config
file to allow root logins ("PermitRootLogin yes"
) - It will restart the SSH Daemon with a
handler
- Update the
- This playbook will:
- Operate on all hosts in the Ansible inventory
- The tasks this playbook will complete are:
- Update the
/etc/ssh/sshd_config
file to disable root logins ("PermitRootLogin no"
) - It will restart the SSH Daemon with a
handler
- Update the
- This playbook will:
- Operate on all hosts in the Ansible inventory
- Achieve super user privelages by using
sudo
- Lookup the currently running
"$USER"
from the environment variables and assign them as the Ansibleremote_user
- The tasks this playbook will complete are:
- Stop the
systemd
servicechef-client
, and disable it. - Find
/etc/yum.repos.d/
repo files, and register the results inrepofiles
- Loop through
repofiles
and replace all instances ofenabled=1
withenabled=0
(It also accounts for a possible space around the '=' symbol) - Check to make sure cache exists, and register the results in
yumcache
- Remove YUM Cache,
when
yumcache.stat.exists
- Run the command
yum clean all
- Update all RHEL Packages with
state: latest
and register the ouput inpackageupdate
- Get the kernel name-version-release, store the output in
rpm_output
- Loop through the
stdout_lines
ofrpm_output
andreboot
the server when the kernel matches (Prior to running the playbook, the admin should update the playbook with an expected kernel 'name-version-release') - Loop through
repofiles
and replace all instances ofenabled=0
withenabled=1
(It also accounts for a possible space around the '=' symbol) - Restart the
systemd
servicechef-client
, and enable it.
- Stop the
- This playbook will:
- Operate on all hosts in the Ansible inventory
- Achieve super user privelages by using
sudo
- Gather facts
- Set
vars
:arcfour256
,arcfour
,aes192-cbc
,aes256-cbc
,diffie-hellman-group1-sha1
,diffie-hellman-group-exchange-sha1
- The tasks this playbook will complete are:
- Set a fact
sshchange
tofalse
- Check the
/etc/ssh/sshd_config
for commented lines that contain theKex
Algorithm, and if found, uncomment them. - Check if KexAlgorithms is present
- Add KexAlgorithms if missing on RHEL 7 or more
- Add KexAlgorithms if missing on RHEL 6
- Ciphers - Uncomment if commented
- Check if Ciphers is present
- Add Ciphers if missing on RHEL 7 or more
- Add Ciphers if missing on RHEL 6
- Loop on the
vars
established at the start, and if found, remove them from/etc/ssh/sshd_config
- Disable root login over SSH
- Restart SSH Daemon
- Set a fact
- This playbook will:
- Operate on all hosts in the Ansible inventory
- Achieve super user privelages by using
sudo
- Gather facts
- The tasks this playbook will complete are:
- Gather package facts
- Set sudo version from discovered package facts: (
"{{ ansible_facts.packages.sudo[0].version }}-{{ ansible_facts.packages.sudo[0].release }}"
) - Install rsync if needed
- Sync an updated version of sudo to affected hosts, and notify handlers to both install and cleanup files
- Oracle Enterprise Linux 6/7
- RedHat Enterprise Linux 6/7
- CentOS Linux 6/7