From ef1ffc884ed63f4b61809437026645d40d389f8e Mon Sep 17 00:00:00 2001 From: Bodo Schulz Date: Tue, 23 Aug 2022 08:35:20 +0200 Subject: [PATCH] fix openrc integration --- molecule/default/prepare.yml | 21 +++++++++ molecule/default/requirements.yml | 6 ++- tasks/configure.yml | 6 +-- tasks/install.yml | 2 +- templates/init/openrc/init.d/glauth.j2 | 62 +++++++++++++++----------- 5 files changed, 65 insertions(+), 32 deletions(-) diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 1753bc1..ba57e22 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -7,6 +7,26 @@ NETRC: '' pre_tasks: + - name: arch- / artixlinux + block: + - name: update pacman system + command: | + pacman --refresh --sync --sysupgrade --noconfirm + + - name: create depends service + copy: + mode: 0755 + dest: /etc/init.d/net + content: | + #!/usr/bin/openrc-run + true + when: + - ansible_os_family | lower == 'artix linux' + + when: + - ansible_distribution | lower == 'archlinux' or + ansible_os_family | lower == 'artix linux' + - debug: msg: - "os family : {{ ansible_distribution }} ({{ ansible_os_family }})" @@ -15,6 +35,7 @@ - "python version : {{ ansible_python.version.major }}.{{ ansible_python.version.minor }}" roles: + - role: syslog-ng - role: snakeoil ... diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index b2a0c4b..f6c03ce 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -1,8 +1,10 @@ --- - name: snakeoil - src: https://github.com/bodsch/ansible-snakeoil.git - scm: git + src: bodsch.snakeoil version: 1.2.4 +- name: syslog-ng + src: bodsch.syslog_ng + ... diff --git a/tasks/configure.yml b/tasks/configure.yml index 51701ef..d28c357 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -6,7 +6,7 @@ state: directory owner: root group: "{{ glauth_system_group }}" - mode: 0770 + mode: 0775 - name: create certificate directory file: @@ -16,14 +16,14 @@ group: "{{ glauth_system_group }}" mode: 0770 -- name: create glauth.yml +- name: create glauth.conf template: src: "glauth/glauth.conf.j2" dest: "{{ glauth_config_dir }}/glauth.conf" force: true owner: root group: "{{ glauth_system_group }}" - mode: 0640 + mode: 0664 notify: - validate config - reload glauth diff --git a/tasks/install.yml b/tasks/install.yml index f5f9073..d40d060 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -33,7 +33,7 @@ file: state: directory path: "{{ glauth_install_path }}/plugins" - mode: 0750 + mode: 0755 owner: "{{ glauth_system_user }}" group: "{{ glauth_system_group }}" diff --git a/templates/init/openrc/init.d/glauth.j2 b/templates/init/openrc/init.d/glauth.j2 index a77dc5e..10ff3a1 100644 --- a/templates/init/openrc/init.d/glauth.j2 +++ b/templates/init/openrc/init.d/glauth.j2 @@ -9,14 +9,22 @@ user=${user:-${SVCNAME}} group=${group:-${SVCNAME}} command="/usr/bin/glauth" -command_args="${command_args:--config=/etc/glauth/glauth.yml}" +supervisor="supervise-daemon" + +command_args="${command_args:--config=/etc/glauth/glauth.conf}" command_user="${user}:${group}" + +command_args_background="--background" +required_files="/etc/glauth/glauth.conf" + output_log="/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log" error_log="${output_log}" extra_started_commands="reload" depend() { - after net + # need localmount net + # use dns + after sysfs net } start_pre() { @@ -25,31 +33,33 @@ start_pre() { chown -R ${command_user} /var/lib/glauth/ } -start() { - ebegin "Starting ${SVCNAME}" - - start-stop-daemon --start \ - --background \ - --exec "${command}" \ - --stdout ${output_log} \ - --stderr ${error_log} \ - --pidfile ${pidfile} \ - --user ${command_user} \ - -- ${command_args} - - pidof glauth > "${pidfile}" - - eend $? "Failed to start ${SVCNAME}" -} - -stop() { - ebegin "Stopping ${SVCNAME}" - start-stop-daemon --stop \ - --pidfile "${pidfile}" - - eend $? "Failed to stop ${SVCNAME}" -} +# start() { +# ebegin "Starting ${SVCNAME}" +# +# start-stop-daemon \ +# --start \ +# --background \ +# --exec "${command}" \ +# --stdout ${output_log} \ +# --stderr ${error_log} \ +# --make-pidfile \ +# --pidfile ${pidfile} \ +# --user ${command_user} \ +# -- ${command_args} +# +# pidof glauth > "${pidfile}" +# +# eend $? "Failed to start ${SVCNAME}" +# } +# stop() { +# ebegin "Stopping ${SVCNAME}" +# start-stop-daemon \ +# --stop \ +# --pidfile "${pidfile}" +# +# eend $? "Failed to stop ${SVCNAME}" +# } reload() { ebegin "Reloading ${SVCNAME}"