Score:2

ansible-pull with --tags flag doesn't work

hm flag

I have a playbook that includes a file containing this:

- name: debug tags
  debug: 
    msg: debug tags
  tags: 
    - debugtags

When I run the following command, I would expect that only this play be executed. Instead, no play is executed. This is in a docker container on my linux desktop, so it needs to go out and get the playbook. I'm sure that the play is in the playbook. The command (edited a bit for security)

/usr/bin/ansible-pull -C dockervm -d /usr/local/ansible -U [email protected]:xxxxx-config-usr_local_ansible.git -i localhost, -e small=yes vagrant=True ServerNamePrefix=docker --accept-host-key -t debugtags /usr/local/ansible/playbooks/docker.yml

Some things to note:

  • I've tried this with both -t and --tags.
  • Without the -t or --tags, the playbook runs fine and executes all the plays - been using it for weeks

Below, find the files in question and the output

roles/docker/tasks/main.yml

    - name: check ServerNamePrefix set
      fail: msg="ServerNamePrefix not provided"
      when: ServerNamePrefix is undefined

    - include_tasks: apt_update.yml
      #- include_tasks: timezone.yml
      #- include_tasks: required_software.yml
    - include_tasks: postfix.yml
    - include_tasks: bashrc.yml
    - include_tasks: diskinit.yml
      #- include_tasks: hostfile.yml
    - include_tasks: repositories.yml
    - include_tasks: web_packages.yml
    - include_tasks: configfiles.yml
    - include_tasks: modules.yml
    - include_tasks: groups.yml
    - include_tasks: users.yml
    - include_tasks: directories.yml
    - include_tasks: wkhtmltopdf.yml
    - include_tasks: deploy_env_and_configuration.yml
    - include_tasks: pushwildcardssl.yml
    - include_tasks: touch_files.yml
    - include_tasks: debugtags.yml

roles/docker/tasks/debugtags.yml

- name: debug tags
  debug: 
    msg: debug tags
  tags: 
    - debugtags

output

[WARNING]: Could not match supplied host pattern, ignoring: 4a9190122ed4
localhost | SUCCESS => {
    "after": "777b48c3f3018bbf5078602209027da6d2b61feb",
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "before": "777b48c3f3018bbf5078602209027da6d2b61feb",
    "changed": false,
    "remote_url_changed": false
}
[WARNING]: Could not match supplied host pattern, ignoring: 4a9190122ed4

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

So I'm stumped. Any ideas?

Ed Greenberg

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.