Skip to content

Integrate Server into Ansible

Ansible is hosted on srv121.gosix.net, user jochen.

  • Set server hostname

hostnamectl set-hostname srv201.unix.gosix.net --static

  • Get public ssh key from user jochen on srv121.gosix.net and put it on destination server in authorized keys of user jochen
  • Make sure user jochen has sudo permissions on destination server
  • playbook ausführen

Playbooks

borgbackup.yml

setups borg backup

fedorapackages.yml

Installs default fedora packages

motd.yml

Setups Message of the day. In order to work properly set motd_purpose variable in file hosts

sshkeyjochen.yml

Installs all ssh keys from jochen to the servers.

nginx_revproxy.yml (unfínished)

Setups nginx reverse proxy

Commands

Adhoc Shell command hostname on all servers

ansible -m shell -a 'hostname' all

Adhoc ping all hosts

ansible -m ping all

Adhoc create user with sudo (-b -K)

ansible -b -K -m user -a 'name=testuser' all

Install Ansible Module from Ansible galaxy

ansible-galaxy install geerlingguy.nginx

Show all gathered facts about host srv121.gosix.net

ansible -m setup srv121.gosix.net