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

Fixing some plays/conf/readme in order to deploy from MAC OS #1758

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

waldirio
Copy link

@waldirio waldirio commented Feb 6, 2024

No description provided.

playbooks/foreman.yml Outdated Show resolved Hide resolved
```sh
ssh-copy-id [email protected]
```

in forklift checkout
```sh
echo -e "[devel]\ntest.example.com" > inventories/local_inventory
Copy link
Author

Choose a reason for hiding this comment

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

Hi,

Here, there is no devel.yml, I'm not sure if this one was around before or not, but I didn't change it. I'll do a double check on all the plays on this folder. Just FYI.

Thank you!
Waldirio

echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
```

Here we can see the initial configuration, when creating the python virtual environment and preparing the setup (MACOS Users or Regular Linux with no ansible)
Copy link
Member

Choose a reason for hiding this comment

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

What if we introduce this virtual env method as it's own sub-section within this section to help users understand that a virtual env is an option?

Copy link
Author

Choose a reason for hiding this comment

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

Sounds like a plan, let me do it.

Thank you!
Waldirio

Copy link
Author

Choose a reason for hiding this comment

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

@ehelms please, let me know what you think.

Thank you!
Waldirio

@@ -131,9 +132,34 @@ In case using Vagrant is not desired, ansible playbooks and roles from this repo
on test.example.com machine, where the dev env should be deployed
```sh
useradd vagrant
echo vagrant:redhat | chpasswd
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Author

Choose a reason for hiding this comment

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

I believe vagrant will deploy some key or information on the VM, in my case, I'm building a machine externally, so, once there are a bunch of plays using vagrant, I believe that keeping the user and setting the auth should be great, once I need to copy the ssh key to it. Anyway, I'm still testing the forklift with this env, passing --user root seems to work fine, but I'm not sure if we really need the vagrant user ... I believe yes.

Ps.: The ansible.cfg is using vagrant user as remote, so, not sure if we will connect as vagrant or if the play will connect as root and after that, will switch to the vagrant user.

Please, let me know if you are familiar with this process on forklift.

Thank you!
Waldirio

README.md Outdated
pip install --upgrade pip
pip install ansible
```
Note. Above, you can see `python3-intel64`. This is very specific for MacOS M1 or M2 with arm processors, just to keep the compatibility with x86. If you have a regular x86, feel free to use `python3` and it should be enough.
Copy link
Member

Choose a reason for hiding this comment

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

I would invert this relationship so the example is the standard Linux example and then include here Note for MacOS M1 or M2 users: Replace python3withpython3-intel64`.

Copy link
Author

Choose a reason for hiding this comment

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

updated.

Comment on lines +151 to +162
Then you can clone forklift and move on
```sh
git clone https://github.com/theforeman/forklift.git
cd forklift
ansible-galaxy collection install -r requirements.yml
```

Now, you can share the ssh key with the server
```sh
ssh-copy-id [email protected]
```

Copy link
Member

@ehelms ehelms Feb 6, 2024

Choose a reason for hiding this comment

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

Is this a repeat of previous steps in our documentation that is unspecific to the virtual env method? I am guessing that ansible-galaxy step is the unique one?

We could move everything else below this so that these steps are outside of the virtual env header

Copy link
Author

@waldirio waldirio Feb 7, 2024

Choose a reason for hiding this comment

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

ok, let's check how we can do this better. In the requirements, we can see

Vagrant - 2.2+ - Both the VirtualBox and Libvirt providers are tested
Ansible - 2.12+
[Vagrant Libvirt provider plugin](https://github.com/vagrant-libvirt/vagrant-libvirt) (if using Libvirt)
Virtualization enabled in BIOS

For a regular fedora, we can install the packages and it will work with no issues. As a mac user, trying to test this environment and set the best practices, it's not standard ansible via package, as well vagrant. Once virtualization it's not something that will works in a short term for this kind of processor, what I'm doing is, using the forklift to prepare the basic installation, using the plays that are already around, and installing the minimal as possible.

To achieve that, we can use virtual env, python3 is already standard on mac, that specific binary will keep the compatibility with x86 python modules, then internally we can just install ansible anv voila, we can proceed using the plays.

All the plays that we have atm will work with no problem? No idea, but I'll test! 😉

With that said, I'm recommending the venv just for the section below, for everyone else with fedora/rhel, it should not be a big deal, they could install the rpms and everything should be fine.

#### Python Venv for MacOS or Non Ansible Linux

Let me know what you think.
Waldirio

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Like @ehelms, I think the structure isn't the best. You put it between two parts that are about using non-vagrant machines. IMHO they are two separate concerns. I can imagine that on a mac you need to install ansible using a venv, but still use Vagrant (with VirtualBox).

pip install --upgrade pip
pip install ansible
```
Note. Above, you can see `python3`, this is the standard for any x86 server running Linux. If you are using MacOS M1 or M2 with arm processors, then you should use `/usr/local/bin/python3-intel64` instead, just for the sake of compatibility with x86.
Copy link
Member

Choose a reason for hiding this comment

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

Do we care if it's compatible with x86? Does Ansible rely on any native libraries that aren't available on ARM?

@waldirio
Copy link
Author

Hello all,

I'm already working on it, @ianballou is helping a lot, and soon we will have some news. I believe we can keep this PR on hold, and then we can return to it.

and @ekohl answering your point, in my case, no vagrant at all, just forklift and centos8 stream server, and moving on to setup the whole environment.

I'll keep you all posted.

Thank you!
Waldirio

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.

3 participants