jasenmichael / ansible-playbooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ansible playbooks

Setup linux hosts

install openssh-server on linux remote hosts

sudo apt install -y openssh-server

Setup windows remote hosts

create ansible user

# create ansible user
$Password = Read-Host -AsSecureString
New-LocalUser "ansible" -Password $Password -FullName "ansible" -Description "ansible"
Add-LocalGroupMember -Group "Administrators" -Member "ansible"

install WinRM

$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"

(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)

powershell.exe -ExecutionPolicy ByPass -File $file

Setup local machine

install ansible

sudo apt install -y software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt update
sudo apt install -y ansible
ansible --version

ansible-galaxy install -r requirements.yml
pip3 install "ansible-lint"

generate ansible ssh key for linux remote hosts

# generate ssh key, save as "~/.ssh/ansible"
ssh-keygen -t ed25519 -C "ansible"      

copy generated ansible ssh key, to linux remote hosts

ssh-copy-id -i ~/.ssh/ansible <ip-or-hostname>

About


Languages

Language:Shell 97.7%Language:Jinja 2.3%