How this was built up
[deprecated]
This is just a collection of things that had been done during the initial phase of the project...
Building an inventory
- build
inventory.yaml -
ping inventory
```bash
ping all and set user manually
ansible all -m ping -u service
ping group and user is now defined as var
ansible nfdi4earth -m ping -i inventory.yaml ```
Creating a playbook
- build
playbook.yaml -
run playbook
```bash
basically
ansible-playbook -i inventory.yaml pb_system.yaml
run only specific play
ansible-playbook -t availability -i inventory.yaml pb_system.yaml ```
Build playbook to install docker and setup up container
- source
- How To Use Ansible to Deploy Docker Containers on Debian 11
- ANSIBLE - DOCKER WITH PORTAINER ON UBUNTU SERVER INSTALLATION
- Install Portainer Agent on Docker Standalone
- ansible-doku - docker_container module
# recommended way of executing playbook with sudo rights
ansible-playbook -i inventory.yaml pb_docker.yaml --ask-become-pass
# quick but discouraged way (usefull on testing playbooks)
ansible-playbook -t portainer -i inventory.yaml pb_docker.yaml --extra-vars "ansible_become_pass={individual become pass}"
Set up NGINX and certbot
- How To Install Nginx on Debian 11
- How To Secure Nginx with Let's Encrypt on Debian 11
- Apply for acme account at TU Dresden
- How to obtain a wildcard ssl certificate from Let’s Encrypt and setup Nginx to use wildcard subdomain
Save sensitive variables encrypted in vars-file
# encrypt var-content by setting a password
ansible-vault encrypt_string {var_content} --ask-vault-pass
The vault password should always be the same for one host!
The result looks like that:
!vault |
$ANSIBLE_VAULT;1.1;AES256
30323363653431...
Add it to the vars-file:
my_variable: !vault |...
And now you let ansible-playbook prompt you for the vault-password
ansible-playbook -i production.yaml test.yaml --ask-vault-password