From 6f44cd8c312a143566851a9c9368810293c44d7d Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 3 Jun 2020 09:07:54 +0200 Subject: [PATCH] Stop supporting non-systemd systems All currently supported systems use systemd, so let's simplify the templates. Change-Id: I66dfeedbff76bd2acd843b9ccffe8c79bc40391b --- .../defaults/required_defaults_Debian_family.yml | 2 -- .../defaults/required_defaults_Fedora.yml | 2 -- .../defaults/required_defaults_RedHat_family.yml | 2 -- .../defaults/required_defaults_Suse_family.yml | 2 -- .../defaults/required_defaults_Ubuntu.yml | 2 -- .../roles/bifrost-ironic-install/tasks/bootstrap.yml | 11 +++++------ .../tasks/inspector_bootstrap.yml | 6 +++++- .../roles/bifrost-ironic-install/tasks/start.yml | 1 - .../templates/systemd_template.j2 | 2 +- .../defaults/required_defaults_Debian_family.yml | 2 -- .../defaults/required_defaults_RedHat_family.yml | 2 -- .../defaults/required_defaults_Suse_family.yml | 2 -- .../defaults/required_defaults_Ubuntu.yml | 2 -- .../bifrost-keystone-install/tasks/bootstrap.yml | 4 ++-- .../roles/bifrost-keystone-install/tasks/start.yml | 1 - .../templates/systemd_template.j2 | 2 +- 16 files changed, 14 insertions(+), 31 deletions(-) diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml index 1e117d4db..0427d42a6 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /lib/systemd/system/ -init_ext: .service ipxe_dir: /usr/lib/ipxe/ ipxe_full_binary: ipxe.pxe ironic_rootwrap_dir: /usr/local/bin/ diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora.yml index 6ec595178..b309e56cb 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /usr/lib/systemd/system/ -init_ext: .service ipxe_dir: /usr/share/ipxe/ ipxe_full_binary: ipxe.lkrn ironic_rootwrap_dir: /usr/bin/ diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml index 4be5818fb..99190ada4 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /usr/lib/systemd/system/ -init_ext: .service ipxe_dir: /usr/share/ipxe/ ipxe_full_binary: ipxe.lkrn ipxe_efi_binary: ipxe-x86_64.efi diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml index 9dac2e220..b3e72fa5a 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /usr/lib/systemd/system/ -init_ext: .service # NOTE (cinerama): The iPXE binaries are not currently packaged for SuSE, # so we download them and install them to /usr/local/share/ipxe. If the # files are packaged, download_ipxe can be removed and ipxe_dir set to diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu.yml index e5b1dabd3..b9518c244 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /lib/systemd/system/ -init_ext: .service required_packages: - mariadb-server - python3-dev diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index 2be3f22f0..10a67d6d1 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -153,12 +153,11 @@ ironic.database.host != 'localhost' or test_created_db.changed | bool == false -- name: "Create service folder if systemd template is defined" +- name: "Create service folder" file: path: "{{ init_dest_dir }}" state: directory mode: 0755 - when: init_template == 'systemd_template.j2' - name: "Install ironic-inspector to permit use of inspection interface" include: inspector_bootstrap.yml @@ -183,8 +182,8 @@ - name: "Place ironic services on Debian family" template: - src: "{{ init_template }}" - dest: "{{ init_dest_dir }}{{ item.service_name }}{{ init_ext }}" + src: systemd_template.j2 + dest: "{{ init_dest_dir }}{{ item.service_name }}.service" owner: "root" group: "root" with_items: @@ -195,8 +194,8 @@ - name: "Place ironic services on RedHat family" template: - src: "{{ init_template }}" - dest: "{{ init_dest_dir }}{{ item.service_name }}{{ init_ext }}" + src: systemd_template.j2 + dest: "{{ init_dest_dir }}{{ item.service_name }}.service" owner: "root" group: "root" with_items: diff --git a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml index 75a1802e1..68385e280 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml @@ -96,7 +96,11 @@ register: ironic_install_prefix environment: "{{ bifrost_venv_env if enable_venv else {} }}" - name: "Inspector - Place service" - template: src={{ init_template }} dest={{ init_dest_dir }}{{item.service_name}}{{ init_ext }} owner=root group=root + template: + src: systemd_template.j2 + dest: "{{ init_dest_dir }}{{item.service_name}}.service" + owner: root + group: root with_items: - { service_path: "{{ ironic_install_prefix.stdout | default('') }}", service_name: 'ironic-inspector', username: 'ironic', args: '--config-file /etc/ironic-inspector/inspector.conf'} - name: "Inspector - Explicitly permit TCP/5050 for ironic-inspector callback" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/start.yml b/playbooks/roles/bifrost-ironic-install/tasks/start.yml index 8bfa106bb..bf0e2d5b7 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/start.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/start.yml @@ -15,7 +15,6 @@ --- - name: "Reload systemd configuration" command: systemctl daemon-reload - when: init_template == 'systemd_template.j2' - name: "Ensure rsyslog is running with current config" service: name=rsyslog state=restarted diff --git a/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 b/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 index 1b5a384f3..e9120ce44 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 @@ -7,4 +7,4 @@ User={{ item.username }} [Install] WantedBy=multi-user.target -Alias={{ item.service_name }}{{ init_ext }} +Alias={{ item.service_name }}.service diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml index a18886934..5697fa5b4 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /lib/systemd/system/ -init_ext: .service nginx_user: www-data mysql_service_name: mysql required_packages: diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml index b223f6eb3..4ce713b8f 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /usr/lib/systemd/system/ -init_ext: .service ipxe_dir: /usr/share/ipxe/ ipxe_full_binary: ipxe.lkrn ipxe_efi_binary: ipxe-x86_64.efi diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml index 93b44eacf..5bf87b855 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /usr/lib/systemd/system/ -init_ext: .service mysql_service_name: mysql required_packages: - python-selinux diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu.yml index 2f199ddaa..5734cddc7 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu.yml @@ -1,7 +1,5 @@ --- -init_template: systemd_template.j2 init_dest_dir: /lib/systemd/system/ -init_ext: .service required_packages: - mariadb-server - python3-dev diff --git a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml index b69370b52..eadffdcff 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml @@ -269,8 +269,8 @@ - name: "Place uwsgi services" template: - src: "{{ init_template }}" - dest: "{{ init_dest_dir }}{{ item.service_name }}{{ init_ext }}" + src: systemd_template.j2 + dest: "{{ init_dest_dir }}{{ item.service_name }}.service" owner: "root" group: "root" with_items: diff --git a/playbooks/roles/bifrost-keystone-install/tasks/start.yml b/playbooks/roles/bifrost-keystone-install/tasks/start.yml index 3d712d196..17eddf59e 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/start.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/start.yml @@ -13,7 +13,6 @@ --- - name: "Reload systemd configuration" command: systemctl daemon-reload - when: init_template == 'systemd_template.j2' - name: "Ensure services are running with current config" service: name={{ item }} state=restarted enabled=yes diff --git a/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 b/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 index 7b134370e..378a2e40d 100644 --- a/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 +++ b/playbooks/roles/bifrost-keystone-install/templates/systemd_template.j2 @@ -12,4 +12,4 @@ User={{ item.username }} [Install] WantedBy=multi-user.target -Alias={{ item.service_name }}{{ init_ext }} +Alias={{ item.service_name }}.service