Initial Server Setup on Debian based systems
This role will execute a initial server setup for debian based systems. A number of containers will be created with the options specified in the vars/defaults.yml variable file.
Settings
create_user: the name of the remote sudo user to create.copy_local_key: path to a local SSH public key that will be copied as authorized key for the new user. By default, it copies the key from the current system user running Ansible.sys_packages: array with list of packages that should be installed.
Running this Role
Quick Steps:
1. Create a playbook
nano /etc/ansible/playbooks/setup-playbook.yml
Drop the following in that playbook file:
#playbooks/setup-playbook.yml
---
- hosts: all
become: true
roles:
- cael.init
2. Customize Options
nano vars/default.yml
#vars/default.yml
---
create_user: sammy
copy_local_key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
sys_packages: [ 'curl', 'vim', 'git', 'ufw']
3. IMPORTANT STEP - ssh-copy-id
ssh-copy-id user@targethost
4. Run the Playbook
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml