lxc connection plugin - sudo first?

14 views
Skip to first unread message

Richard Hector

unread,
Apr 7, 2018, 8:29:05 AM4/7/18
to ansible...@googlegroups.com
Hi all,

I'm trying to use the lxc connection plugin, but it says that my
container isn't running. Presumably that's because ansible isn't running
as root. Is there a way to tell it to sudo before connecting?

I'm aware of course of how to sudo _afterwards_, ie on the target
system, to do anything useful, but I need to connect first.

I need to do this to set up the container for ssh, so I can continue
with that later.

Thanks,

Richard

Richard Hector

unread,
Apr 10, 2018, 5:48:12 AM4/10/18
to ansible...@googlegroups.com
I can't see how to use this at all without being root.

Is it considered acceptable to email the plugin author directly?

Thanks,
Richard

Kai Stian Olstad

unread,
Apr 10, 2018, 5:57:46 AM4/10/18
to ansible...@googlegroups.com
On 10.04.2018 11:47, Richard Hector wrote:
> I can't see how to use this at all without being root.

Add your user to the lxd group (your distro might use another group name
for access)


> On 08/04/18 00:28, Richard Hector wrote:
>> Hi all,
>>
>> I'm trying to use the lxc connection plugin, but it says that my
>> container isn't running. Presumably that's because ansible isn't
>> running
>> as root. Is there a way to tell it to sudo before connecting?

You can run sudo ansible-playbook and/or sudo ansible.


--
Kai Stian Olstad

Richard Hector

unread,
Apr 10, 2018, 6:24:17 AM4/10/18
to ansible...@googlegroups.com
On 10/04/18 21:57, Kai Stian Olstad wrote:
> On 10.04.2018 11:47, Richard Hector wrote:
>> I can't see how to use this at all without being root.
>
> Add your user to the lxd group (your distro might use another group name
> for access)

I have no lxd group; I'm not using lxd. Lxc only. Perhaps this plugin
actually requires lxd? I suspect not, though; there's also an lxd plugin.

>> On 08/04/18 00:28, Richard Hector wrote:
>>> Hi all,
>>>
>>> I'm trying to use the lxc connection plugin, but it says that my
>>> container isn't running. Presumably that's because ansible isn't running
>>> as root. Is there a way to tell it to sudo before connecting?
>
> You can run sudo ansible-playbook and/or sudo ansible.

Yes. I'd kind of rather not use root for the whole of
ansible(-playbook), but maybe it's necessary.

Thanks,
Richard

Kai Stian Olstad

unread,
Apr 10, 2018, 6:47:00 AM4/10/18
to ansible...@googlegroups.com
On 10.04.2018 12:23, Richard Hector wrote:
> On 10/04/18 21:57, Kai Stian Olstad wrote:
>> On 10.04.2018 11:47, Richard Hector wrote:
>>> I can't see how to use this at all without being root.
>>
>> Add your user to the lxd group (your distro might use another group
>> name
>> for access)
>
> I have no lxd group; I'm not using lxd. Lxc only. Perhaps this plugin
> actually requires lxd? I suspect not, though; there's also an lxd
> plugin.

Ah I see, I'm preoccupied by lxd at the moment so they have come
synonyms.


>>> On 08/04/18 00:28, Richard Hector wrote:
>>>> Hi all,
>>>>
>>>> I'm trying to use the lxc connection plugin, but it says that my
>>>> container isn't running. Presumably that's because ansible isn't
>>>> running
>>>> as root. Is there a way to tell it to sudo before connecting?
>>
>> You can run sudo ansible-playbook and/or sudo ansible.
>
> Yes. I'd kind of rather not use root for the whole of
> ansible(-playbook), but maybe it's necessary.

You can create a bare minimum playbook to setup ssh that you run with
sudo, and the rest with a normal user over ssh in another playbook.


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages