diff --git a/ansible/disable-glean.yml b/ansible/disable-glean.yml new file mode 100644 index 000000000..b57dbc61f --- /dev/null +++ b/ansible/disable-glean.yml @@ -0,0 +1,8 @@ +--- +# Glean/simple-init is useful for reading configdrive data when provisioning +# servers but gets in the way after this as it tries to enable all network +# interfaces. In some cases this can lead to timeouts. +- name: Ensure Glean is disabled and its artifacts are removed + hosts: seed:controllers + roles: + - role: disable-glean diff --git a/ansible/roles/disable-glean/README.md b/ansible/roles/disable-glean/README.md new file mode 100644 index 000000000..0fdf19499 --- /dev/null +++ b/ansible/roles/disable-glean/README.md @@ -0,0 +1,37 @@ +Disable Glean +============= + +Ansible role to disable services and remove artifacts left after using +[Glean](https://github.com/openstack-infra/glean>). + +Glean enables DHCP on all network interfaces that are not explicitly +configured. If no DHCP server is configured to make an offer to these +interfaces, they will time out on boot and cause the network service to fail. + +Requirements +------------ + +None + +Role Variables +-------------- + +None + +Dependencies +------------ + +None + +Example Playbook +---------------- + + --- + - hosts: all + roles: + - role: disable-glean + +Author Information +------------------ + +- Mark Goddard () diff --git a/ansible/roles/disable-glean/handlers/main.yml b/ansible/roles/disable-glean/handlers/main.yml new file mode 100644 index 000000000..9b32ccff3 --- /dev/null +++ b/ansible/roles/disable-glean/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: Reload systemd daemon + command: systemctl daemon-reload + become: True diff --git a/ansible/roles/disable-glean/tasks/main.yml b/ansible/roles/disable-glean/tasks/main.yml new file mode 100644 index 000000000..e1188166d --- /dev/null +++ b/ansible/roles/disable-glean/tasks/main.yml @@ -0,0 +1,38 @@ +--- +- name: Check for existing Glean systemd services + command: systemctl list-units glean*.service --no-legend --no-pager + register: glean_services + changed_when: False + +- name: Ensure Glean services are stopped and disabled + service: + name: "{{ item.split()[0] }}" + state: stopped + enabled: no + with_items: "{{ glean_services.stdout_lines }}" + +- name: Find interface configuration files created by Glean + find: + path: "/etc/sysconfig/network-scripts" + pattern: "ifcfg-*" + # This comment is added by Glean to interface configuration files. + contains: "# Automatically generated, do not edit" + register: interface_configs + +- name: Ensure interface configuration files created by Glean are removed + file: + path: "{{ item }}" + state: absent + with_items: "{{ interface_configs.files | map(attribute='path') | list }}" + become: True + +- name: Ensure Glean artifacts are removed + file: + path: "{{ item }}" + state: absent + with_items: + - "/usr/lib/systemd/system/glean@.service" + - "/etc/udev/rules.d/99-glean.rules" + become: True + notify: + - Reload systemd daemon diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py index bc5fd9317..d23bdb369 100644 --- a/kayobe/cli/commands.py +++ b/kayobe/cli/commands.py @@ -256,7 +256,7 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin, playbooks += _build_playbook_list("wipe-disks") playbooks += _build_playbook_list( "dev-tools", "disable-selinux", "network", "ip-routing", "snat", - "ntp", "lvm") + "disable-glean", "ntp", "lvm") self.run_kayobe_playbooks(parsed_args, playbooks, limit="seed") self.run_kolla_ansible_seed(parsed_args, "bootstrap-servers", extra_vars={"ansible_user": ansible_user}) @@ -379,7 +379,8 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin, if parsed_args.wipe_disks: playbooks += _build_playbook_list("wipe-disks") playbooks += _build_playbook_list( - "dev-tools", "disable-selinux", "network", "ntp", "lvm") + "dev-tools", "disable-selinux", "network", "disable-glean", "ntp", + "lvm") self.run_kayobe_playbooks(parsed_args, playbooks, limit="controllers") extra_vars = {"ansible_user": ansible_user} self.run_kolla_ansible_overcloud(parsed_args, "bootstrap-servers",