I ssh into a remote 5$ debian:stable
IaaS machine with Putty. The machine has only debian:stable
and Ansible installed on it and I run an Ansible playbook locally on it with my current working user (that has sudo rights).
I aim to establish a LAMP server environment on this machine.
playbook.yml
:
- name: Establish a Debian-LAMP with some extras
hosts: 127.0.0.1
connection: local
become: no
tasks:
- name: update the apt package index i.e. apt update
apt: update_cache=yes
- name: Install ufw
apt: package=ufw state=present ## Install only if package-index is already present in the apt package-cache.
# etcetra
$ ansible-playbook playbook.yml
That single Ansible playbook is an orchestration and deployment of my entire server environment (Installation and setup of ufw, unattended-upgrades
, SSHGuard, Apache, MySQL, PHP, ssmtp
and further tools like curl
, wget
, zip
, unzip
tree
and so forth).
When I will learn enough Ansible I hope to add directives that will also transduce all my virtual-host files of Apache from say Apache 2.4 to 3.4 to 4.4 to 5.4 ecetra so I won't have to manually change all virtual host files in case I need to.
Given the playbook is filled with apt upgrade package1 package2 package3 etcetera
I assume I should run this playbook (or at least parts of it) each time anew, if Ansible won't do it itself.
Should I run this Ansible playbook daily/wwekly with cron or Ansible will recursively run it itself by some internal scheduling mechanism of its own?
apt-get upgrade
parts which resemble the pseudocodeif package exists, upgrade package, else, install it
. I edited the question.