ansibleguy76 / ansibleforms

A webapplication to create pretty advanced forms to run ansible playbooks or awx templates.
https://ansibleforms.com/
GNU General Public License v3.0
74 stars 12 forks source link

instructions or environment variable for passing inventory file path #98

Closed nx2804 closed 1 year ago

nx2804 commented 1 year ago

in docs there is not elaborated examples provided for inventories

ansibleguy76 commented 1 year ago

https://ansibleforms.com/form/#ansible_inventory => does this work ? Just set a property in the form. In case you want it dynamically, it can be set using a formfield. name the formfield "inventory"

nx2804 commented 1 year ago

i tried already provided inventory formfield
categories:

also i tried passing dynamic inventory with the help of fields

fields:

ansibleguy76 commented 1 year ago

there is no field type inventory, use text, expression, ... whatever fits your needs to fill the value of the inventory name. but name the field "inventory" => not "inventory".

example :

type: expression
runLocal: true
expression: "'bla.yaml'"
hide: true
name: __inventory__
ansibleguy76 commented 1 year ago

If you want it operator driven, use a text field, or use enum field with dropdown... many options

nx2804 commented 1 year ago

where should be the inventory file located? under data/inventory path?

On Tue, 19 Sept 2023 at 15:11, AnsibleGuy76 @.***> wrote:

If you want it operator driven, use a text field, or use enum field with dropdown... many options

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/98#issuecomment-1725166915, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMFSHNHJQITSFQLAHKLX3FSDLANCNFSM6AAAAAA4572SZ4 . You are receiving this because you authored the thread.Message ID: @.***>

ansibleguy76 commented 1 year ago

data/playbooks

that is the "ansible" path used.

ansibleguy76 commented 1 year ago

data is a parent for many things, database, certificates, forms. playbooks is one of the them and hosts your ansible files

nx2804 commented 1 year ago

what if the remote hosts requires ssh username and password or private key file how can i pass that

On Tue, 19 Sept 2023 at 15:16, AnsibleGuy76 @.***> wrote:

data is a parent for many things, database, certificates, forms. playbooks is one of the them and hosts your ansible files

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/98#issuecomment-1725174441, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMGRVNBDRHCWROTTYILX3FSWLANCNFSM6AAAAAA4572SZ4 . You are receiving this because you authored the thread.Message ID: @.***>

ansibleguy76 commented 1 year ago

can you explain a little more ? In settings checkout ssh key & knownhosts, to setup outgoing ssh sessions.
It's important to know that in the end AF only assembles an anisble-playbook command and executes it. So let me know what ansible-playbook command you would want to execute.

nx2804 commented 1 year ago

ansible-playbook playbook.yaml -u --ask-pass < password>

On Tue, 19 Sept 2023 at 16:08, AnsibleGuy76 @.***> wrote:

can you explain a little more ? In settings checkout ssh key & knownhosts, to setup outgoing ssh sessions. It's important to know that in the end AF only assembles an anisble-playbook command and executes it. So let me know what ansible-playbook command you would want to execute.

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/98#issuecomment-1725253437, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMET6A3F5HCM62LVRD3X3FY2XANCNFSM6AAAAAA4572SZ4 . You are receiving this because you authored the thread.Message ID: @.***>

ansibleguy76 commented 1 year ago

you should place these in the inventory, no ?

nx2804 commented 1 year ago

In inventory file if I pass ansible_ssh_pass with value it got failed with error as sshpass should be installed the docker image

And for key file how to pass in forms and where the key should be placed( which location) under data

On Tue, 19 Sep 2023 at 5:48 PM, AnsibleGuy76 @.***> wrote:

you should place these in the inventory, no ?

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/98#issuecomment-1725402395, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMFUT4NEMD37MRNVJX3X3GESBANCNFSM6AAAAAA4572SZ4 . You are receiving this because you authored the thread.Message ID: @.***>

nx2804 commented 1 year ago

any response on this

On Wed, 20 Sep 2023 at 4:51 AM, Nachammai Chidambaram < @.***> wrote:

In inventory file if I pass ansible_ssh_pass with value it got failed with error as sshpass should be installed the docker image

And for key file how to pass in forms and where the key should be placed( which location) under data

On Tue, 19 Sep 2023 at 5:48 PM, AnsibleGuy76 @.***> wrote:

you should place these in the inventory, no ?

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/98#issuecomment-1725402395, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMFUT4NEMD37MRNVJX3X3GESBANCNFSM6AAAAAA4572SZ4 . You are receiving this because you authored the thread.Message ID: @.***>

ansibleguy76 commented 1 year ago

can you please give detailed steps on what you try, how it works outside docker and how it fails inside docker. so i can reproduce.

nx2804 commented 1 year ago

I was trying to connect to a host machine from container using ssh

under data/playbook/test.yaml

under data/playbook/inventory.yaml all: hosts:

vars: ansible_ssh_password: ansible_user: i tried setting the password using ansible_ssh_pass / ansible_password /ansible_ssh_password, When it tries to perform ssh from container to target host it fails with sshpass should be installed error Note: I have already installed sshpass package in my hostmachine. So in container it is looking for sshpass On Wed, 20 Sep 2023 at 11:04 AM, AnsibleGuy76 ***@***.***> wrote: > can you please give detailed steps on what you try, how it works outside > docker and how it fails inside docker. so i can reproduce. > > — > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
nx2804 commented 1 year ago

are you able to replicate it ?

On Wed, 20 Sept 2023 at 14:51, Nachammai Chidambaram < @.***> wrote:

I was trying to connect to a host machine from container using ssh

under data/playbook/test.yaml

  • name: test hosts: all tasks:
    • name: ansibleforms execution shell: rpm -i

under data/playbook/inventory.yaml all: hosts:

vars: ansible_ssh_password: ansible_user: i tried setting the password using ansible_ssh_pass / ansible_password /ansible_ssh_password, When it tries to perform ssh from container to target host it fails with sshpass should be installed error Note: I have already installed sshpass package in my hostmachine. So in container it is looking for sshpass On Wed, 20 Sep 2023 at 11:04 AM, AnsibleGuy76 ***@***.***> wrote: > can you please give detailed steps on what you try, how it works outside > docker and how it fails inside docker. so i can reproduce. > > — > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
nx2804 commented 1 year ago

Hello any response on this?

On Wed, 20 Sep 2023 at 8:55 PM, Nachammai Chidambaram < @.***> wrote:

are you able to replicate it ?

On Wed, 20 Sept 2023 at 14:51, Nachammai Chidambaram < @.***> wrote:

I was trying to connect to a host machine from container using ssh

under data/playbook/test.yaml

  • name: test hosts: all tasks:
    • name: ansibleforms execution shell: rpm -i

under data/playbook/inventory.yaml all: hosts:

vars: ansible_ssh_password: ansible_user: i tried setting the password using ansible_ssh_pass / ansible_password /ansible_ssh_password, When it tries to perform ssh from container to target host it fails with sshpass should be installed error Note: I have already installed sshpass package in my hostmachine. So in container it is looking for sshpass On Wed, 20 Sep 2023 at 11:04 AM, AnsibleGuy76 ***@***.***> wrote: > can you please give detailed steps on what you try, how it works outside > docker and how it fails inside docker. so i can reproduce. > > — > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
ansibleguy76 commented 1 year ago

Sorry.. been busy.. I'll pick it up asap !

nx2804 commented 1 year ago

I have created on more question is it possible to create variable from ui like survey variables in awx

On Tue, 26 Sep 2023 at 12:57 AM, AnsibleGuy76 @.***> wrote:

Sorry.. been busy.. I'll pick it up asap !

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/98#issuecomment-1734337489, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMFZ3IEGDMQG7G2QG6TX4HLJVANCNFSM6AAAAAA4572SZ4 . You are receiving this because you authored the thread.Message ID: @.***>

ansibleguy76 commented 1 year ago

I have just deployed a new beta I would like you to try where I installed sshpass in the docker image.

nx2804 commented 1 year ago

Ok let me try

On Tue, 26 Sep 2023 at 2:48 AM, AnsibleGuy76 @.***> wrote:

I have just deployed a new beta I would like you to try where I installed sshpass in the docker image.

— Reply to this email directly, view it on GitHub https://github.com/ansibleguy76/ansibleforms/issues/98#issuecomment-1734476007, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCAEUMBKRKE4EPN2FJ7QWODX4HYIRANCNFSM6AAAAAA4572SZ4 . You are receiving this because you authored the thread.Message ID: @.***>

ansibleguy76 commented 1 year ago

in the newest latest release, with the sshpass, I don't see any issues. I tried inventories with ansible_ssh_pass and it all works fine. I did have to add the ip's to the known hosts (possible in settings) (or disable the key checking)