Go to file
2023-04-28 15:44:27 -07:00
ansible Update 'ansible/hosts.yml' 2023-04-28 15:44:27 -07:00
.ansible.cfg Add '.ansible.cfg' 2023-03-15 22:00:35 +01:00
config Update 'config' 2023-04-28 15:42:51 -07:00
README.md Update 'README.md' 2023-04-28 15:39:35 -07:00

setup_new_server

git clone

add target IP and name to local (ansible machine) /etc/hosts USE ONLY THE NAME IN hosts.yml and .ssh/config

for root: ssh-copy-id to target

in hosts.yml be very careful to use:

Host new.test.server new1

The new1 is VERY important as it defines the user variables

In pass.yml we will have tha variables new1_user_passwd, new1_sudo_passwd and new1_root_passwd

ansible-vault create passwd.yml or ansible-vault edit passwd.yml

move and edit config to ~.ssh/config

test connection: ansible -m ping --ask-vault-pass --extra-vars '@passwd.yml' TARGET_IP OR NAME -u root

run playbook: ansible-playbook --ask-vault-pass --extra-vars '@passwd.yml' ubuntu/setup-pb.yml -l TARGET_IP OR NAME -u root

On TARGET: modify /etc/sysctl.conf, add the line: net.ipv4.icmp_echo_ignore_all = 1 #don't respond to pings

and then: sudo sysctl -p

Change : allow root login : PermitRootLogin prohibit-password

to

allow root login : no

Reference: https://www.vultr.com/docs/how-to-configure-a-new-ubuntu-server-with-ansible/