ansible-examples icon indicating copy to clipboard operation
ansible-examples copied to clipboard

Feature Example: Install a sample software without root access and traverse multiple user/role

Open getkub opened this issue 8 years ago • 4 comments

Our scenario is

  • Systems are all Linux
  • Our Ansible hosting server, we don't have root access nor shared user. Say I use "john_server" as user on ansible hosted server where code is going to be deployed.
  • On Ansible hosting server, "john_server" can sudo to "ansible" (using password or key)
  • On Client system, we don't have root access. So SSH to client system as "john_client" user on client
  • On Client system, "john_client" can sudo to "myapplication_user" (using password or key)
  • On Client system, the configuration has to be managed as "myapplication_user"

Can you please write an example to cover such a scenario? ansible_connection

Thanks in advance.

getkub avatar Apr 14 '17 21:04 getkub

Hi

Have you tried with ping command first !

Which is best way to check connectivity.

barotashish avatar Apr 14 '17 21:04 barotashish

ansible host-list -m ping ansible -i inventory-file -a "hostname"

barotashish avatar Apr 14 '17 22:04 barotashish

it is not just about connectivity and reaching the client, but rather It is about the whole process of how ansible could do the deployment in an enterprise through all stages. (eg. It may need to write to /tmp/, how to write 4 stage credentials etc.) and then sudo to client user-id and best practices etc.

getkub avatar Apr 14 '17 22:04 getkub

Can you please check this one.

Example: Ansible Control Machine: ansadm Ansible Client Machine: ansadm Password Authentication mechanism: password less

  1. Create user ansible control and ansible client machine.
  2. Generate SSH key using ssh-keygen command
  3. Copy public id from control machine to client machine. Command: ssh-copy-id
  4. Provide sudo access to user by using command visudo
  5. Create ansible playbook to install package `---
  • name: TaskA hosts: plabs.com tasks:
    • name: ensure nano is install yum: name: nano state: latest`
  1. To execute playbook #ansible-playbook installapp.yaml -b

imchavda avatar Feb 23 '21 09:02 imchavda