Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The role deletes the network file it generated #21

Open
lessless opened this issue May 31, 2024 · 1 comment
Open

The role deletes the network file it generated #21

lessless opened this issue May 31, 2024 · 1 comment

Comments

@lessless
Copy link

lessless commented May 31, 2024

Hi,

Thank you for sharing this role.

I have an issue: the role deletes the network configuration file it generated, then generates it again, and the cycle continues.

First run:

ansible-playbook  playbook.yml -i hosts.ini  --vault-password-file vault_password_file.txt

PLAY [Play for configuring a Linux box to act as an HSCN gateway] *************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Find existing systemd-network config files] **********************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Calculate which systemd-network config files to delete] **********************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Create extra directories relevant for systemd-networkd] **********************************************************
ok: [192.168.66.205] => (item=/etc/systemd/networkd.conf.d/)
ok: [192.168.66.205] => (item=/etc/systemd/resolved.conf.d/)

TASK [systemd-networkd : Instantiate systemd-networkd networkd.conf drop-ins] *************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Instantiate systemd-networkd network devices] ********************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Instantiate systemd-networkd networks] ***************************************************************************
changed: [192.168.66.205] => (item=enp2s0)

TASK [systemd-networkd : Copy extra files relevant for systemd-networkd] ******************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Install systemd-resolved] ****************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Configure resolv.conf] *******************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Check if resolvconf service exists] ******************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Stop, disable, and mask resolvconf] ******************************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Instantiate systemd-resolved resolved.conf drop-ins] *************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Enable systemd-resolved] *****************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Delete existing unwanted network interfaces] *********************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Delete existing unwanted systemd-networkd configs] ***************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : meta] ************************************************************************************************************

RUNNING HANDLER [systemd-networkd : Reload systemd configuration] *************************************************************************
ok: [192.168.66.205]

RUNNING HANDLER [systemd-networkd : Restart systemd-networkd service] *********************************************************************
changed: [192.168.66.205]

TASK [systemd-networkd : Enable systemd-networkd service] *********************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Disable legacy networking] ***************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Remove content from /etc/network/interfaces] *********************************************************************
ok: [192.168.66.205]

Second run:

ansible-playbook  playbook.yml -i hosts.ini  --vault-password-file vault_password_file.txt

PLAY [Play for configuring a Linux box to act as an HSCN gateway] *************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Find existing systemd-network config files] **********************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Calculate which systemd-network config files to delete] **********************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Create extra directories relevant for systemd-networkd] **********************************************************
ok: [192.168.66.205] => (item=/etc/systemd/networkd.conf.d/)
ok: [192.168.66.205] => (item=/etc/systemd/resolved.conf.d/)

TASK [systemd-networkd : Instantiate systemd-networkd networkd.conf drop-ins] *************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Instantiate systemd-networkd network devices] ********************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Instantiate systemd-networkd networks] ***************************************************************************
ok: [192.168.66.205] => (item=enp2s0)

TASK [systemd-networkd : Copy extra files relevant for systemd-networkd] ******************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Install systemd-resolved] ****************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Configure resolv.conf] *******************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Check if resolvconf service exists] ******************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Stop, disable, and mask resolvconf] ******************************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Instantiate systemd-resolved resolved.conf drop-ins] *************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Enable systemd-resolved] *****************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Delete existing unwanted network interfaces] *********************************************************************
skipping: [192.168.66.205]

TASK [systemd-networkd : Delete existing unwanted systemd-networkd configs] ***************************************************************
changed: [192.168.66.205] => (item=/etc/systemd/network/enp2s0.network)

TASK [systemd-networkd : meta] ************************************************************************************************************

RUNNING HANDLER [systemd-networkd : Reload systemd configuration] *************************************************************************
ok: [192.168.66.205]

RUNNING HANDLER [systemd-networkd : Restart systemd-networkd service] *********************************************************************
changed: [192.168.66.205]

TASK [systemd-networkd : Enable systemd-networkd service] *********************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Disable legacy networking] ***************************************************************************************
ok: [192.168.66.205]

TASK [systemd-networkd : Remove content from /etc/network/interfaces] *********************************************************************
ok: [192.168.66.205]

My system: Debian GNU/Linux 12 (bookworm)

ansible --version
ansible [core 2.16.7]
  config file = None
  configured module search path = ['/Users/yevheniikurtov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/9.6.0/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/yevheniikurtov/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] (/opt/homebrew/Cellar/ansible/9.6.0/libexec/bin/python)
  jinja version = 3.1.4
  libyaml = True

requirements.yml:

- src: https://github.com/stuvusIT/ansible_systemd_network.git
  name: systemd-networkd

playbook.yml:

- name: Play for configuring a Linux box to act as an HSCN gateway
  hosts: all
  become: true
  vars_files:
    - vault.yml
    - vars.yml
  roles:
    - role: systemd-networkd
      systemd_network_networks:
        "{{uplink_if}}":
          Network:
            DHCP: ipv4

vars.yml:

---
uplink_if: enp2s0
fleet_if: eno2

@haslersn
Copy link
Member

This role probably doesn't support using jinja2 templates in the filenames. Can you try using a different filename, i.e.,:

      systemd_network_networks:
        uplink:
          Match:
            Name: "{{uplink_if}}"
          Network:
            DHCP: ipv4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants