# can't start service on systemd with ampersand (openvpn@server)

**URL:** <https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211>\
**Category:** Ansible Project\
**Created:** [December 23, 2013, 8:48pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211 "2013-12-23T20:48:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [December 23, 2013, 8:48pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211/1 "2013-12-23T20:48:46Z")

</div>

I’m trying to control openvpn on an arch linux server.

I am able to successfully start the service on the box with

> systemctl start openvpn@server

but when I try to do some from ansible I get:

> failed: [laprouter] =\> {“failed”: true, “item”: “”}  
> msg: Failed to issue method call: Unit name openvpn@.service is not valid.
> 
> FATAL: all hosts have already failed – aborting

Here is the part of the yml config:

> - name: Ensure openvpn service enabled  
> service:  
> name=“openvpn@server”  
> state=started

Is this an error in my configuration?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 23, 2013, 9:47pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211/2 "2013-12-23T21:47:56Z")

</div>

You shouldn’t have to provide the “at” symbol here.

---

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [December 23, 2013, 9:50pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211/3 "2013-12-23T21:50:18Z")

</div>

The @ symbol is required by systemd for dynamic daemons that load a specific configuration file. For openvpn, you can have multiple .conf files for multiple openvpn daemons. The @ is required for openvpn to work on a systemd system.

e.g. on my client I have  
systemctl start openvpn@workbench

where workbench is the name of the conf file: /etc/openvpn/workbench.conf

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 23, 2013, 9:54pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211/4 "2013-12-23T21:54:39Z")

</div>

Hmm.

Please make sure there is a github ticket filed. Or if you would like to work on this, that’s fine too 🙂

---

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [December 23, 2013, 9:57pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211/5 "2013-12-23T21:57:52Z")

</div>

Will do. I have been looking for an excuse to improve my python and figure out how ansible modules are written.

I’ll file a ticket too since I’m sure someone else will be able to patch it much more quickly than I.

---

<div class="post-metadata">

**Author:** ![ayounggun](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@ayounggun](https://forum.ansible.com/u/ayounggun)\
**Post date:** [February 7, 2014, 8:31pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211/6 "2014-02-07T20:31:07Z")

</div>

Hi guys

I’m running from source and still getting this problem - is anyone else able to use @ signs in services?

task:

- name: enable and start eth0 service  
service: name=netctl@eth0.service state=started enabled=yes

error:

TASK: [network | enable and start eth0 service] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<192.168.1.253\> ESTABLISH CONNECTION FOR USER: root  
\<192.168.1.253\> REMOTE\_MODULE service name=netctl@eth0.service state=started enabled=yes  
\<192.168.1.253\> EXEC [‘sshpass’, ‘-d10’, ‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘GSSAPIAuthentication=no’, ‘-o’, ‘PubkeyAuthentication=no’, ‘-o’, ‘User=root’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.1.253’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1391803906.5-98641080919224 && echo $HOME/.ansible/tmp/ansible-tmp-1391803906.5-98641080919224’”]  
\<192.168.1.253\> PUT /tmp/tmpxsF3YP TO /root/.ansible/tmp/ansible-tmp-1391803906.5-98641080919224/service  
\<192.168.1.253\> EXEC [‘sshpass’, ‘-d10’, ‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘GSSAPIAuthentication=no’, ‘-o’, ‘PubkeyAuthentication=no’, ‘-o’, ‘User=root’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.1.253’, “/bin/sh -c ‘/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1391803906.5-98641080919224/service; rm -rf /root/.ansible/tmp/ansible-tmp-1391803906.5-98641080919224/ \>/dev/null 2\>&1’”]  
failed: [192.168.1.253] =\> {“failed”: true, “item”: “”}  
msg: Failed to issue method call: Unit name netctl@.service is not valid.

FATAL: all hosts have already failed – aborting

ansible version:

ansible 1.5 (devel 2d88246c9d) last updated 2014/02/07 20:06:49 (GMT +100)

---

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [February 7, 2014, 11:41pm UTC](https://forum.ansible.com/t/cant-start-service-on-systemd-with-ampersand-openvpn-server/14211/7 "2014-02-07T23:41:44Z")

</div>

I haven’t had enough time to actually fix this. If someone else can do it more quickly, that would be awesome. In the meantime, will have to use the command module.
