Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8.2 | Ensure GDM login banner is configured (Automated) | Configure banner-message-enable if gdm3 installed fails #24

Open
omerfsen opened this issue Aug 28, 2022 · 4 comments

Comments

@omerfsen
Copy link

omerfsen commented Aug 28, 2022

1.8.2, 1.8.3, 1.8.4 are failing while building packer image.

TASK [darkwizard242.cis_ubuntu_2004 : 1.8.2 | Ensure GDM login banner is configured (Automated) | Configure banner-message-enable if gdm3 installed] is failing because file does not exist (or installed by OS)

{"changed": false, "msg": "Destination /etc/gdm3/greeter.dconf-defaults does not exist !", "rc": 257}

ISSUE TYPE

  • Bug Report

ANSIBLE VERSION

ansible --version
ansible [core 2.12.8]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True
root@f036d784698e:~/rd-ih-ubuntu-vm-template# ansible-config dump --only-changed
root@f036d784698e:~/rd-ih-ubuntu-vm-template# 
 cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

STEPS TO REPRODUCE

Just run ansible against ubuntu 20.04.4

 - name: darkwizard242.cis_ubuntu_2004
   version: 3.1.0

EXPECTED RESULTS

If file does not exist skip this test

ACTUAL RESULTS

Even file does not exist it tries to run it and fails. This file is not installed by OS pkg manager (apt)

dpkg -l  /etc/gdm3/greeter.dconf-defaults 
dpkg-query: no packages found matching /etc/gdm3/greeter.dconf-defaults
, did rescue? False, did start at task? False
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.23219: getting the next task for host default
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.23254: done getting next task for host default
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.23264:  ^ task is: None
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.23276:  ^ state is: HOST STATE: block=8, task=27, rescue=0, always=0, run_state=ITERATING_COMPLETE, fail_state=FAILED_TASKS, pending_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu: fatal: [default]: FAILED! => {"changed": false, "msg": "Destination /etc/gdm3/greeter.dconf-defaults does not exist !", "rc": 257}
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.24264: no more pending results, returning what we have
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.24308: results queue empty
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.24347: checking for any_errors_fatal
2022-08-28T20:01:06+01:00:     vsphere-iso.ubuntu:  42513 1661713266.24380: done checking for any_errors_fatal

I think this file is created AFTER OS is first booted but since we use packer to build it this file does not exist yet.

@darkwizard242
Copy link
Owner

@omerfsen - Apologies for the delay.

When you get a chance, can you share the output of the following commands please:

dpkg -s gdm3

AND

dpkg -l | grep -i gdm3

@omerfsen
Copy link
Author

Yes that is the reason. There was no package installed. There must be a check that checks if package installed and then edit conf

@darkwizard242
Copy link
Owner

Thank you for bringing this to my attention, I will try to get a fix in as time permits. In the meantime, as a workaround - please set the following vars in your playbook to avoid a failure:

ubuntu_2004_cis_section1_rule_1_8_2: false
ubuntu_2004_cis_section1_rule_1_8_3: false
ubuntu_2004_cis_section1_rule_1_8_4: false

Example playbook (with above mentioned vars):

---
- name: Example Playbook to apply cis_ubuntu_2004 role
  hosts: localhost  # or any grouping of hosts
  connection: local  # or 'ssh'
  become: yes
  gather_facts: true
  roles:
    - cis_ubuntu_2004
  vars:
    ansible_python_interpreter: /usr/bin/python3
    ubuntu_2004_cis_section1_rule_1_8_2: false
    ubuntu_2004_cis_section1_rule_1_8_3: false
    ubuntu_2004_cis_section1_rule_1_8_4: false

@omerfsen
Copy link
Author

Yes it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants