Dear Mario,
On 02.01.17 17:52 Mario Giammarco wrote:
> Hello,
> I am trying ansible because it seems it is very simple in usage.
True. At least if you compare against the right thing...
> I have the following use case:
> - several ubuntu an debian servers (all permit login to non root users)
> - user and password is different in each server
> - I need to install a deb sources.list parametrized deb
>
http://xxxxxxx/yyyyyy/ $(lsb_release -cs) main
>
> It seems to me that this use case is very simple but I am confused:
>
> 1) I cannot find an easy way to manage the passwordless sudo use case
I would do the following:
Set up ansible vault so you can store variables in encrypted files (I
have a file that holds my vault-password, but you can also get
prompted for it if you prefer)
Put user and password for the host foobar in
host_vars/foobar/encrypted.yml via "ansible-vault create ...":
--- snip ---
---
ansible_user: your_username
ansible_become_pass: very_secret_password
--- snip ---
Repeat for each of your hosts.
Use a playbook that is run as non-root and uses sudo:
--- snip ---
- hosts: whatever
become: true
become_method: sudo
tasks:
...
--- snip ---
> 2) I cannot find how to parametrize sources.list
Template it:
https://docs.ansible.com/template_module.html
I would guess some variable like ansible_distribution could match
whatever "$(lsb_release -cs)" spits out...
Johannes