Hello Brian,
I have made some tests and it seems that hosts conditional it is not
working for the instances that cannot login (either root or fedora, tested
both).
First test:
If i create the group according to fedora access rules, the group for the
centos instances it is not created:
---
you really only need 1 group, not sure why both did not get created though.
with one group you can have these play targets:
- hosts: group
- hosts: all:!group
^ first will target all hosts in the group, the 2nd all hosts NOT in the group.
--
Brian Coca
--
You received this message because
Thank you Brian for your reply.
Based on your suggestions, i created this playbook:
(create two groups and then apply the role to each subset)
- hosts: all
remote_user: root
gather_facts: false
tasks:
- ping:
register: rootlogin
ignore_errors: true
- group_by: key=fedor
There are several ways, the easiest is if your inventory script
provides OS info:
remote_user: "{{ansible_distibution == 'Fedora'|ternary('fedora', 'root')
If you have no info ahead of time you can test connecting and then use
group_by (example below) or the same expression above on the result
va
Hello,
I am creating a role to upgrade my servers. Some are CentOS others are
Fedora. CentOS servers use remote_user: root and Fedora servers
remote_user: fedora
How can i setup my playbook to use one remote_user according to
ansible_distribution?
In the Ansible FAQ there is a section that d