Do not rely on ansible_user (#214)

* Apply "become" on roles instead of plays

This leads to facts being gathered for the "regular" login user, instead
of root.

* Do not rely on ansible_user

Instead of reading ansible_user (which may or may not be defined), this
patch lets the roles rely on Ansible facts [1].

[1]: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html
This commit is contained in:
Simon Leiner authored and GitHub committed 2023-01-29 21:20:25 -06:00
1 parent e33cbe52c1
commit be3e72e173
6 files changed
+17 -14

No files matched your search

-1
View File
@@ -1,5 +1,4 @@
---
ansible_user: root
server_init_args: >-
{% if groups['master'] | length > 1 %}
{% if ansible_hostname == hostvars[groups['master'][0]]['ansible_hostname'] %}