Git Product home page Git Product logo

Comments (4)

bcoca avatar bcoca commented on July 19, 2024 1

please show the -vvv output of the error

from ansible.

ansibot avatar ansibot commented on July 19, 2024

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

from ansible.

cortadosaxophone avatar cortadosaxophone commented on July 19, 2024

Also note that this fails the same way with this:

vars:
  ansible_user: “{{ item.user }}”

from ansible.

cortadosaxophone avatar cortadosaxophone commented on July 19, 2024

Closing this as it is a duplicate of at least #16776. Sorry to be of any trouble. Thank you for reaching out @bcoca. This is working as designed, and I found a solution to my specific problem to accommodate existing org ansible structure (as in, within a task file called in a one-entry-point playbook:

# assume I have created a list of {user: some_user, host: some_host} dicts
- name: "use inventory to get mirror hosts"
  ansible.builtin.add_host:
    ansible_ssh_host: "{{ item.host }}"
    ansible_ssh_user: "{{ item.user }}"
    inventory_hostname: "{{ item.host }}"
    groups: "mirror_hosts"
    name: "{{ item.host }}"
  loop:
    "{{ mirror_config }}"

# run_once is called because this is a task in a playbook using N hosts
- name: "do something with group"
  ansible.builtin.file:
    path: "/home/{{ ansible_ssh_user }}/touchfile.txt"
    state: "touch"
    mode: "0644"
  loop:
    "{{ groups['mirror_hosts'] }}"
  run_once: true
  delegate_to: "{{ item }}"

A colleague also sent this to me this morning: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_delegation.html#templating-in-delegation-context

from ansible.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.