Drop service facts usage
This change switches from using service facts to using systemctl commands to do service checks. This is done to reduce the amount of memory used as part of the deployment. Change-Id: I0cd5b24933e50680baefd055d6e68e277ab09315 Related-Bug: #1915761
This commit is contained in:
parent
07ae72b21a
commit
f9100964f9
@ -7,8 +7,11 @@
|
|||||||
- name: Ensure /var/log/journal exists
|
- name: Ensure /var/log/journal exists
|
||||||
become: true
|
become: true
|
||||||
file: path=/var/log/journal state=directory mode=0750 owner=root group=root setype=var_log_t
|
file: path=/var/log/journal state=directory mode=0750 owner=root group=root setype=var_log_t
|
||||||
- name: Populate service facts
|
- name: Check cloud-init status
|
||||||
service_facts:
|
shell: systemctl is-active cloud-init.service || systemctl is-enabled cloud-init.service
|
||||||
|
failed_when: false
|
||||||
|
become: true
|
||||||
|
register: cloud_init_enabled
|
||||||
- name: Wait for cloud-init to finish, if enabled
|
- name: Wait for cloud-init to finish, if enabled
|
||||||
cloud_init_data_facts:
|
cloud_init_data_facts:
|
||||||
filter: status
|
filter: status
|
||||||
@ -18,9 +21,9 @@
|
|||||||
not res.cloud_init_data_facts.status.v1.stage
|
not res.cloud_init_data_facts.status.v1.stage
|
||||||
retries: 50
|
retries: 50
|
||||||
delay: 5
|
delay: 5
|
||||||
when: >
|
when:
|
||||||
'cloud-init.service' in ansible_facts.services and
|
- cloud_init_enabled.rc is defined
|
||||||
ansible_facts.services['cloud-init.service']['status'] == 'enabled'
|
- cloud_init_enabled.rc == 0
|
||||||
- name: Create /var/lib/container-puppet
|
- name: Create /var/lib/container-puppet
|
||||||
become: true
|
become: true
|
||||||
no_log: True
|
no_log: True
|
||||||
|
@ -1424,8 +1424,11 @@ outputs:
|
|||||||
- name: disable KSM on compute
|
- name: disable KSM on compute
|
||||||
when: not compute_ksm_enabled|bool
|
when: not compute_ksm_enabled|bool
|
||||||
block:
|
block:
|
||||||
- name: Populate service facts (ksm)
|
- name: Check for ksm
|
||||||
service_facts: # needed to make yaml happy
|
shell: systemctl is-active ksm.service || systemctl is-enabled ksm.service
|
||||||
|
become: true
|
||||||
|
failed_when: false
|
||||||
|
register: ksm_service_check
|
||||||
- name: disable KSM services
|
- name: disable KSM services
|
||||||
service:
|
service:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
@ -1434,7 +1437,9 @@ outputs:
|
|||||||
with_items:
|
with_items:
|
||||||
- ksm.service
|
- ksm.service
|
||||||
- ksmtuned.service
|
- ksmtuned.service
|
||||||
when: "'ksm.service' in ansible_facts.services"
|
when:
|
||||||
|
- ksm_service_check.rc is defined
|
||||||
|
- ksm_service_check.rc == 0
|
||||||
register: ksmdisabled
|
register: ksmdisabled
|
||||||
# When KSM is disabled, any memory pages that were shared prior to
|
# When KSM is disabled, any memory pages that were shared prior to
|
||||||
# deactivating KSM are still shared. To delete all of the PageKSM
|
# deactivating KSM are still shared. To delete all of the PageKSM
|
||||||
@ -1442,13 +1447,12 @@ outputs:
|
|||||||
- name: delete PageKSM after disable ksm on compute
|
- name: delete PageKSM after disable ksm on compute
|
||||||
command: echo 2 >/sys/kernel/mm/ksm/run
|
command: echo 2 >/sys/kernel/mm/ksm/run
|
||||||
when:
|
when:
|
||||||
- "'ksm.service' in ansible_facts.services"
|
- ksm_service_check.rc is defined
|
||||||
|
- ksm_service_check.rc == 0
|
||||||
- ksmdisabled is changed
|
- ksmdisabled is changed
|
||||||
- name: enable KSM on compute
|
- name: enable KSM on compute
|
||||||
when: compute_ksm_enabled|bool
|
when: compute_ksm_enabled|bool
|
||||||
block:
|
block:
|
||||||
- name: Populate service facts (ksm)
|
|
||||||
service_facts: # needed to make yaml happy
|
|
||||||
# mschuppert: we can remove the CentOS/RHEL split here when CentOS8/
|
# mschuppert: we can remove the CentOS/RHEL split here when CentOS8/
|
||||||
# RHEL8 is available and we have the same package name providing the
|
# RHEL8 is available and we have the same package name providing the
|
||||||
# KSM services
|
# KSM services
|
||||||
|
@ -106,14 +106,19 @@ outputs:
|
|||||||
dport: 123
|
dport: 123
|
||||||
proto: udp
|
proto: udp
|
||||||
host_prep_tasks:
|
host_prep_tasks:
|
||||||
- name: Populate service facts (chrony)
|
- name: Check for NTP service
|
||||||
service_facts: # needed to make yaml happy
|
shell: systemctl is-active ntpd.service || systemctl is-enabled ntpd.service
|
||||||
|
failed_when: false
|
||||||
|
become: true
|
||||||
|
register: ntp_service_check
|
||||||
- name: Disable NTP before configuring Chrony
|
- name: Disable NTP before configuring Chrony
|
||||||
service:
|
service:
|
||||||
name: ntpd
|
name: ntpd
|
||||||
state: stopped
|
state: stopped
|
||||||
enabled: no
|
enabled: no
|
||||||
when: "'ntpd.service' in ansible_facts.services"
|
when:
|
||||||
|
- ntp_service_check.rc is defined
|
||||||
|
- ntp_service_check.rc == 0
|
||||||
- name: Install, Configure and Run Chrony
|
- name: Install, Configure and Run Chrony
|
||||||
include_role:
|
include_role:
|
||||||
name: chrony
|
name: chrony
|
||||||
|
Loading…
Reference in New Issue
Block a user