-
Notifications
You must be signed in to change notification settings - Fork 200
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ Forklift provides tools to create Foreman/Katello environments for development, | |
- [Additional Documentation](#additional-documentation) | ||
- [Development Environment](#development-environment) | ||
- [Using Playbooks and Roles Without Vagrant](#using-playbooks-and-roles-without-vagrant) | ||
- [Python Venv for MacOS or Non Ansible Linux](#python-venv-for-macos-or-non-ansible-linux) | ||
- [Credentials](#credentials) | ||
- [Poor man's DNS a.k.a /etc/hosts](#poor-mans-dns-aka-etchosts) | ||
- [Adding Custom Boxes](#adding-custom-boxes) | ||
|
@@ -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 | ||
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant | ||
``` | ||
|
||
#### Python Venv for MacOS or Non Ansible Linux | ||
|
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like a plan, let me do it. Thank you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ehelms please, let me know what you think. Thank you! |
||
```sh | ||
/usr/local/bin/python3 -m venv ~/.venv/forklift | ||
source ~/.venv/forklift/bin/activate | ||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
|
||
|
||
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] | ||
``` | ||
|
||
Comment on lines
+151
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 We could move everything else below this so that these steps are outside of the virtual env header There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
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.
Let me know what you think. |
||
in forklift checkout | ||
```sh | ||
echo -e "[devel]\ntest.example.com" > inventories/local_inventory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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! |
||
|
@@ -142,6 +168,12 @@ ansible-playbook --private-key=~/.ssh/id_rsa --user root --inventory inventories | |
|
||
In an example above, ansible was instructed to use specific private key (overriding the value from ansible.cfg), root user was set as ssh user and playbook variable was set, so that checkout will be made from katello user. | ||
|
||
```sh | ||
echo -e "[foreman]\foreman.example.com" >> inventories/local_inventory | ||
ansible-playbook --inventory inventories/local_inventory -l foreman playbooks/foreman.yml | ||
``` | ||
Above you can see another example, at this moment, we have two groups in the `inventories/local_inventory` file. Using the flag `-l`, we can set the group that we would like to call, here we can see `foreman`, which means, only the server set on this group will be affected, if you omit it, all hosts will be the standard. Also, the user vagrant will be used once it's defined as default remote user on `ansible.cfg` file. | ||
|
||
Other playbooks from playbooks/ directory can be used similarly, though some might need more variables and investigating their parameters is recommended first. | ||
|
||
### Credentials | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
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