--- - name: install the postgresql packages apt: pkg={{ item }} state={{ psql_pkg_state }} with_items: '{{ postgresql_pkgs }}' notify: Restart postgresql tags: [ 'postgresql', 'postgres' ] - name: Install the packages that ansible needs to manage the postgresql users and databases apt: pkg={{ item }} state={{ psql_pkg_state }} with_items: '{{ psql_ansible_needed_pkgs }}' tags: [ 'postgresql', 'postgres' ]