I haven't been using ansible that long, but so far I'm really liking it.
I'm running into an issue though that I'm hoping someone will be able to
shed some light on.
I have an account, foo on the server I want to run my playbook against. I'm
trying to install an rpm. I do not have permissions to become root on said
server with account foo. I do however, have the ability to install an rpm
if I run the command as "sudo yum install ..."
I've tried all sorts of things and have had pretty much zero luck:
My playbook is pretty basic for this test run:
---
- name: Test
hosts: servers
remote_user: food
become: true
become_user: foo
become_method: sudo
roles:
- jdk
My role is has one task:
- name: Install jdk
yum:
name: /tmp/jdk.rpm
state: present
My inventory file is about as basic as you can get:
[servers]
host1
My ansible.cfg is as follows:
[defaults]
callback_whitelist = profile_tasks
host_key_checking = False
log_path = /etc/ansible/ansible.log
#ask_sudo_pass = True
[ssh_connection]
ssh_args=-o ForwardAgent = yes
pipelining = True
The errors I'm getting are along the lines of:
fatal: [myserver]: FAILED! => {"changed": true, "failed": true, "msg":
"Repo rhel-7-server-optional-rpms forced skip_if_unavailable=True due to:
/etc/pki/entitlement/*******************-key.pem\nRepo rhel-7-server-rpms
forced skip_if_unavailable=True due to:
/etc/pki/entitlement/*******************-key.pem\nYou need to be root to
perform this command.\n", "rc": 1, "results": ["Loaded plugins: langpacks,
product-id, search-disabled-repos, subscription-\n :
manager\n"]}
I've tried a ton of different iterations of the settings above with zero
luck. Does anyone have any ideas on what I can do to get this to work? I
know I could run everything as a shell script... but at that point it's
hardly even ansible anymore. Thanks
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a527b017-f8d4-411c-9f7b-693d56e4f308%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.