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

'__sshd_required_facts' is undefined on Amazon Linux 2023 #261

Open
nomike opened this issue Oct 12, 2023 · 5 comments
Open

'__sshd_required_facts' is undefined on Amazon Linux 2023 #261

nomike opened this issue Oct 12, 2023 · 5 comments

Comments

@nomike
Copy link

nomike commented Oct 12, 2023

I'm getting this error on Amazon Linux 2023:

TASK [willshersystems.sshd : Ensure ansible_facts used by role] ***********************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'not ansible_facts.keys() | list | intersect(__sshd_required_facts) == __sshd_required_facts' failed. The error was: error while evaluating conditional (not ansible_facts.keys() | list | intersect(__sshd_required_facts) == __sshd_required_facts): '__sshd_required_facts' is undefined. '__sshd_required_facts' is undefined\n\nThe error appears to be in '/root/.ansible/roles/willshersystems.sshd/tasks/variables.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Ensure ansible_facts used by role\n  ^ here\n"}
# ansible --version
ansible [core 2.15.5]
  config file = /root/ansible_bootstrap/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.16 (main, Feb 23 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
# cat /etc/os-release
NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
SUPPORT_END="2028-03-01"
@nomike
Copy link
Author

nomike commented Oct 12, 2023

I guess an appropriately named file needs to be put in vars/ to fix this.

If someone could tell me what the file should be named like, I could submit a pull request.

@nomike
Copy link
Author

nomike commented Oct 12, 2023

I was too quick.

The issue is this:

# ansible-galaxy install willshersystems.sshd --force -vvv
ansible-galaxy [core 2.15.5]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-galaxy
  python version = 3.9.16 (main, Sep  8 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
No config file found; using defaults
Starting galaxy role install process
Processing role willshersystems.sshd
Opened /root/.ansible/galaxy_token
- downloading role 'sshd', owned by willshersystems
- downloading role from https://github.com/willshersystems/ansible-sshd/archive/v0.21.0.tar.gz
- extracting willshersystems.sshd to /root/.ansible/roles/willshersystems.sshd
[WARNING]: Illegal filename '..': '..' is not allowed
ERROR! Unexpected Exception, this is probably a bug: join() missing 1 required positional argument: 'a'
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
  File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 719, in run
    return context.CLIARGS['func']()
  File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 119, in method_wrapper
    return wrapped_method(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 1370, in execute_install
    self._execute_install_role(role_requirements)
  File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 1469, in _execute_install_role
    installed = role.install()
  File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/role.py", line 426, in install
    setattr(member, attr, os.path.join(*n_final_parts))
TypeError: join() missing 1 required positional argument: 'a'

@nomike
Copy link
Author

nomike commented Oct 13, 2023

I've filed a bug report for Amazon Linux 2023:
amazonlinux/amazon-linux-2023#514

Additionally I filed a bug report for Ansible:
ansible/ansible#81965

And I filled the following pull request:
ansible/ansible#81966

It might still be worth a look here, as the issue seems to be triggered by a file called ".." being included in ansible-sshd.

See https://github.com/ansible/ansible/blame/4f04df75ccacbd8eafb6c6b93333d2e799c505f1/lib/ansible/galaxy/role.py#L415

@mattwillsher
Copy link
Member

@nomike can you confirm this is/isn't working with v0.22.0? You may need to change your requirements.yaml to:

- name: willshersystems.sshd
  src: https://github.com/willshersystems/ansible-sshd
  version: v0.22.0

@mattwillsher
Copy link
Member

I don't have an AWS account to be able to check this, so I'm not sure if this is still an issue given subsequence changes as a result of the PRs. @nomike can you provide an update?

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

No branches or pull requests

2 participants