Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"msg": "You need to be root to perform this command.\n" #2

Open
jringoot opened this issue Oct 2, 2014 · 1 comment
Open

"msg": "You need to be root to perform this command.\n" #2

jringoot opened this issue Oct 2, 2014 · 1 comment

Comments

@jringoot
Copy link

jringoot commented Oct 2, 2014

Just a tiny remark: When you have the above, mostly one will want/need to use another user than root, at least to access the system.
Instead of using -u root one may prefer to add --sudo, so that the non-root ansible user will try to execute the command using sudo.
eg:
ansible ws01 -m yum -a 'pkg=vim-enhanced state=installed' -i hosts -u remadmin --sudo

Where remadmin is a user that can do keybased ssh to the system ws01 and is a nopasswd sudoer.

@tejas-2232
Copy link

I am installing apache service on rhel7

Please help me for this issue.

Thank you

The code is

- name: install latest version of apache
  yum:
    name: httpd 
    state: latest 

Issue-

 "msg": "You need to be root to perform this command.\n",
    "rc": 1,
    "results": [
        "Loaded plugins: product-id, search-disabled-repos, subscription-manager\n"
    ]

My main.yml File

---

- hosts: all
  gather_facts: true
  become: runas
  become_user: root

  roles:
  - { role: apache_http_server }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants