apt update
apt install software-properties-common
add-apt-repository ppa:ansible/ansible
apt update
apt install ansible
git clone https://github.com/owncloud-ansible/playground
cd playground
ansible-galaxy collection install community.mysql
ansible-galaxy collection install community.general
ansible-galaxy collection install ansible.posix
ansible-galaxy install -r roles/requirements.yml
You have the setup locally. Congratulations. Now, let's say you have to do a deployment. How to proceed? First we have to make sure we can get to the server => keys.
scp ~.ssh/id_rsa.pub username@server:~.ssh/owncloud_deployment_key.pub
cat owncloud_deployment_key.pub >> authorized_keys
chmod 700 .ssh/
chmod 600 .ssh/*
Allright, now you can connect to your server you have to deploy with your keys. Great!
ansible -i playground/inventories/ubuntu-minimal/hosts owncloud -u username -m "ping"
Summery:
- key authentication: chmod go-rwx ~/.ssh{,/authorized_keys}
- sudo ohne password: visudo /etc/sudoers.d/ # add the following line: ALL=(ALL) NOPASSWD:ALL
- ansible inventory is the hosts file: in there set [all:vars] ansible_host=<ip.ad.dre.ss>; ansible_user=; ansible_become=yes; ansible_become_user=root