FIle not being copied using template

I have the following tree;

Root folder: ~/ansible/

I am running the command from the root folder.

Command:

$ ansible-playbook -i hosts playbook.yml --tags resolvconf --private-key ~/.ssh/hps
PLAY [all] **********************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
ok: [172.24.100.2]
PLAY RECAP **********************************************************************************************************************************************************************************************************************************
172.24.100.2 : ok=1 changed=0 unreachable=0 failed=0

$ cat playbook.yml

  • hosts: all
    user: hps
    sudo: true
    roles:
  • role: resolvconf
    tags:
  • resolv

$ cd ~/ansible/roles/resolvconf/tasks
$ cat main.yml

  • name: Copy resolv.conf to /etc/
    template:
    src: resolv.conf.j2
    dest: /etc/resolv.conf
    owner: root
    group: root
    mode: 0644

$ cd ~/ansible/roles/resolvconf/templates
$ cat resolv.conf.j2
nameserver 172.24.100.1

Unfortunately /etc/resolv.conf remains unchanged.

What am I missing? Thanks!

Nevermind, I found it out myself. In my playbook.yml I have named tags “resolv”, it should have been “resolvconf”.