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

how to use it? #10

Closed
kostyrev opened this issue Aug 15, 2015 · 4 comments
Closed

how to use it? #10

kostyrev opened this issue Aug 15, 2015 · 4 comments

Comments

@kostyrev
Copy link
Contributor

Hello there!
It seems to be interesting code, is it merged? Are there any plans to merge? How one can use it right now if it's not merge yet.
thanks!

@Nosmoht
Copy link
Owner

Nosmoht commented Sep 15, 2015

Hi,

just install the Python library on your Ansible control server and use the examples from README.MD.

Small example how i use it to deploy CoreOS Cluster:

---
 - hosts: local
   connection: local
   gather_facts: false
   tasks:
   - name: Ensure CoreOS nodes
     foreman_host:
       name: '{{ item.name }}'
       build: true
       compute_profile: '{{ coreos_host_compute_profile }}'
       compute_resource: '{{ coreos_host_compute_resource }}'
       environment: production
       hostgroup: '{{ coreos_host_hostgroup }}'
       location: '{{ foreman_default_location }}'
       managed: true
       organization: '{{ foreman_default_organization }}'
       parameters: '{{ coreos_host_parameters }}'
       state: '{{ coreos_host_state }}'
       foreman_host: '{{ foreman_host }}'
       foreman_port: '{{ foreman_port }}'
       foreman_user: '{{ foreman_user }}'
       foreman_pass: '{{ foreman_pass }}'

Beforehand you should use foreman_compute_profile, foreman_compute_resource, ... to configure Foreman resources. Variables like compute_resource, compute_profile are just strings. You can get them by curling your Foreman API.

As i'm using Foreman to create my cloud-init i have to pass some parameters which Foreman needs to build it. Example:

coreos_host_parameters:
- name: coreos_version
  value: '{{ coreos_version }}' 
- name: coreos_channel
  value: '{{ coreos_channel }}' 
- name: users
  value: '{{ coreos_users | github_ssh_users_foreman }}' 
- name: user_primary_group
  value: '{{ coreos_user_primary_group }}' 
- name: user_groups
  value: '{{ coreos_user_groups | join(",") }}' 

When using my Python-Foreman module you can Backup your Foreman in an Ansible usable format using -a.

Hope this helps

P.S. It's not merged. Feel free to fork and used it. It's for free :-)

@kostyrev
Copy link
Contributor Author

Thanks for additional info!
I'm currently trying to use it.
I've submitted some PRs.
So I'm closing it.

@Nosmoht
Copy link
Owner

Nosmoht commented Oct 14, 2015

Great. Thanks. Please let me know your test results. I would really like to create a PR to the Ansible extra modules repo.

@kostyrev
Copy link
Contributor Author

IMHO unfortunately, your code will never make it because of http://ansible-project.narkive.com/xM2B8jCh/ansible-and-theforeman-integration

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

No branches or pull requests

2 participants