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

Modify for Amazon Linux 2023 #44

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

yuichisatake
Copy link
Contributor

python3 is installed by default on amazon linux2023.
So, when I changed ansible's interpreter_python to "/usr/bin/python3" and executed the role, the following error occurred.

TASK [mackerelio.mackerel-agent : install mackerel-agent] ****************************************************************************************************
task path: /home/sysadmin/.ansible/roles/mackerelio.mackerel-agent/tasks/amazonlinux.yml:31
fatal: [10.16.4.68]: FAILED! => {"changed": false, "msg": "The Python 2 yum module is needed for this module. If you require Python 3 support use the `dnf` Ansible module instead."}`

I created a pull request that works with the pyton3 interpreter, so please consider merging it.

@lufia
Copy link
Member

lufia commented Apr 12, 2024

I see, yum module is strongly depends on Python 2.

We are trying to merge this PR onto main branch, however, I have some questions.

  1. Could you add dnf support to files under tasks directory, such as amazonlinux.yml or main.yml?
  2. If can't, are there technical issues?

@yuichisatake
Copy link
Contributor Author

@lufia
sorry. The location of the task file was incorrect.
We have corrected it, so please check it.

files/amazonlinux-mackerel-v2023.repo Outdated Show resolved Hide resolved
Comment on lines +11 to +12
- include_tasks: amazonlinux2023.yml
when: ansible_distribution == "Amazon" and ansible_distribution_major_version == "2023"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like it

@yuichisatake
Copy link
Contributor Author

@lufia
I have fixed the pull request, so please check it.

@lufia
Copy link
Member

lufia commented Apr 19, 2024

@yuichisatake Thank you!

I'm going to merge this patch.

@@ -6,7 +6,10 @@
when: ansible_os_family == "RedHat" and ansible_distribution != "Amazon"

- include_tasks: amazonlinux.yml
when: ansible_distribution == "Amazon"
when: ansible_distribution == "Amazon" and ansible_distribution_major_version == "2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

$ ansible localhost -m setup | grep ansible_distribution_major
        "ansible_distribution_major_version": "2", 
[ec2-user@ip-172-31-20-176 ~]$ cat /etc/os-release 
NAME="Amazon Linux"
VERSION="2"
...

@lufia lufia merged commit f8deaef into mackerelio:master Apr 23, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants