Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
It would’ve been great if you’d described steps of how to run your example playbook. That is the main purpose of tutorials to provide detailed instructions in order to readers could repeat the steps and see the results. Without such instructions it is just an overview of the tool and its capabilities.
It would be a great idea if you could explain how to run playbooks: in example ansible-playbooks -i playbook.yml
This comment has been deleted
Tutorial is pretty good for Ansible playbooks ! But key point is missing, there is no speak about how to configure INI and how to execute Ansible scripts on your remote servers. For tutorial I think it is must have - how to execute it on your own server
How to run:
In file /etc/ansible/hosts add your IP address.
Run this in your terminal: ssh-copy-id username@IP
If u want run with specific user, after hosts:all in file playbook.yml add remote_user: username
Run with ansible-playbook playbook.yml --ask-sudo-pass
Hi good tutorial but needs updating to ansible 2.6 standard the code old pre 2.6 code
---
- hosts: all
sudo: true
vars:
packages: [ 'vim', 'git', 'curl' ]
tasks:
- name: Install Package
apt: name={{ item }} state=latest
with_items: packages
new updated code ansible 2.6 compatible
---
- hosts: all
become: true #same as sudo up
vars:
packages: ["vim", "git", "curl"]
#varables which in this case stores each package as an item within the array
tasks:
- name: installing packages on hosts
apt: name={{ item }} update_cache=yes state=latest
with_items: "{{ packages }}" #calls the var packages
#but you can also call the pacakges in this manner
# with_items:
# - vim
# - git
# - curl # this is seen by ansible as "item": ["vim", "git", "curl"]
Also to run the playbook
ansible-playbook -i roles/common/tasks/main.yml
add v for verbosity and help with debugging it helps a lot if anyone knows of a good ansible linter please let me know as could use it to debug spacing issues
Hope this helps
Could someone explain to me the templates part. I did not understand its syntax and what it is expected to do especially what is the ‘dest’ part for.
Thanks for this article Erika! The examples were good - everything worked for me, at least.
As an alternative, for anyone interested, you can setup two DigitalOcean droplets to play with Ansible - one to act as controller host and the other to serve as the node you’re controlling. Then just add the following section to Erika’s playbook.yml script to open port 80 in ufw, and you should be able to view the sample page on the “node” droplet.
- name: Allow all access to tcp port 80
ufw:
rule: allow
port: '80'
proto: tcp