Special kind of become

14 views
Skip to first unread message

Preben Asmussen

unread,
Sep 28, 2017, 7:18:10 AM9/28/17
to Ansible Project
Hi

I have started using Ansible resently and have a small problem. 

I have to ssh in as {someuser} and become {jvm} user to execute copy and http get task

My sites file looks like

---
# This playbook deploys  

- hosts: test-environments 
  remote_user: "{{user}}"
  become: yes
  become_user: jvm

  roles:
    - pte

the problem is that the build in become seems not to work on our linux target machine. (getting prompted for sudo password)
I guess ansible will perform a sudo su - jvm, but thats not allowed. 

I'm only allowed to execute 'sudo su -s /bin/bash - jvm' to become the jvm user

Any pointers on how that fits in with ansible ?




I'm a noob ansible user

Branko Majic

unread,
Sep 28, 2017, 7:22:56 AM9/28/17
to ansible...@googlegroups.com
Can't guarantee it, but... Could become_flags help?
(https://docs.ansible.com/ansible/latest/become.html)

Not sure you can make it invoke "sudo su -s /bin/bash - jvm" exactly,
but worth a try.

Best regards

--
Branko Majic
XMPP: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
XMPP: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.

Preben Asmussen

unread,
Sep 28, 2017, 7:55:02 AM9/28/17
to Ansible Project
Thanks 

But thats not possible to construct using become_flags

Best regards
Preben
Reply all
Reply to author
Forward
0 new messages