Giter VIP home page Giter VIP logo

Comments (10)

patrickjahns avatar patrickjahns commented on July 27, 2024 1

@codezninja

From your description, the problem does not seem to be related directly to the role and more of an environment issue.
Right now it's hard to provide any guidance - as a lot of information is missing. Especially having the full text output of a run with ANSIBLE_DEBUG=true.

If you are failing with setting ANSIBLE_DEBUG=true might I suggest that you just edit the role locally and set no_log=false manually on the task?

from ansible-role-promtail.

codezninja avatar codezninja commented on July 27, 2024

I'll try and get some more debug information.

from ansible-role-promtail.

codezninja avatar codezninja commented on July 27, 2024

This is the output from that task when no_log=false
image

from ansible-role-promtail.

codezninja avatar codezninja commented on July 27, 2024

So it seems like the delegate_to: localhost was the issue that I was having when using version 1.21.0. When I comment that part out. It works as expected.

I see 1.22.0 that part was changed. So I'll test that out and report back

EDITIED: The latest version causes another issue

image

Seems like delegate_to doesn't work will with become: true with the module.

from ansible-role-promtail.

patrickjahns avatar patrickjahns commented on July 27, 2024

@codezninja

This seems still to be more of an issue with your environment / playbook. The role will not per-default elevate the privileges for the preflight tasks - please see: https://github.com/patrickjahns/ansible-role-promtail/blob/master/tasks/main.yml#L1-L22

Please share your playbook and the way you are executing your playbook - the core cause for this is most likely there

Can I also ask you, to share any issues as plaintext instead of screenshots. Screenshots are hard to read when it's text, as it is cropped to fit into size and makes it very uncomfortable to read. Thank you

from ansible-role-promtail.

codezninja avatar codezninja commented on July 27, 2024

Can I also ask you, to share any issues as plaintext instead of screenshots. Screenshots are hard to read when it's text, as it is cropped to fit into size and makes it very uncomfortable to read. Thank you

Sorry about that. Will do plaintext going forth.

Please share your playbook and the way you are executing your playbook - the core cause for this is most likely there

So the playbook is pretty simple. I'm just running this with packer with the ansible provider. When the provider ssh into the system. It is as a non-root user, since root user ssh is locked down. I use ansible become to allow that user to become root before it executes the playbook. It's able to do that since that ssh user is allowed sudo privs

The problem I think is happening is that since part of the task in the role is delegated to localhost. Ansible is trying to run sudo on my local machine which it can't so it fails to run the task. I opened a PR that fixed my problem by not escalating the user for that task but I can just leave it in my fork if it's not what you desired.

Playbook

---
- name: Setup promtail
  hosts: all
  become: true
  vars_files:
    - ./vars/default.yml
  roles:
    - { role: promtail,  tags: promtail }

default.yml

promtail_version: latest
promtail_log_level: debug
promtail_loki_server_url: https://my.domainname.com
promtail_config_scrape_configs:
- job_name: system
  static_configs:
  - targets:
      - localhost
    labels:
      job: varlogs
      host: "{{ ansible_hostname }}"
      __path__: /var/log/*log

packer config

  provisioner "ansible" {
    playbook_file        = "./ansible/site.yml"
    user                 = "provisioner"
    roles_path           = "./ansible/roles"
    galaxy_file          = "./ansible/requirements.yml"
    galaxy_force_install = true
    use_proxy            = false
  }

EDITIED:

  • added packer config and link to packer ansible docs

from ansible-role-promtail.

patrickjahns avatar patrickjahns commented on July 27, 2024

Thank you for all the information ❤️

As I've suspected, you are forcing become: true on all tasks with your current playbook. As the role already takes care of requesting elevated privileges only for tasks it requires sudo rights, it wouldn't be required to set this on the playbook level.

Can you try running the playbook without it:

---
- name: Setup promtail
  hosts: all
  vars_files:
    - ./vars/default.yml
  roles:
    - { role: promtail,  tags: promtail }

from ansible-role-promtail.

codezninja avatar codezninja commented on July 27, 2024

thats good to know. Some roles required me to elevate to root before running. Running this role without root worked. So I'll just separate out those roles into another step.

Thanks for the help.

from ansible-role-promtail.

patrickjahns avatar patrickjahns commented on July 27, 2024

Happy to hear that it's now working for you as intended 👍 . Thank you very much for the open communication and collaboration on this issue

from ansible-role-promtail.

codezninja avatar codezninja commented on July 27, 2024

thank you for a great role.

from ansible-role-promtail.

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.