A story of connecting to a CentOS 8 server with an old Ansible

Only recently I started building a server for CentOS8, and I thought it was one shot with ansible, but it wasn't one shot, so it's a memo.

I feel that it will end if I raise the version of Ansible, but since I was told from the top that "the range of influence is ...", I responded without raising the version.

environment

Ansible server
Build-to server

what's happened

When I started CentOS 8 on EC2 and ran the playbook on ansible playbook, I got an error like this

fatal: [server name]: FAILED! => {
    "changed": false, "failed": true, 
    "module_stderr": "Shared connection to [server name] closed.\r\n", 
    "module_stdout": "/bin/sh: /usr/bin/python: No such file or directory\r\n", 
    "msg": "MODULE FAILURE", 
    "rc": 0
}

Cause

ansible2.3 works with python2, but CentOS8 does not have python2 installed by default __ Even if you link to python3 installed in / usr / bin / python, the operation cannot be guaranteed due to the difference in version (I do not know because I have not done it)

Countermeasures

As I wrote at the beginning, it was said that the support for upgrading the version was NG, so install python2 and support it.

Install python2.7 on the CentOS8 server you are building

dnf install python2

After installation, create a symlink for python2.7

ln -s /usr/bin/python2.7 /usr/bin/python

It's okay if the link python-> /usr/bin/python2.7 is pasted like this

[root@hoge:~]$ll /usr/bin | grep python | grep -e "^l"
lrwxrwxrwx  1 root root       18 Oct  1 16:17 python -> /usr/bin/python2.7
lrwxrwxrwx. 1 root root        9 Jun  5 12:38 python2 -> python2.7
lrwxrwxrwx. 1 root root       25 Oct  1 16:04 python3 -> /etc/alternatives/python3
lrwxrwxrwx. 1 root root       31 Nov 21  2019 python3.6 -> /usr/libexec/platform-python3.6
lrwxrwxrwx. 1 root root       32 Nov 21  2019 python3.6m -> /usr/libexec/platform-python3.6m
lrwxrwxrwx. 1 root root       24 Oct  1 16:10 unversioned-python -> /etc/alternatives/python

You can now run your playbook from your old Ansible.

However, in this state, an error will occur in the new version of Ansible. This can be avoided by including ansible_python_interpreter = / usr / bin / python3 in the new version of Ansible's hosts file.

[hoge-sv]
hoge001.net ansible_python_interpreter=/usr/bin/python3

Summary

Even CentOS8, which does not have python2 installed by default, can now run ansible by installing python2. Basically, I think it is better to upgrade the version.

Recommended Posts

A story of connecting to a CentOS 8 server with an old Ansible
A story addicted to toString () of Interface proxied with JdkDynamicAopProxy
The story of toString () starting with passing an array to System.out.println
Create a simple gateway server by setting masquerade with firewall-cmd of CentOS8
A story that I was addicted to twice with the automatic startup setting of Tomcat 8 on CentOS 8
Procedure for connecting from a virtual machine to an external network via a proxy server (VirtualBox, Windows10, CentOS7)
It's a pain to deal with old dates
Prepare a LEMP Ubuntu 18 server with Ansible Galaxy
A story addicted to EntityNotFoundException of getOne of JpaRepository
Set up a CentOS virtual server with Vagrant
How to deploy a system created with Java (Wicket-Spring boot) to an on-campus server
Rails6 I want to make an array of values with a check box
The story of making a reverse proxy with ProxyServlet
A story about trying to get along with Mockito
Create a user with an empty password on CentOS7
Steps to set up a VNC server on CentOS 8.3
A story that failed when connecting to CloudSQL by running Sprint-boot with kubernetes (GKE)
A story about reducing memory consumption to 1/100 with find_in_batches
How to build a Jenkins server with a Docker container on CentOS 7 of VirtualBox and access the Jenkins server from a local PC
The story of pushing a Docker container to GitHub Package Registry and Docker Hub with GitHub Actions
The story of migrating a stray batch without an owner from EC2 to a Docker environment
A story stuck with an error when building Vagrant + Virtulbox CentOS7.8 and creating a shared folder
The story of building a Java version of Minecraft server with GCP (and also set a whitelist)
Story from inexperienced x self-study to becoming an engineer of a web-based in-house development company
A story I was addicted to with implicit type conversion of ActiveRecord during unit testing
I made a server side of an online card game ⑤
I made a server side of an online card game ③
Port C code with a lot of typecasts to Swift
I made a server side of an online card game ⑥
A story packed with the basics of Spring Boot (solved)
Initialization with an empty string to an instance of Java String type
A series of steps to create portfolio deliverables with Rails
I made a server side of an online card game ④
How to move another class with a button action of another class.
I made a server side of an online card game ②
A story stuck with NotSerializableException
The story of the first Rails app refactored with a self-made helper
Try to imitate the idea of a two-dimensional array with a one-dimensional array
A story that I struggled to challenge a competition professional with Java
A story of frustration trying to create a penetration environment on Ubuntu 20.04
I tried to build the environment of PlantUML Server with Docker
Connecting to a database with Java (Part 1) Maybe the basic method
A story about hitting the League Of Legends API with JAVA
Cast an array of Strings to a List of Integers in Java
I tried to check the operation of gRPC server with grpcurl
A story that struggled with the introduction of Web Apple Pay
How to write when installing Amazon Corretto 8 on CentOS 8 with Ansible.
How to create a web server on an EC2 instance on AWS
The story of making it possible to build a project that was built by Maven with Ant
A story that I wanted to write a process equivalent to a while statement with the Stream API of Java8
The story of introducing Gradle as a retrofit to an existing system that did not manage packages
Write a Reactive server with Micronaut
Launch a stub server with WireMock
Connect to Rails server with iPhone
How to interact with a server that does not crash the app
Link Apache and Tomcat in a blink of an eye on CentOS 8
The story of forgetting to close a file in Java and failing
The story of making a game launcher with automatic loading function [Java]
I made an app to scribble with PencilKit on a PDF file
[Java] How to turn a two-dimensional array with an extended for statement
How to convert an array of Strings to an array of objects with the Stream API