Skip to content

Commit

Permalink
Drop owner/group from /var/lib/openstack
Browse files Browse the repository at this point in the history
These tasks run with "become: true", so the /var/lib/openstack dir
should be root owned, just like the scripts created in the dir.

Also correct the path to the tmpwatch script when it is set in the
crontab, and in the molecule verify.yml.

Signed-off-by: James Slagle <[email protected]>
  • Loading branch information
slagle committed Jan 22, 2025
1 parent 3aa0b70 commit a590bf7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions roles/edpm_logrotate_crond/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
hosts: all
gather_facts: false
tasks:

- name: install edpm_logrotate_crond
include_role:
name: "osp.edpm.edpm_logrotate_crond"
Expand Down
4 changes: 2 additions & 2 deletions roles/edpm_logrotate_crond/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

- name: Push script
ansible.builtin.stat:
path: /usr/local/sbin/containers-tmpwatch
path: /var/lib/openstack/cron/containers-tmpwatch
register: stat_result
failed_when: not stat_result.stat.exists

- name: Insert cronjob in root crontab
ansible.builtin.shell:
crontab -l
register: crontab
failed_when: "'@daily /usr/local/sbin/containers-tmpwatch' not in crontab.stdout"
failed_when: "'@daily /var/lib/openstack/cron/containers-tmpwatch' not in crontab.stdout"

- name: Ensure config directories exist
ansible.builtin.stat:
Expand Down
4 changes: 1 addition & 3 deletions roles/edpm_logrotate_crond/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
path: "/var/lib/openstack"
mode: 0755
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
setype: "container_file_t"

- name: Create /var/lib/openstack/cron
Expand Down Expand Up @@ -52,7 +50,7 @@
name: "Remove old logs"
special_time: "daily"
user: "root"
job: "/usr/local/sbin/containers-tmpwatch"
job: "/var/lib/openstack/cron/containers-tmpwatch"

- name: Configure logrotate_crond
become: true
Expand Down
2 changes: 2 additions & 0 deletions roles/edpm_logrotate_crond/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
- name: Gather local facts
ansible.builtin.setup:
gather_subset:
- "!all"
- "!min"
- "local"

- name: Install cronie
Expand Down

0 comments on commit a590bf7

Please sign in to comment.