Reputation: 1
name: init managed node user: root hosts: init_clients become: yes gather_facts: yes ignore_errors: no vars: user: ansible-admin passwd: password-hash
roles:
Upvotes: -1
Views: 102
Reputation: 1
My issue is that Ansible still needs to run the first Playbook as some user if that user is the same for all systems (root for example).
That's ok if the user is not the same.
I have to run the playbook once for Rhel and once for Debian and then change the "user" statement to a differener user.
Upvotes: -1
Reputation: 1986
100% real code. But if I didn't have it at my fingertips, I would skip answering this question, as there's no indication of any effort on your part.
- name: Set the system user name for Ubuntu
set_fact:
linux_system_user: ubuntu
when: ansible_os_family == 'Debian'
- name: Set the system user name for CentOS
set_fact:
linux_system_user: centos
when: ansible_distribution == 'CentOS'
- name: Set the system user name for RedHat
set_fact:
linux_system_user: root
when: ansible_distribution == 'RedHat'
Upvotes: 1