Skip to content

Instantly share code, notes, and snippets.

@looselytyped
Last active May 22, 2025 17:19
Show Gist options
  • Save looselytyped/fd566ba8a08963fa8a7f6a36f5035ea9 to your computer and use it in GitHub Desktop.
Save looselytyped/fd566ba8a08963fa8a7f6a36f5035ea9 to your computer and use it in GitHub Desktop.
First-playbook
---
# a playbook is a _list_ of plays
# this is the first play, targeting the `frontend` servers
- name: Install nginx
hosts: frontend
tasks:
- name: Install nginx
# ubuntu based servers
ansible.builtin.apt:
name: nginx=1.18.0-6ubuntu14.6
state: present
update_cache: yes
# Remember the `--become` (or `-b`) flag you passed on the command-line earlier?
# This is the playbook equivalent of that.
become: true
- name: Install Java
hosts: backend
tasks:
- name: Install Java 21
# ubuntu based servers
ansible.builtin.apt:
name: openjdk-21-jdk=21.0.7+6~us1-0ubuntu1~22.04
state: present
update_cache: yes
# Remember the `--become` (or `-b`) flag you passed on the command-line earlier?
# This is the playbook equivalent of that.
become: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment