# Ubuntu playbook syntax

**URL:** <https://forum.ansible.com/t/ubuntu-playbook-syntax/21879>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [June 28, 2016, 5:51pm UTC](https://forum.ansible.com/t/ubuntu-playbook-syntax/21879 "2016-06-28T17:51:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![teddy\_mills](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@teddy\_mills](https://forum.ansible.com/u/teddy_mills)\
**Post date:** [June 28, 2016, 5:51pm UTC](https://forum.ansible.com/t/ubuntu-playbook-syntax/21879/1 "2016-06-28T17:51:41Z")

</div>

This playbook works, but I dont think this is the proper way to install multiple packages.  
Can someone correct this and show how it should be done ? TIA

ansible-playbook /root/aplays/core.pb -u teddy -k

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 28, 2016, 9:12pm UTC](https://forum.ansible.com/t/ubuntu-playbook-syntax/21879/2 "2016-06-28T21:12:06Z")

</div>

> This playbook works, but I dont think this is the proper way to install  
> multiple packages.  
> Can someone correct this and show how it should be done ? TIA

If it work and is understandable it's OK in my book, but it could be more condense.

> ansible-playbook /root/aplays/core.pb -u teddy -k
> 
> #######################################  
> - hosts: teddy  
> &nbsp;&nbsp;&nbsp;sudo: true  
> &nbsp;&nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install sysstat  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=sysstat update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install htop  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=htop update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install curl  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=curl update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install bzip2  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=bzip2 update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install lft  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=lft update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install traceroute  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=traceroute update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install ncdu  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=ncdu update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install midnight-commander mc  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=mc update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install screen  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=screen update\_cache=yes state=latest
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: install wget  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;apt: name=wget update\_cache=yes state=latest

- name: install apt packages  
&nbsp;&nbsp;&nbsp;apt: name={{ item }} update\_cache=yes state=latest  
&nbsp;&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- sysstat  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- htop  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- curl  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- bzip

I think you see the pattern, just continue to add the rest of the packages.
