Setup: Deploy with ansible - HolgerHees/smartserver GitHub Wiki

Use ansible to deploy your setup

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.

  1. Install opensuse , almalinux (rhel) and ubuntu
  2. Install git and ansible (version >=4.10.0 which includes ansible-core version 2.11.12)
    1. On opensuse run sudo zypper install git python3-netaddr python3-pip system-user-nobody
    2. On almalinux (rhel) run sudo yum install git python python3-netaddr python3-pip
    3. On ubuntu run sudo yum install git python3-netaddr python3-pip
    4. On all systems run pip install ansible==4.10.0
  3. Clone this deployment project by running git clone https://github.com/HolgerHees/smartserver.git
  4. Type cd smartserver to change into the <projectfolder>
  5. 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.
  6. Configure your network with the same ip as defined in <projectfolder>/config/<myserver>/env.yml for the key production_ip or staging_ip
  7. [OPTIONAL] Mount the partitions from the partition setup. If they not exists, /smartserver and /smartserver/data are created as normal folders.
  8. To start the deployment, run
sudo ansible-playbook -i config/<myserver>/server.ini server.yml

It 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.yml

If 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.yml

The differences between the staging and the production setup are explained here

⚠️ **GitHub.com Fallback** ⚠️