Sys2 Week 7 - 0xBrendan/Tech-Journal GitHub Wiki

This week we installed and used ansible on both Linux and Windows Hosts.

Install Ansible on controller:

sudo apt-add-repository ppa:ansible/ansible sudo apt update sudo apt install sshpass ansible -y sudo apt install python-pip python-setuptools -y sudo pip install wheel pywinrm pywinrm[kerberos]

Configuring windows:

Run this script: https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

General

Put hosts being managed by ansible in inventory text file as a list of hostnames or ip addresses. add tags before hostnames with [brackets] to reference groupings with playbooks

get playbook formats from roles installed and their readme pages.

roles are prebuilt ways of automating tasks

execute commands on hosts: $ansible all -a "cmd/string" -i inventory.txt

syntax for downloading roles: $ansible-galaxy install (creator.role) -p (directory)

syntax for installing roles to managed hosts: $ansible-playbook -i inventory.txt (playbook)