what does ansible do code example

Example 1: ansible package

- name: install ntpdate
  package:
    name: ntpdate
    state: present

# This uses a variable as this changes per distribution.
- name: remove the apache package
  package:
    name: "{{ apache }}"
    state: absent

- name: install the latest version of Apache and MariaDB
  package:
    name:
      - httpd
      - mariadb-server
    state: latest

Example 2: how to use tags in ansible

# Tags goes at same indentation as name or service: 
- name: Create Postgres Container 
  tags: createcontainer
  docker_container:
    name: mypostgres
    ...
# Then in the command line:
ansible-playbook myplaybook.yaml --tags createcontainer