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

Add crc-cloud Ansible role #195

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danpawlik
Copy link
Contributor

The Ansible tool might handle in better way how to deploy the CRC cloud.

@danpawlik danpawlik force-pushed the add-ansible-role branch 4 times, most recently from fe40ace to 858d3dd Compare November 6, 2024 15:41
@praveenkumar
Copy link
Member

Ansible is not able to programmatically set infra and then provision which pulumi provides. ( cc @adrianriobo for more info around using pulumi over ansible)

@adrianriobo
Copy link
Contributor

adrianriobo commented Nov 11, 2024

@danpawlik do you mean the steps insde the VM to set and ensure the cluster is running or the provisioning?

@danpawlik
Copy link
Contributor Author

danpawlik commented Nov 22, 2024

So there can be a basic way to run the ansible to setup the cluster.
PoC command:

git clone https://github.com/crc-org/crc-cloud

PULL_SECRET=$(cat $PULL_SECRET_FILE_PATH)
HOST_IP=$(ip route get 1.2.3.4 | awk '{print $7}' | head -n1)
SYSTEM_USER=core
HOSTNAME=crc.dev

cat << EOF > /var/home/core/inventory.yaml
---
all:
  hosts:
    $HOSTNAME:
      ansible_port: 22
      ansible_host: $HOST_IP
      ansible_user: $SYSTEM_USER
  vars:
    openshift_pull_secret: |
      $PULL_SECRET
EOF

cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys

for host in localhost $HOSTNAME $HOST_IP; do
    ssh-keyscan -H $host >> ~/.ssh/known_hosts
done

podman create --name test --network host -v "/var/home/core/.kube/:/home/user/.kube:z" -v "/var/home/core/.ssh:/home/user/.ssh:z" -v "/var/home/core/inventory.yaml:/home/user/inventory.yaml" -v "/var/home/come/crc-cloud:/home/user/crc-cloud:z"   fedora:40 sleep inf

podman start test
podman exec -it test bash

# inside the container
yum install -y ansible-core sudo
useradd -U -m -s /bin/bash -u 1000 user ; echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers ; chmod 0440 /etc/sudoers ; chmod g+w /etc/passwd
chown -R user:user /home/user
sudo su - user

cd crc-cloud
ansible-playbook -i /home/user/inventory.yaml ansible/playbook.yaml

With that way, there is no need to use crc-cloud binary to spawn instance (check issue: #192). The CI would be able to take crc.qcow2 image to the cloud provider, connect to it , then run the ansible playbook.

@danpawlik danpawlik force-pushed the add-ansible-role branch 2 times, most recently from 9c1370d to e1021fc Compare December 16, 2024 09:37
The Ansible tool might handle in better way how to deploy the
CRC cloud.
@danpawlik
Copy link
Contributor Author

So in the README file is early how-to deploy crc cloud using the Ansible role that will be running inside the container. With that way, we don't need to wait #192 that propably it is not a priority for you.

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