this is what i have currently

change_esxi_root_pass

├── hosts

├── main.yml

└── roles

    ├── change_esxi_root

    ├── disable_ssh

    └── enable_ssh

        ├── tasks

        │   └── main.yml

        └── vars

            ├── vars.yml

            └── vcenter_creds.yml





On Tue, Apr 25, 2023 at 5:59 AM Tony Wong <[email protected]> wrote:

> for
>
>                   |__/defaults
>                         |
>                         |__/main
>                              |__vcenter_creds.yml
>                              |__vars.yml
>
>
> does these need to be under defaults under each role?
>
> what if other roles need to access these same vars files?
>
>
>
> On Mon, Apr 24, 2023 at 10:05 PM dulhaver via Ansible Project <
> [email protected]> wrote:
>
>> the role structure can be as complex as mentioned in the previous post,
>> but it does not have to include everything. In your case I'd say it boild
>> down to this.
>>
>> you create a structure like this:
>>
>>
>>   base_folder
>>      |
>>      |__ playbook.yml
>>      |
>>      |__ /roles
>>            |
>>            |__ role1
>>                  |
>>                  |__/tasks
>>                  |     |__main.yml
>>                  |
>>                  |__/defaults
>>                         |
>>                         |__/main
>>                              |__vcenter_creds.yml
>>                              |__vars.yml
>>
>> the playbook.yml
>>
>> - name: test
>>   hosts: all
>>   gather_facts: no
>>
>>   roles:
>>     - role1
>>
>> (there are other ways to all the roles though but thius should do the
>> job)
>>
>>
>>
>> the ./tasks/main.yml
>>
>> ---
>> - name: Enable SSH service
>>   vmware_host_service_manager:
>>     hostname: “{{ vcenter_hostname }}”
>>     username: “{{ vcenter_username }}”
>>     password: “{{ vcenter_password }}”
>>     esxi_hostname: “{{ hostname }}”
>>     validate_certs: no
>>     state: present
>>     service_name: “TSM-SSH”
>>   delegate_to: localhost
>>
>>
>>
>>
>>
>>
>> On 04/24/2023 7:35 PM CEST Tony Wong <[email protected]> wrote:
>>
>>
>> I got a pb that works like this. any idea how i can convert this to a
>> role?
>>
>>
>>
>>
>> ---
>>
>> - name: test
>>
>>   hosts: all
>>
>>   gather_facts: no
>>
>>   vars_files:
>>
>>     - vcenter_creds.yml
>>
>>     - vars.yml
>>
>>
>>
>>   tasks:
>>
>>   - name: Enable SSH service
>>
>>     vmware_host_service_manager:
>>
>>       hostname: "{{ vcenter_hostname }}"
>>
>>       username: "{{ vcenter_username }}"
>>
>>       password: "{{ vcenter_password }}"
>>
>>       esxi_hostname: "{{ hostname }}"
>>
>>       validate_certs: no
>>
>>       state: present
>>
>>       service_name: "TSM-SSH"
>>
>>     delegate_to: localhost
>>
>> sdfsdfsd
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/d637013b-7cba-4401-b7c0-edcb70b6a52cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/d637013b-7cba-4401-b7c0-edcb70b6a52cn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/F6s6Iaaawxs/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/1552518980.884442.1682399125194%40office.mailbox.org
>> <https://groups.google.com/d/msgid/ansible-project/1552518980.884442.1682399125194%40office.mailbox.org?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALmkhkozMiFyzJQuL--%3DqS%3DfFFauGqZb5BER4ss2WDdpAk_GVA%40mail.gmail.com.

Reply via email to