debops / ansible-ifupdown

Manage network interface configuration in /etc/network/interfaces
GNU General Public License v3.0
25 stars 14 forks source link

Failure when running without systemd #62

Closed dop251 closed 7 years ago

dop251 commented 7 years ago

I'm running Jessie without systemd. Trying to run ifupdown gives the following error:

/root/.ansible/tmp/ansible-tmp-1481831976.28-70132869526585/ifupdown-reconfigure-interfaces: line 323: systemd_ifup_instances: unbound variable

drybjed commented 7 years ago

Thanks for the heads up. Do you know if this issue shows up on Debian Wheezy as well? I will check this out on a system without systemd init ASAP.

dop251 commented 7 years ago

It works fine on wheezy

drybjed commented 7 years ago

As I thought. Any good guide to switch the init system on Jessie? Which one are you using, btw?

dop251 commented 7 years ago

I use the following ansible task:

- name: install sysV
  apt: name={{item}} state=latest
  with_items:
  - sysvinit-core
  - sysvinit
  - sysvinit-utils

- name: restart machine
  command: shutdown -r now "Ansible updates triggered"
  # command: /bin/true
  async: 0
  poll: 0
  ignore_errors: true

- name: waiting for server to shutdown
  local_action: wait_for host={{ inventory_hostname }} port=22
                state=stopped
  sudo: false

- name: waiting for server to come back
  local_action: wait_for host={{ inventory_hostname }} port=22
                state=started
  sudo: false

- name: purge systemd
  shell: "{{ item }}"
  with_items:
  - apt-get remove -y --purge --auto-remove systemd
  - |
    echo 'Package: systemd\nPin: origin ""\nPin-Priority: -1' > /etc/apt/preferences.d/systemd
  - |
    echo '\n\nPackage: *systemd*\nPin: origin ""\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd

Note, when I re-run it on a clean system I got the following error:

TASK [debops.ifupdown : Reload systemd services] *******************************
fatal: [178.62.106.123]: FAILED! => {"changed": false, "cmd": "systemctl daemon-reload", "failed": true, "msg": "[Errno 2] No such file or directory", "rc": 2}
drybjed commented 7 years ago

Thanks, I'll check that out shortly.

drybjed commented 7 years ago

@dop251 The issue should be fixed now, can you confirm?

dop251 commented 7 years ago

It works fine now, many thanks!