Setup: Deploy with ansible - HolgerHees/smartserver GitHub Wiki
The initial described deployment is a staging deployment using vagrant, which runs inside a virtual machine.
If you want to use ansible directly or to deploy on your production system, you have to do the following steps.
- Install opensuse , almalinux (rhel) and ubuntu
- Install git and ansible (version >=4.10.0 which includes ansible-core version 2.11.12)
- On opensuse run
sudo zypper install git python3-netaddr python3-pip system-user-nobody - On almalinux (rhel) run
sudo yum install git python python3-netaddr python3-pip - On ubuntu run
sudo yum install git python3-netaddr python3-pip - On all systems run
pip install ansible==4.10.0
- On opensuse run
- Clone this deployment project by running
git clone https://github.com/HolgerHees/smartserver.git - Type
cd smartserverto change into the<projectfolder> - Copy your configuration folder into
<projectfolder>/config/<myserver>, where<myserver>is the name used in<projectfolder>/config/<myserver>/server.ini. You can use rsync on linux or winscp on windows to copy this folder. - Configure your network with the same ip as defined in
<projectfolder>/config/<myserver>/env.ymlfor the keyproduction_iporstaging_ip - [OPTIONAL] Mount the partitions from the partition setup. If they not exists,
/smartserverand/smartserver/dataare created as normal folders. - To start the deployment, run
sudo ansible-playbook -i config/<myserver>/server.ini server.ymlIt will detect that it runs on a production system and installs services from this setup if necessary.
If you use an encrypted vault folder, you have to run:
sudo ansible-playbook -i config/<myserver>/server.ini --ask-vault-pass server.ymlIf you want to apply only some ansible roles, you can restrict them by using the --tags parameter. e.g. to apply only the nextcloud role, run:
sudo ansible-playbook -i config/<myserver>/server.ini --tags "nextcloud" --ask-vault-pass server.ymlThe differences between the staging and the production setup are explained here